MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / OPS_GetMaterial

Function OPS_GetMaterial

SRC/api/elementAPI_TCL.cpp:607–666  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

605
606extern "C"
607matObj * OPS_GetMaterial(int* matTag, int* matType)
608{
609 if (*matType == OPS_UNIAXIAL_MATERIAL_TYPE) {
610 UniaxialMaterial* theUniaxialMaterial = OPS_getUniaxialMaterial(*matTag);
611
612 if (theUniaxialMaterial != 0) {
613
614 UniaxialMaterial* theCopy = theUniaxialMaterial->getCopy();
615 // uniaxialMaterialObjectCount++;
616 // theUniaxialMaterials[uniaxialMaterialObjectCount] = theCopy;
617
618 matObject* theMatObject = new matObject;
619 theMatObject->tag = *matTag;
620 theMatObject->nParam = 1;
621 theMatObject->nState = 0;
622
623 theMatObject->theParam = new double[1];
624 // theMatObject->theParam[0] = uniaxialMaterialObjectCount;
625 theMatObject->theParam[0] = 1; // code for uniaxial material
626
627 theMatObject->tState = 0;
628 theMatObject->cState = 0;
629 theMatObject->matFunctPtr = OPS_InvokeMaterialObject;
630
631 theMatObject->matObjectPtr = theCopy;
632
633 return theMatObject;
634 }
635
636 fprintf(stderr, "getMaterial - no uniaxial material exists with tag %d\n", *matTag);
637 return 0;
638
639 }
640 else if (*matType == OPS_SECTION_TYPE) {
641 fprintf(stderr, "getMaterial - not yet implemented for Section\n");
642 return 0;
643 }
644 else {
645
646 // NDMaterial *theNDMaterial = theModelBuilder->getNDMaterial(*matTag);
647
648 // if (theNDMaterial != 0)
649 // theNDMaterial = theNDMaterial->getCopy(matType);
650 // else {
651 // fprintf(stderr,"getMaterial - no nd material exists with tag %d\n", *matTag);
652 // return 0;
653 // }
654
655 // if (theNDMaterial == 0) {
656 // fprintf(stderr,"getMaterial - material with tag %d cannot deal with %d\n", *matTag, matType);
657 // return 0;
658 // }
659
660 fprintf(stderr, "getMaterial - not yet implemented for nDMaterial\n");
661 return 0;
662 }
663
664 fprintf(stderr, "getMaterial - unknown material type\n");

Callers 1

OPS_AllocateElementFunction · 0.70

Calls 2

OPS_getUniaxialMaterialFunction · 0.50
getCopyMethod · 0.45

Tested by

no test coverage detected