Skip to content

Instantly share code, notes, and snippets.

@epsi1on

epsi1on/main.cpp Secret

Last active November 9, 2017 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epsi1on/9a671b853f3c024c9bb0fb86602691b5 to your computer and use it in GitHub Desktop.
Save epsi1on/9a671b853f3c024c9bb0fb86602691b5 to your computer and use it in GitHub Desktop.
#include <stdlib.h>
#include <OPS_Globals.h>
#include <StandardStream.h>
#include <ArrayOfTaggedObjects.h>
// includes for the domain classes
#include <Domain.h>
#include <Node.h>
#include <shell/ShellDKGQ.h>
#include <ElasticMembranePlateSection.h>
#include <SP_Constraint.h>
#include <LoadPattern.h>
#include <LinearSeries.h>
#include <NodalLoad.h>
// includes for the analysis classes
#include <StaticAnalysis.h>
#include <AnalysisModel.h>
#include <Linear.h>
#include <PlainHandler.h>
#include <DOF_Numberer.h>
#include <RCM.h>
#include <LoadControl.h>
#include <BandSPDLinSOE.h>
#include <BandSPDLinLapackSolver.h>
#include <ConjugateGradientSolver.h>
#include <PenaltyConstraintHandler.h>
#include <LagrangeConstraintHandler.h>
// init the global variabled defined in OPS_Globals.h
StandardStream sserr;
OPS_Stream *opserrPtr = &sserr;
// main routine
int main(int argc, char **argv)
{
//
// now create a domain and a modelbuilder
// and build the model
//
Domain *theDomain = new Domain();
// create the nodes using constructor:
// Node(tag, ndof, crd1, crd2)
// and then add them to the domain
Node *node1 = new Node(1, 6, 0.0, 0.0, 0.0);
Node *node2 = new Node(2, 6, 1.0, 0.0, 0.0);
Node *node3 = new Node(3, 6, 1.0, 1.0, 0.0);
Node *node4 = new Node(4, 6, 0.0, 1.0, 0.0);
theDomain->addNode(node1);
theDomain->addNode(node2);
theDomain->addNode(node3);
theDomain->addNode(node4);
ElasticMembranePlateSection *sec = new ElasticMembranePlateSection(1, 2100, 0.3, 0.2,1.0);
ShellDKGQ *shl = new ShellDKGQ(1, 1, 2, 3, 4, *sec);
theDomain->addElement(shl);
int cnt = 0;
for (int ndeNum = 1; ndeNum <= 2; ndeNum++)
for (int j = 0; j < 6; j++)
{
SP_Constraint *sp = new SP_Constraint(ndeNum, j, 0.0, true);
theDomain->addSP_Constraint(sp);
}
TimeSeries *theSeries = new LinearSeries();
LoadPattern *theLoadPattern = new LoadPattern(1);
theLoadPattern->setTimeSeries(theSeries);
theDomain->addLoadPattern(theLoadPattern);
Vector theLoadValues(6);
for (int i = 0; i<6; i++)
theLoadValues(i) = -5000.0;
NodalLoad *theLoad = new NodalLoad(1, 2, theLoadValues);
theDomain->addNodalLoad(theLoad, 1);
BandSPDLinSolver *theSolver = new BandSPDLinLapackSolver();
RCM *theRCM = new RCM();
EquiSolnAlgo *theSolnAlgo = new Linear();
DOF_Numberer *theNumberer = new DOF_Numberer(*theRCM);
LinearSOE *theSOE = new BandSPDLinSOE(*theSolver);
AnalysisModel *theModel = new AnalysisModel();
StaticIntegrator *theIntegrator = new LoadControl(1.0, 1, 1.0, 1.0);
ConstraintHandler *theHandler = new PlainHandler();
StaticAnalysis theAnalysis(*theDomain,
*theHandler,
*theNumberer,
*theModel,
*theSolnAlgo,
*theSOE,
*theIntegrator);
// perform the analysis & print out the results for the domain
int numSteps = 2;
theAnalysis.analyze(numSteps);
opserr << *theDomain;
for (int i = 0; i < 4; i++)
{
Vector displ = (theDomain->getNode(i+1))->getDisp();
opserr << i+1 << " : " << displ;
}
exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment