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

Function OPS_printModelGID

SRC/interpreter/OpenSeesOutputCommands.cpp:771–1126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

769}
770
771int OPS_printModelGID()
772{
773 // This function print's a file with node and elements in a format useful for GID
774 int res = 0;
775 bool hasLinear = 0;
776 bool hasTri3 = 0;
777 bool hasQuad4 = 0;
778 bool hasQuad8 = 0;
779 bool hasQuad9 = 0;
780 bool hasBrick = 0;
781 int startEle = 1;
782 int endEle = 1;
783 int eleRange = 0;
784 int numdata = 1;
785
786 FileStream outputFile;
787 // OPS_Stream *output = &opserr;
788 Domain* theDomain = OPS_GetDomain();
789 if (theDomain == 0) return -1;
790
791 if (OPS_GetNumRemainingInputArgs() < 1) {
792 opserr << "WARNING printGID fileName? - no filename supplied\n";
793 return -1;
794 }
795 const char* filename = OPS_GetString();
796 openMode mode = OVERWRITE;
797 while (OPS_GetNumRemainingInputArgs() > 0) {
798 const char* flag = OPS_GetString();
799 if (strcmp(flag,"-append") == 0) {
800 mode = APPEND;
801 }
802 if (strcmp(flag,"-eleRange") == 0 && OPS_GetNumRemainingInputArgs()>1) {
803 //opserr<<"WARNING:commands: eleRange defined"<<endln;
804 eleRange = 1;
805 if (OPS_GetIntInput(&numdata, &startEle) < 0) {
806 opserr << "WARNING print node failed to get integer: " << endln;
807 return -1;
808 }
809 if (OPS_GetIntInput(&numdata, &endEle) < 0) {
810 opserr << "WARNING print node failed to get integer: " << endln;
811 return -1;
812 }
813 //opserr<<"startEle = "<<startEle<<" endEle = "<<endEle<<endln;
814 }
815 }
816
817 if (outputFile.setFile(filename, mode) < 0) {
818 opserr << "WARNING printGID " << filename << " failed to set the file\n";
819 return -1;
820 }
821
822 // Cycle over Elements to understand what type of elements are there
823 ElementIter &theElements = theDomain->getElements();
824 Element *theElement;
825 while ((theElement = theElements()) != 0) {
826 // int tag = theElement->getTag();
827
828 // Check type of Element with Number of Nodes

Callers 2

Tcl_ops_printGIDFunction · 0.85
Py_ops_printGIDFunction · 0.85

Calls 14

getNodesMethod · 0.80
getCrdsMethod · 0.80
OPS_GetDomainFunction · 0.70
OPS_GetStringFunction · 0.70
OPS_GetIntInputFunction · 0.70
setFileMethod · 0.45
getElementsMethod · 0.45
getNumExternalNodesMethod · 0.45
getClassTypeMethod · 0.45
getTagMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected