int OPS_PFEMElement2D(Domain& theDomain, const ID& elenodes, ID& eletags) { int numdata = OPS_GetNumRemainingInputArgs(); if(numdata < 4) { opserr<<"WARNING: insufficient number of arguments\n"; return 0; } // rho, mu, b1, b2, (thickness, kappa, lumped) numdata = OPS_GetNumRemainingInputArgs(); if(numdata > 7) numdata = 7; double data[7] = {0,0,0,0,1.0,-1,1}; if(OPS_GetDoubleInput(&numdata,data) < 0) return 0; // create elements ElementIter& theEles = theDomain.getElements(); Element* theEle = theEles(); int currTag = 0; if (theEle != 0) { currTag = theEle->getTag(); } eletags.resize(elenodes.Size()/3); for (int i=0; i<eletags.Size(); i++) { theEle = new PFEMElement2D(--currTag,elenodes(3*i),elenodes(3*i+1),elenodes(3*i+2), data[0],data[1],data[2],data[3],data[4],data[5],data[6]); if (theEle == 0) { opserr<<"WARNING: run out of memory for creating element\n"; return -1; } if (theDomain.addElement(theEle) == false) { opserr<<"WARNING: failed to add element to domain\n"; delete theEle; return -1; } eletags(i) = currTag; } return 0; }
int Mesh::newElements(const ID& elends) { Domain* domain = OPS_GetDomain(); if (domain == 0) { opserr << "WARNING: domain is not created\n"; return -1; } // if no element, no new elements if (eleType == 0) return 0; if (elends.Size() < numelenodes) { return 0; } // function to call void* (*OPS_Func)(const ID& info) = 0; switch (eleType) { case ELE_TAG_ElasticBeam2d: OPS_Func = OPS_ElasticBeam2d; break; case ELE_TAG_ForceBeamColumn2d: OPS_Func = OPS_ForceBeamColumn2d; break; case ELE_TAG_DispBeamColumn2d: OPS_Func = OPS_DispBeamColumn2d; break; case ELE_TAG_PFEMElement2DBubble: OPS_Func = OPS_PFEMElement2DBubble; break; case ELE_TAG_PFEMElement3DBubble: OPS_Func = OPS_PFEMElement3DBubble; break; case ELE_TAG_PFEMElement2Dmini: OPS_Func = OPS_PFEMElement2Dmini; break; case ELE_TAG_PFEMElement2DCompressible: OPS_Func = OPS_PFEMElement2DCompressible; break; case ELE_TAG_Tri31: OPS_Func = OPS_Tri31; break; case ELE_TAG_FourNodeTetrahedron: OPS_Func = OPS_FourNodeTetrahedron; break; case ELE_TAG_ShellMITC4: OPS_Func = OPS_ShellMITC4; break; default: OPS_Func = OPS_ElasticBeam2d; } int eletag = this->nextEleTag(); int nodetag = this->nextNodeTag(); // create elements ID neweletags(elends.Size()/numelenodes); std::vector<Element*> neweles(neweletags.Size()); #pragma omp parallel for for (int i=0; i<neweletags.Size(); ++i) { // element tag neweletags(i) = eletag+i; // info ID info(numelenodes+4); info(0) = 2; // load data info(1) = this->getTag(); // mesh tag info(2) = neweletags(i); // ele tag for (int j=0; j<numelenodes; ++j) { // get elenode info(3+j) = elends(numelenodes*i+j); } info(numelenodes+3) = nodetag+i; // create element neweles[i] = (Element*)OPS_Func(info); } // add elements to domain for (unsigned int i=0; i<neweles.size(); ++i) { if (neweles[i] == 0) { opserr<<"WARING: run out of memory for creating element\n"; return -1; } if (domain->addElement(neweles[i]) == false) { opserr<<"WARNING: failed to add element to domain\n"; delete neweles[i]; return -1; } } this->addEleTags(neweletags); return 0; }
// 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, 2, 0.0, 0.0); Node *node2 = new Node(2, 2, 144.0, 0.0); Node *node3 = new Node(3, 2, 168.0, 0.0); Node *node4 = new Node(4, 2, 72.0, 96.0); theDomain->addNode(node1); theDomain->addNode(node2); theDomain->addNode(node3); theDomain->addNode(node4); // create an elastic material using constriuctor: // ElasticMaterialModel(tag, E) UniaxialMaterial *theMaterial = new ElasticMaterial(1, 3000); // create the truss elements using constructor: // Truss(tag, dim, nd1, nd2, Material &,A) // and then add them to the domain Truss *truss1 = new Truss(1, 2, 1, 4, *theMaterial, 10.0); Truss *truss2 = new Truss(2, 2, 2, 4, *theMaterial, 5.0); Truss *truss3 = new Truss(3, 2, 3, 4, *theMaterial, 5.0); theDomain->addElement(truss1); theDomain->addElement(truss2); theDomain->addElement(truss3); // create the single-point constraint objects using constructor: // SP_Constraint(tag, nodeTag, dofID, value) // and then add them to the domain SP_Constraint *sp1 = new SP_Constraint(1, 1, 0, 0.0); SP_Constraint *sp2 = new SP_Constraint(2, 1, 1, 0.0); SP_Constraint *sp3 = new SP_Constraint(3, 2, 0, 0.0); SP_Constraint *sp4 = new SP_Constraint(4, 2, 1, 0.0); SP_Constraint *sp5 = new SP_Constraint(5, 3, 0, 0.0); SP_Constraint *sp6 = new SP_Constraint(6, 3, 1, 0.0); theDomain->addSP_Constraint(sp1); theDomain->addSP_Constraint(sp2); theDomain->addSP_Constraint(sp3); theDomain->addSP_Constraint(sp4); theDomain->addSP_Constraint(sp5); theDomain->addSP_Constraint(sp6); // construct a linear time series object using constructor: // LinearSeries() TimeSeries *theSeries = new LinearSeries(); // construct a load pattren using constructor: // LoadPattern(tag) // and then set it's TimeSeries and add it to the domain LoadPattern *theLoadPattern = new LoadPattern(1); theLoadPattern->setTimeSeries(theSeries); theDomain->addLoadPattern(theLoadPattern); // construct a nodal load using constructor: // NodalLoad(tag, nodeID, Vector &) // first construct a Vector of size 2 and set the values NOTE C INDEXING // then construct the load and add it to the domain Vector theLoadValues(2); theLoadValues(0) = 100.0; theLoadValues(1) = -50.0; NodalLoad *theLoad = new NodalLoad(1, 4, theLoadValues); theDomain->addNodalLoad(theLoad, 1); // create an Analysis object to perform a static analysis of the model // - constructs: // AnalysisModel of type AnalysisModel, // EquiSolnAlgo of type Linear // StaticIntegrator of type LoadControl // ConstraintHandler of type Penalty // DOF_Numberer which uses RCM // LinearSOE of type Band SPD // and then the StaticAnalysis object AnalysisModel *theModel = new AnalysisModel(); EquiSolnAlgo *theSolnAlgo = new Linear(); StaticIntegrator *theIntegrator = new LoadControl(1.0, 1, 1.0, 1.0); ConstraintHandler *theHandler = new PenaltyConstraintHandler(1.0e8,1.0e8); RCM *theRCM = new RCM(); DOF_Numberer *theNumberer = new DOF_Numberer(*theRCM); BandSPDLinSolver *theSolver = new BandSPDLinLapackSolver(); LinearSOE *theSOE = new BandSPDLinSOE(*theSolver); StaticAnalysis theAnalysis(*theDomain, *theHandler, *theNumberer, *theModel, *theSolnAlgo, *theSOE, *theIntegrator); // perform the analysis & print out the results for the domain int numSteps = 1; theAnalysis.analyze(numSteps); opserr << *theDomain; exit(0); }
int OPS_ElasticBeam2d(Domain& theDomain, const ID& elenodes, ID& eletags) { if(OPS_GetNumRemainingInputArgs() < 4) { opserr<<"insufficient arguments:A,E,Iz,transfTag\n"; return -1; } // inputs: double data[3]; int numData = 3; if(OPS_GetDoubleInput(&numData,&data[0]) < 0) return -1; numData = 1; int transfTag; if(OPS_GetIntInput(&numData,&transfTag) < 0) return -1; // options double mass = 0.0, alpha=0.0, depth=0.0; int cMass = 0; while(OPS_GetNumRemainingInputArgs() > 0) { std::string type = OPS_GetString(); if(type == "-alpha") { if(OPS_GetNumRemainingInputArgs() > 0) { if(OPS_GetDoubleInput(&numData,&alpha) < 0) return -1; } } else if(type == "-depth") { if(OPS_GetNumRemainingInputArgs() > 0) { if(OPS_GetDoubleInput(&numData,&depth) < 0) return -1; } } else if(type == "-mass") { if(OPS_GetNumRemainingInputArgs() > 0) { if(OPS_GetDoubleInput(&numData,&mass) < 0) return -1; } } else if(type == "-cMass") { cMass = 1; } } // check transf CrdTransf* theTransf = OPS_getCrdTransf(transfTag); if(theTransf == 0) { opserr<<"coord transfomration not found\n"; return -1; } // create elements ElementIter& theEles = theDomain.getElements(); Element* theEle = theEles(); int currTag = 0; if (theEle != 0) { currTag = theEle->getTag(); } eletags.resize(elenodes.Size()/2); for (int i=0; i<elenodes.Size()/2; i++) { theEle = new ElasticBeam2d(--currTag,data[0],data[1],data[2],elenodes(2*i),elenodes(2*i+1), *theTransf,alpha,depth,mass,cMass); if (theEle == 0) { opserr<<"WARING: run out of memory for creating element\n"; return -1; } if (theDomain.addElement(theEle) == false) { opserr<<"WARNING: failed to add element to domain\n"; delete theEle; return -1; } eletags(i) = currTag; } return 0; }
int main(int argc, char **argv) { // first build our error handler g3ErrorHandler = new ConsoleErrorHandler(); // // now create a domain and a modelbuilder // and build the model // // Domain *theDomain = new Domain(); MapOfTaggedObjects theStorage; // ArrayOfTaggedObjects theStorage(32); Domain *theDomain = new Domain(theStorage); // create the nodes using constructor: // Node(tag, ndof, crd1, crd2, crd3 ) // and then add them to the domain Node *node1 = new Node(1, 3, 1.0, 1.0, 0.0 ); Node *node2 = new Node(2, 3, 0.0, 1.0, 0.0 ); Node *node3 = new Node(3, 3, 0.0, 0.0, 0.0 ); Node *node4 = new Node(4, 3, 1.0, 0.0, 0.0 ); Node *node5 = new Node(5, 3, 1.0, 1.0, 1.0 ); Node *node6 = new Node(6, 3, 0.0, 1.0, 1.0 ); Node *node7 = new Node(7, 3, 0.0, 0.0, 1.0 ); Node *node8 = new Node(8, 3, 1.0, 0.0, 1.0 ); theDomain->addNode(node1); theDomain->addNode(node2); theDomain->addNode(node3); theDomain->addNode(node4); theDomain->addNode(node5); theDomain->addNode(node6); theDomain->addNode(node7); theDomain->addNode(node8); // create an elastic isotropic 3D material using constriuctor: // ElasticIsotropic3D(tag, E, v) NDMaterial *theMaterial = new ElasticIsotropic3D(1, 3000, 0.3); // create the EightNodeBrick elements using constructor: // EightNodeBrick(tag, nd1, nd2, nd3, nd4, nd5, nd6, nd7, nd8, // Material &, const *char type, double bodyforce1, double bodyforce2, // double pressure, double rho, EPState *InitEPS) // and then add them to the domain // For elastic material, no EPState, just supply null. EPState *eps = 0; EightNodeBrick *brick = new EightNodeBrick(1, 5, 6, 7, 8, 1, 2, 3, 4, theMaterial, "ElasticIsotropic3D", 0.0, 0.0, 0.0, 1.8, eps); theDomain->addElement( brick ); // create the single-point constraint objects using constructor: // SP_Constraint(tag, nodeTag, dofID, value) // and then add them to the domain SP_Constraint *sp1 = new SP_Constraint(1, 1, 0, 0.0); SP_Constraint *sp2 = new SP_Constraint(2, 1, 1, 0.0); SP_Constraint *sp3 = new SP_Constraint(3, 1, 2, 0.0); SP_Constraint *sp4 = new SP_Constraint(4, 2, 0, 0.0); SP_Constraint *sp5 = new SP_Constraint(5, 2, 1, 0.0); SP_Constraint *sp6 = new SP_Constraint(6, 2, 2, 0.0); SP_Constraint *sp7 = new SP_Constraint(7, 3, 0, 0.0); SP_Constraint *sp8 = new SP_Constraint(8, 3, 1, 0.0); SP_Constraint *sp9 = new SP_Constraint(9, 3, 2, 0.0); SP_Constraint *sp10 = new SP_Constraint(10, 4, 0, 0.0); SP_Constraint *sp11 = new SP_Constraint(11, 4, 1, 0.0); SP_Constraint *sp12 = new SP_Constraint(12, 4, 2, 0.0); theDomain->addSP_Constraint(sp1 ); theDomain->addSP_Constraint(sp2 ); theDomain->addSP_Constraint(sp3 ); theDomain->addSP_Constraint(sp4 ); theDomain->addSP_Constraint(sp5 ); theDomain->addSP_Constraint(sp6 ); theDomain->addSP_Constraint(sp7 ); theDomain->addSP_Constraint(sp8 ); theDomain->addSP_Constraint(sp9 ); theDomain->addSP_Constraint(sp10); theDomain->addSP_Constraint(sp11); theDomain->addSP_Constraint(sp12); // construct a linear time series object using constructor: // LinearSeries() TimeSeries *theSeries = new LinearSeries(); // construct a load pattren using constructor: // LoadPattern(tag) // and then set it's TimeSeries and add it to the domain LoadPattern *theLoadPattern = new LoadPattern(1); theLoadPattern->setTimeSeries(theSeries); theDomain->addLoadPattern(theLoadPattern); // construct a nodal load using constructor: // NodalLoad(tag, nodeID, Vector &) // first construct a Vector of size 3 and set the values NOTE C INDEXING // then construct the load and add it to the domain Vector theLoadValues(3); theLoadValues(0) = 0.0; theLoadValues(1) = 0.0; theLoadValues(2) = -100.0; NodalLoad *theLoad = new NodalLoad(1, 5, theLoadValues); theDomain->addNodalLoad(theLoad, 1); theLoad = new NodalLoad(2, 6, theLoadValues); theDomain->addNodalLoad(theLoad, 1); theLoad = new NodalLoad(3, 7, theLoadValues); theDomain->addNodalLoad(theLoad, 1); theLoad = new NodalLoad(4, 8, theLoadValues); theDomain->addNodalLoad(theLoad, 1); // create an Analysis object to perform a static analysis of the model // - constructs: // AnalysisModel of type AnalysisModel, // EquiSolnAlgo of type Linear // StaticIntegrator of type LoadControl // ConstraintHandler of type Penalty // DOF_Numberer which uses RCM // LinearSOE of type Band SPD // and then the StaticAnalysis object AnalysisModel *theModel = new AnalysisModel(); EquiSolnAlgo *theSolnAlgo = new Linear(); StaticIntegrator *theIntegrator = new LoadControl(1.0, 1.0, 1.0, 1.0); ConstraintHandler *theHandler = new PenaltyConstraintHandler(1.0e8,1.0e8); RCM *theRCM = new RCM(); DOF_Numberer *theNumberer = new DOF_Numberer(*theRCM); BandSPDLinSolver *theSolver = new BandSPDLinLapackSolver(); LinearSOE *theSOE = new BandSPDLinSOE(*theSolver); StaticAnalysis theAnalysis(*theDomain, *theHandler, *theNumberer, *theModel, *theSolnAlgo, *theSOE, *theIntegrator); // perform the analysis & print out the results for the domain int numSteps = 1; theAnalysis.analyze(numSteps); cerr << *theDomain; //brick->displaySelf(); exit(0); }
int main(int argc, char **argv) { // first build our error handler g3ErrorHandler = new ConsoleErrorHandler(); // // now create a domain and a modelbuilder // and build the model // // Domain *theDomain = new Domain(); MapOfTaggedObjects theStorage; // ArrayOfTaggedObjects theStorage(32); Domain *theDomain = new Domain(theStorage); // create the nodes using constructor: // Node(tag, ndof, crd1, crd2) // and then add them to the domain Node *node1 = new Node(1, 3, 1.0, 1.0, 0.0 ); Node *node2 = new Node(2, 3, 0.0, 1.0, 0.0 ); Node *node3 = new Node(3, 3, 0.0, 0.0, 0.0 ); Node *node4 = new Node(4, 3, 1.0, 0.0, 0.0 ); Node *node5 = new Node(5, 3, 1.0, 1.0, 1.0 ); Node *node6 = new Node(6, 3, 0.0, 1.0, 1.0 ); Node *node7 = new Node(7, 3, 0.0, 0.0, 1.0 ); Node *node8 = new Node(8, 3, 1.0, 0.0, 1.0 ); theDomain->addNode(node1); theDomain->addNode(node2); theDomain->addNode(node3); theDomain->addNode(node4); theDomain->addNode(node5); theDomain->addNode(node6); theDomain->addNode(node7); theDomain->addNode(node8); // create an elastic material using constriuctor: // ElasticMaterialModel(tag, E) //UniaxialMaterial *theMaterial = new ElasticMaterial(1, 3000); double PIo3 = PI/3.0; PIo3 = 0.0; //Drucker-Prager Model DPYieldSurface DP_YS; DPPotentialSurface DP_PS(0.05); //EvolutionLaw_NL_Eeq DP_ELS1; EvolutionLaw_L_Eeq DP_ELS1(10.0); EvolutionLaw_T DP_ELT; double scalars[] = {0.3, 0.0}; //alfa1, k double NOS = 2; //Number of scalar vars double NOT = 1; //Number of tensorial vars stresstensor startstress; straintensor startstrain, otherstrain; startstrain = startstrain.pqtheta2strain( 0.000, 0.0000, 0.0); otherstrain = otherstrain.pqtheta2strain( 0.000, 0.0000, 0.0); stresstensor *tensors = new stresstensor[1]; EPState EPS(3000.0, 3000.0, 0.3, 0.0, startstress, otherstrain, otherstrain, otherstrain, NOS, scalars, NOT, tensors); Template3Dep MP(1, &DP_YS, &DP_PS, &EPS, &DP_ELS1, &DP_ELT); NDMaterial *theMaterial = &MP; //NDMaterial *theMaterial = new ElasticIsotropic3D(1, 3000, 0.3); // create the truss elements using constructor: // Truss(tag, dim, nd1, nd2, Material &,A) // and then add them to the domain //Truss *truss1 = new Truss(1, 2, 1, 4, *theMaterial, 10.0); //Truss *truss2 = new Truss(2, 2, 2, 4, *theMaterial, 5.0); //EPState *eps = 0; EightNodeBrick *brick = new EightNodeBrick(1, 5, 6, 7, 8, 1, 2, 3, 4, theMaterial, "Template3Dep", 0.0, 0.0, 0.0, 1.8, &EPS); //theDomain->addElement(truss1); //theDomain->addElement(truss2); theDomain->addElement( brick ); // create the single-point constraint objects using constructor: // SP_Constraint(tag, nodeTag, dofID, value) // and then add them to the domain SP_Constraint *sp1 = new SP_Constraint(1, 1, 0, 0.0259999); SP_Constraint *sp2 = new SP_Constraint(2, 1, 1, 0.0259999); SP_Constraint *sp3 = new SP_Constraint(3, 1, 2, -0.1213350); SP_Constraint *sp4 = new SP_Constraint(4, 2, 0, -0.0259999); SP_Constraint *sp5 = new SP_Constraint(5, 2, 1, 0.0259999); SP_Constraint *sp6 = new SP_Constraint(6, 2, 2, -0.1213350); SP_Constraint *sp7 = new SP_Constraint(7, 3, 0, -0.0259999); SP_Constraint *sp8 = new SP_Constraint(8, 3, 1, -0.0259999); SP_Constraint *sp9 = new SP_Constraint(9, 3, 2, -0.1213350); SP_Constraint *sp10 = new SP_Constraint(10, 4, 0, 0.0259999); SP_Constraint *sp11 = new SP_Constraint(11, 4, 1, -0.0259999); SP_Constraint *sp12 = new SP_Constraint(12, 4, 2, -0.1213350); SP_Constraint *sp13 = new SP_Constraint(13, 5, 0, 0.0); SP_Constraint *sp14 = new SP_Constraint(14, 5, 1, 0.0); SP_Constraint *sp15 = new SP_Constraint(15, 5, 2, 0.0); SP_Constraint *sp16 = new SP_Constraint(16, 6, 0, 0.0); SP_Constraint *sp17 = new SP_Constraint(17, 6, 1, 0.0); SP_Constraint *sp18 = new SP_Constraint(18, 6, 2, 0.0); SP_Constraint *sp19 = new SP_Constraint(19, 7, 0, 0.0); SP_Constraint *sp20 = new SP_Constraint(20, 7, 1, 0.0); SP_Constraint *sp21 = new SP_Constraint(21, 7, 2, 0.0); SP_Constraint *sp22 = new SP_Constraint(22, 8, 0, 0.0); SP_Constraint *sp23 = new SP_Constraint(23, 8, 1, 0.0); SP_Constraint *sp24 = new SP_Constraint(24, 8, 2, 0.0); //Add penalty constraint theDomain->addSP_Constraint(sp1 ); theDomain->addSP_Constraint(sp2 ); theDomain->addSP_Constraint(sp3 ); theDomain->addSP_Constraint(sp4 ); theDomain->addSP_Constraint(sp5 ); theDomain->addSP_Constraint(sp6 ); theDomain->addSP_Constraint(sp7 ); theDomain->addSP_Constraint(sp8 ); theDomain->addSP_Constraint(sp9 ); theDomain->addSP_Constraint(sp10); theDomain->addSP_Constraint(sp11); theDomain->addSP_Constraint(sp12); theDomain->addSP_Constraint(sp13); theDomain->addSP_Constraint(sp14); theDomain->addSP_Constraint(sp15); theDomain->addSP_Constraint(sp16); theDomain->addSP_Constraint(sp17); theDomain->addSP_Constraint(sp18); theDomain->addSP_Constraint(sp19); theDomain->addSP_Constraint(sp20); theDomain->addSP_Constraint(sp21); theDomain->addSP_Constraint(sp22); theDomain->addSP_Constraint(sp23); theDomain->addSP_Constraint(sp24); // construct a linear time series object using constructor: // LinearSeries() TimeSeries *theSeries = new LinearSeries(); // construct a load pattren using constructor: // LoadPattern(tag) // and then set it's TimeSeries and add it to the domain LoadPattern *theLoadPattern = new LoadPattern(1); theLoadPattern->setTimeSeries(theSeries); theDomain->addLoadPattern(theLoadPattern); // construct a nodal load using constructor: // NodalLoad(tag, nodeID, Vector &) // first construct a Vector of size 2 and set the values NOTE C INDEXING // then construct the load and add it to the domain Vector theLoadValues(3); theLoadValues(0) = 0.0; theLoadValues(1) = 0.0; //theLoadValues(2) = -100.0; theLoadValues(2) = 0.0; NodalLoad *theLoad = new NodalLoad(1, 5, theLoadValues); theDomain->addNodalLoad(theLoad, 1); theLoad = new NodalLoad(2, 6, theLoadValues); theDomain->addNodalLoad(theLoad, 1); theLoad = new NodalLoad(3, 7, theLoadValues); theDomain->addNodalLoad(theLoad, 1); theLoad = new NodalLoad(4, 8, theLoadValues); theDomain->addNodalLoad(theLoad, 1); // create an Analysis object to perform a static analysis of the model // - constructs: // AnalysisModel of type AnalysisModel, // EquiSolnAlgo of type Linear // StaticIntegrator of type LoadControl // ConstraintHandler of type Penalty // DOF_Numberer which uses RCM // LinearSOE of type Band SPD // and then the StaticAnalysis object AnalysisModel *theModel = new AnalysisModel(); EquiSolnAlgo *theSolnAlgo = new Linear(); StaticIntegrator *theIntegrator = new LoadControl(1.0, 1.0, 1.0, 1.0); ConstraintHandler *theHandler = new PenaltyConstraintHandler(1.0e8,1.0e8); RCM *theRCM = new RCM(); DOF_Numberer *theNumberer = new DOF_Numberer(*theRCM); BandSPDLinSolver *theSolver = new BandSPDLinLapackSolver(); LinearSOE *theSOE = new BandSPDLinSOE(*theSolver); StaticAnalysis theAnalysis(*theDomain, *theHandler, *theNumberer, *theModel, *theSolnAlgo, *theSOE, *theIntegrator); // perform the analysis & print out the results for the domain int numSteps = 1; theAnalysis.analyze(numSteps); cerr << *theDomain; //brick->displaySelf(); exit(0); }
int OPS_Tri31(Domain& theDomain, const ID& elenodes, ID& eletags) { // get inputs int numRemainingInputArgs = OPS_GetNumRemainingInputArgs(); if (numRemainingInputArgs < 3) { opserr << "Invalid #args, want: thk? type? matTag? <pressure? rho? b1? b2?>\n"; return -1; } int matID; double thk; char *theType; double dData[4]; dData[0] = 0.0; dData[1] = 0.0; dData[2] = 0.0; dData[3] = 0.0; int numData = 1; if (OPS_GetDoubleInput(&numData, &thk) != 0) { opserr << "WARNING invalid thickness data: element Tri31 \n"; return -1; } theType = (char*)OPS_GetString(); numData = 1; if (OPS_GetIntInput(&numData, &matID) != 0) { opserr << "WARNING invalid integer data: element Tri31\n"; return -1; } NDMaterial *theMaterial = OPS_getNDMaterial(matID); if (theMaterial == 0) { opserr << "WARNING element Tri31 \n"; opserr << " Material: " << matID << "not found\n"; return -1; } if (OPS_GetNumRemainingInputArgs() >= 4) { numData = 4; if (OPS_GetDoubleInput(&numData, &dData[0]) != 0) { opserr << "WARNING invalid optional data: element Tri31\n"; return -1; } } // create elements ElementIter& theEles = theDomain.getElements(); Element* theEle = theEles(); int currTag = 0; if (theEle != 0) { currTag = theEle->getTag(); } eletags.resize(elenodes.Size()/3); for (int i=0; i<eletags.Size(); i++) { theEle = new Tri31(--currTag,elenodes(3*i),elenodes(3*i+1),elenodes(3*i+2), *theMaterial, theType, thk, dData[0], dData[1], dData[2], dData[3]); if (theEle == 0) { opserr<<"WARNING: run out of memory for creating element\n"; return -1; } if (theDomain.addElement(theEle) == false) { opserr<<"WARNING: failed to add element to domain\n"; delete theEle; return -1; } eletags(i) = currTag; } return 0; }