void OPS_printUniaxialMaterial(OPS_Stream &s, int flag) {
  if (flag == OPS_PRINT_PRINTMODEL_JSON) {
    s << "\t\t\"uniaxialMaterials\": [\n";        
    MapOfTaggedObjectsIter theObjects = theUniaxialMaterialObjects.getIter();
    theObjects.reset();
    TaggedObject *theObject;
    int count = 0;
    int numComponents = theUniaxialMaterialObjects.getNumComponents();    
    while ((theObject = theObjects()) != 0) {
      UniaxialMaterial *theMaterial = (UniaxialMaterial *)theObject;
      theMaterial->Print(s, flag);
      if (count < numComponents-1)
	s << ",\n";
      count++;      
    }
    s << "\n\t\t]";
  }
}
Exemple #2
0
bool OPS_removeMesh(int tag)
{
    TaggedObject* obj = theMeshObjects.removeComponent(tag);
    if (obj != 0) {
        delete obj;
        return true;
    }
    return false;
}
bool OPS_removeUniaxialMaterial(int tag)
{
    TaggedObject* obj = theUniaxialMaterialObjects.removeComponent(tag);
    if (obj != 0) {
	delete obj;
	return true;
    }
    return false;
}
Exemple #4
0
Mesh *OPS_getMesh(int tag) {

    TaggedObject *theResult = theMeshObjects.getComponentPtr(tag);
    if (theResult == 0) {
        return 0;
    }
    Mesh *theMsh = (Mesh *)theResult;

    return theMsh;
}
UniaxialMaterial *OPS_getUniaxialMaterial(int tag) {

  TaggedObject *theResult = theUniaxialMaterialObjects.getComponentPtr(tag);
  if (theResult == 0) {
    opserr << "UniaxialMaterial *getUniaxialMaterial(int tag) - none found with tag: " << tag << endln;
    return 0;
  }
  UniaxialMaterial *theMat = (UniaxialMaterial *)theResult;

  return theMat;
}
Exemple #6
0
CrdTransf *OPS_GetCrdTransf(int tag) {

    TaggedObject *theResult = theCrdTransfObjects.getComponentPtr(tag);
    if (theResult == 0) {
        opserr << "CrdTransf *getCrdTransf(int tag) - none found with tag: " << tag << endln;
        return 0;
    }
    CrdTransf *theSeries = (CrdTransf *)theResult;

    return theSeries;
}
Exemple #7
0
TaggedObjectIter& OPS_getAllMesh() {
    return theMeshObjects.getComponents();
}
Exemple #8
0
void OPS_clearAllMesh(void) {
    theMeshObjects.clearAll();
}
Exemple #9
0
bool OPS_addMesh(Mesh* msh) {
    return theMeshObjects.addComponent(msh);
}
Exemple #10
0
int main(int argc, char **argv)
{
    int startID = 1;
    int i;

    MapOfTaggedObjects *theHolder = new MapOfTaggedObjects();
    opserr << "adding 5 components starting with id 1 to an object of initial size 5\n";

    for (i=0; i<5; i++) {
	Node *theNode = new Node(i+startID,1,i+startID);
	theHolder->addComponent(theNode);
    }
    
    opserr << "the contents\n";    
    theHolder->Print(opserr);

    TaggedObject *theNode;
    
    opserr << "removing node with id 4\n";
    theNode = theHolder->removeComponent(4); 
    if (theNode != 0) opserr << *theNode; else opserr << "Not There\n";        

    opserr << "the contents\n";    
    theHolder->Print(opserr);

    opserr << "adding 3 more components 10,11,12\n";        
    for (i=0; i<3; i++) {
	Node *theNode = new Node(i+10,1,i+10);
	theHolder->addComponent(theNode);
    }

    opserr << "the contents\n";    
    theHolder->Print(opserr);
    
    // destroying the holder
    opserr << "invoking the object destructor\n";        
    delete theHolder;
    
    opserr << "end of test1\n";
    double a; cin >> a;
    
    startID = 0;
    theHolder = new MapOfTaggedObjects();
    opserr << "adding 5 components starting with id 0 to an object of initial size 5\n";

    for (i=0; i<5; i++) {
	Node *theNode = new Node(i+startID,1,i+startID);
	theHolder->addComponent(theNode);
    }
    
    opserr << "the contents\n";    
    theHolder->Print(opserr);

    opserr << "removing node with id 4\n";
    theNode = theHolder->removeComponent(4); 
    if (theNode != 0) opserr << *theNode; else opserr << "Not There\n";        

    opserr << "the contents\n";    
    theHolder->Print(opserr);    
    
    opserr << "adding 3 more components 10,11,12\n";        
    for (i=0; i<3; i++) {
	Node *theNode = new Node(i+startID,1,i+10);
	theHolder->addComponent(theNode);
    }

    opserr << "the contents using print\n";    
    theHolder->Print(opserr);    

    opserr << "now check that the iterator works - should see contents\n";
    TaggedObject *theItem;
    TaggedObjectIter &theItems = theHolder->getComponents();
    while ((theItem = theItems()) != 0)
	opserr << *theItem;
    
    theHolder->clearAll();
    opserr << "the contetnts after clearAll\n";            
    theHolder->Print(opserr);
}
void OPS_clearAllUniaxialMaterial(void) {
  theUniaxialMaterialObjects.clearAll();
}
bool OPS_addUniaxialMaterial(UniaxialMaterial *newComponent) {
  return theUniaxialMaterialObjects.addComponent(newComponent);
}
Exemple #13
0
void OPS_ClearAllCrdTransf(void) {
    theCrdTransfObjects.clearAll();
}
Exemple #14
0
bool OPS_AddCrdTransf(CrdTransf *newComponent) {
    return theCrdTransfObjects.addComponent(newComponent);
}