Beispiel #1
0
matObj *OPS_GetMaterial(int *matTag, int *matType)
{

  if (*matType == OPS_UNIAXIAL_MATERIAL_TYPE) {
    UniaxialMaterial *theUniaxialMaterial = OPS_getUniaxialMaterial(*matTag);
    
    if (theUniaxialMaterial != 0) {
      
      UniaxialMaterial *theCopy = theUniaxialMaterial->getCopy();
      //  uniaxialMaterialObjectCount++;
      // theUniaxialMaterials[uniaxialMaterialObjectCount] = theCopy;
      
      matObject *theMatObject = new matObject;
      theMatObject->tag = *matTag;
      theMatObject->nParam = 1;
      theMatObject->nState = 0;
      
      theMatObject->theParam = new double[1];
      //  theMatObject->theParam[0] = uniaxialMaterialObjectCount;
      theMatObject->theParam[0] = 1; // code for uniaxial material
      
      theMatObject->tState = 0;
      theMatObject->cState = 0;
      theMatObject->matFunctPtr = OPS_InvokeMaterialObject;

      theMatObject->matObjectPtr = theCopy;
      
      return theMatObject;
    }
    
    fprintf(stderr,"getMaterial - no uniaxial material exists with tag %d\n", *matTag);    
    return 0;

  } else if (*matType == OPS_SECTION_TYPE) {
    fprintf(stderr,"getMaterial - not yet implemented for Section\n");    
    return 0;
  } else {

    //    NDMaterial *theNDMaterial = theModelBuilder->getNDMaterial(*matTag);

    //    if (theNDMaterial != 0) 
      //      theNDMaterial = theNDMaterial->getCopy(matType);
      //    else {
      //      fprintf(stderr,"getMaterial - no nd material exists with tag %d\n", *matTag);          
      //      return 0;
      //    }

      //    if (theNDMaterial == 0) {
    //      fprintf(stderr,"getMaterial - material with tag %d cannot deal with %d\n", *matTag, matType);          
    //      return 0;
    //    }

    fprintf(stderr,"getMaterial - not yet implemented for nDMaterial\n");    
    return 0;
  }

  fprintf(stderr,"getMaterial - unknown material type\n");    
  return 0;

}
void* OPS_PathIndependentMaterial()
{
    int numdata = OPS_GetNumRemainingInputArgs();
    if (numdata < 2) {
	opserr << "WARNING insufficient arguments\n";
	opserr << "Want: uniaxialMaterial PathIndependent tag? matTag?" << endln;
	return 0;
    }

    int tag[2];
    numdata = 2;
    if (OPS_GetIntInput(&numdata,tag) < 0) {
	return 0;
    }

    UniaxialMaterial* theMat = OPS_getUniaxialMaterial(tag[1]);
    if (theMat == 0) {
	opserr << "WARNING material does not exist\n";
	opserr << "material: " << tag[1]; 
	opserr << "\nuniaxialMaterial PathIndependent: " << tag[0] << endln;
	return 0;
    }

    UniaxialMaterial* mat = new PathIndependentMaterial(tag[0],*theMat);
    if (mat == 0) {
	opserr << "WARNING: failed to create PathIndependentmaterial material\n";
	return 0;
    }

    return mat;
}
int OPS_testUniaxialMaterial()
{
    if (OPS_GetNumRemainingInputArgs() != 1) {
	opserr<<"testUniaxialMaterial - You must provide a material tag.\n";
	return -1;
    }

    int tag;
    int numData = 1;
    if (OPS_GetIntInput(&numData, &tag) < 0) {
	opserr<<"invalid int value\n";
	return -1;
    }

    UniaxialMaterial* mat =OPS_getUniaxialMaterial(tag);

    if (mat == 0) {
	opserr<<"testUniaxialMaterial - Material Not Found.\n";
	return -1;
    }

    theTestingUniaxialMaterial = mat;

    return 0;
}
Beispiel #4
0
int
TclModelBuilder_addZeroLengthND(ClientData clientData, Tcl_Interp *interp,
			      int argc, TCL_Char **argv,
			      Domain *theDomain,
			      TclModelBuilder *theBuilder) {

    int ndm = theBuilder->getNDM(); // the spatial dimension of the problem

    //
    // first scan the command line to obtain eleID, iNode, jNode, material ID's
    // and their directions, and the orientation of ele xPrime and yPrime not
    // along the global x and y axis
    //
    
    int eleTag, iNode, jNode;
    
    // a quick check on number of args
    if (argc < 6) {
	opserr << "WARNING too few arguments %s %s %s\n" <<
				"want - element zeroLengthND eleTag? iNode? jNode? " <<
				"NDTag? <1DTag?>" <<
				"<-orient x1? x2? x3? y1? y2? y3?>\n";
	return TCL_ERROR;
    }

    // get the ele tag 
    if (Tcl_GetInt(interp, argv[2], &eleTag) != TCL_OK) {
	opserr << "WARNING invalied eleTag " << 
	  argv[2] << " - element zeroLengthND eleTag? iNode? jNode? NDTag? <1DTag?> <-orient x1? x2? x3? y1? y2? y3?>\n";	
	  
	return TCL_ERROR;
    }

    // get the two end nodes
    if (Tcl_GetInt(interp, argv[3], &iNode) != TCL_OK) {
	opserr << "WARNING invalied iNode " << 
	  argv[3] <<
	  "- element zeroLengthND eleTag? iNode? jNode? " <<
	  "NDTag? <1DTag?>" <<
	  "<-orient x1? x2? x3? y1? y2? y3?>\n";	
	return TCL_ERROR;
    }

    if (Tcl_GetInt(interp, argv[4], &jNode) != TCL_OK) {
      opserr << "WARNING invalid jNode " << 
	argv[4] << "- element zeroLengthND eleTag? iNode? jNode? " <<
	"NDTag? <1DTag?> <-orient x1? x2? x3? y1? y2? y3?>\n";	
	return TCL_ERROR;
    }

	int NDTag;

    if (Tcl_GetInt(interp, argv[5], &NDTag) != TCL_OK) {
	opserr << "WARNING invalid NDTag %s %s %s %s\n" << 
	  argv[5] << "- element zeroLengthND eleTag? iNode? jNode? " <<
	  "NDTag? <1DTag?> <-orient x1? x2? x3? y1? y2? y3?>\n"; 
	
	return TCL_ERROR;
    }

	UniaxialMaterial *the1DMat = 0;

	int argi = 6;

	if (argc > 6 && strcmp(argv[6],"-orient") != 0) {

		int uniTag;

		if (Tcl_GetInt(interp, argv[6], &uniTag) != TCL_OK) {
			opserr << "WARNING invalid NDTag " << 
			  argv[5] << "- element zeroLengthND eleTag? iNode? jNode? " <<
			  "NDTag? <1DTag?> <-orient x1? x2? x3? y1? y2? y3?>\n"; 
			return TCL_ERROR;
		}

		the1DMat = OPS_getUniaxialMaterial(uniTag);

		if (the1DMat == 0)
		  opserr << "WARNING UniaxialMaterial " << uniTag << " not found in model, proceeding without\n";

		argi = 7;
	}

    // create the vectors for the element orientation
    Vector x(3); x(0) = 1.0; x(1) = 0.0; x(2) = 0.0;
    Vector y(3); y(0) = 0.0; y(1) = 1.0; y(2) = 0.0;

    // finally check the command line to see if user specified orientation
    if (argi < argc) {
	if (strcmp(argv[argi],"-orient") == 0) {
	    if (argc < (argi+7)) {
		opserr << "WARNING not enough parameters after -orient flag for ele "  << 
		  eleTag << "- element zeroLengthND eleTag? iNode? jNode? " <<
		  "NDTag? <1DTag?> <-orient x1? x2? x3? y1? y2? y3?>\n";	
		return TCL_ERROR;		
	    } else {
		argi++;
		double value;
		// read the x values
		for (int i=0; i<3; i++)  {
		    if (Tcl_GetDouble(interp, argv[argi], &value) != TCL_OK) {
			opserr << "WARNING invalid -orient value for ele  " <<
			  eleTag << argv[argi] << "- element zeroLengthND eleTag? iNode? jNode? " <<
			  "NDTag? <1DTag?> <-orient x1? x2? x3? y1? y2? y3?>\n";	
						
			return TCL_ERROR;
		    } else {
			argi++;
			x(i) = value;
		    }
		}
		// read the y values
		for (int j=0; j<3; j++)  {
		    if (Tcl_GetDouble(interp, argv[argi], &value) != TCL_OK) {
			opserr << "WARNING invalid -orient value for ele  " <<
			  eleTag << " " << argv[argi] << 
			  "- element zeroLengthND eleTag? iNode? jNode? " <<
			  "NDTag? <1DTag?> <-orient x1? x2? x3? y1? y2? y3?>\n";	
			return TCL_ERROR;
		    } else {
			argi++;
			y(j) = value;		
		    }
		}
	    }
	}
    }
    
    //
    // now we create the element and add it to the domain
    //

	NDMaterial *theNDMat = OPS_getNDMaterial(NDTag);

	if (theNDMat == 0) {
	  opserr << "zeroLengthND -- no NDMaterial with tag " << NDTag << " exists in Domain\n";
	  return TCL_ERROR;		
	}

	Element *theEle = 0;

	if (the1DMat == 0)
	  theEle = new ZeroLengthND(eleTag, ndm, iNode, jNode, x, y, *theNDMat);
	else
	  theEle = new ZeroLengthND(eleTag, ndm, iNode, jNode, x, y, *theNDMat, *the1DMat);
    
	if (theEle == 0)
	  return TCL_ERROR;
	
	if (theDomain->addElement(theEle) == false)
	  return TCL_ERROR;
	
	return TCL_OK;
}
Beispiel #5
0
int
TclModelBuilder_addZeroLength(ClientData clientData, Tcl_Interp *interp,
			      int argc, TCL_Char **argv,
			      Domain *theDomain,
			      TclModelBuilder *theBuilder) {

    int ndm = theBuilder->getNDM(); // the spatial dimension of the problem

    //
    // first scan the command line to obtain eleID, iNode, jNode, material ID's
    // and their directions, and the orientation of ele xPrime and yPrime not
    // along the global x and y axis
    //
    
    int eleTag, iNode, jNode;
    
    // a quick check on number of args
    if (argc < 9) {
      opserr << "WARNING too few arguments " <<
	"want - element ZeroLength eleTag? iNode? jNode? " <<
	"-mat matID1? ... -dir dirMat1? .. " <<
	"<-orient x1? x2? x3? y1? y2? y3?>\n";

	return TCL_ERROR;
    }

    // get the ele tag 
    if (Tcl_GetInt(interp, argv[2], &eleTag) != TCL_OK) {
      opserr << "WARNING invalied eleTag " << argv[2] <<
	"- element ZeroLength eleTag? iNode? jNode? -mat matID1? ... -dir dirMat1? .. " <<
	"<-orient x1? x2? x3? y1? y2? y3?>\n";
	return TCL_ERROR;
    }

    // get the two end nodes
    if (Tcl_GetInt(interp, argv[3], &iNode) != TCL_OK) {
      opserr << "WARNING invalied iNode " << argv[3] << 
	"- element ZeroLength eleTag? iNode? jNode? " <<
	"-mat matID1? ... -dir dirMat1? .. " <<
	"<-orient x1? x2? x3? y1? y2? y3?>\n";

	return TCL_ERROR;
    }

    if (Tcl_GetInt(interp, argv[4], &jNode) != TCL_OK) {
      opserr << "WARNING invalid jNode " << argv[4] <<
	"- element ZeroLength eleTag? iNode? jNode? " <<
	"-mat matID1? ... -dir dirMat1? .. " <<
	"<-orient x1? x2? x3? y1? y2? y3?>\n";
	return TCL_ERROR;
    }

    // create an array of material pointers, to do this first count
    // the materials to create the array then get matID's and from ModelBuilder
    // obtain pointers to the material objects

    // read the number of materials
    int numMat = 0;
    if (strcmp(argv[5],"-mat") != 0) {
      opserr << "WARNING expecting -mat flag %s %s %s %s\n" << argv[5] <<
	"- element ZeroLength eleTag? iNode? jNode? " <<
	"-mat matID1? ... -dir dirMat1? .. " <<
	"<-orient x1? x2? x3? y1? y2? y3?>\n";

	return TCL_ERROR;	
    }

    int argi = 6; 
    while ((argi < argc) && (strcmp(argv[argi],"-dir") != 0)) {
	numMat++;
	argi++;
    }

    if (argi == argc) { // check we encountered the -dirn flag
      opserr << "WARNING no -dirn flag encountered " <<
	"- element ZeroLength eleTag? iNode? jNode? " <<
	"-mat matID1? ... -dir dirMat1? .. " <<
	"<-orient x1? x2? x3? y1? y2? y3?>\n";
	return TCL_ERROR;
    }	

    if (numMat == 0) {
      opserr << "WARNING no materials specified " << 
	"- element ZeroLength eleTag? iNode? jNode? " <<
	"-mat <matID1? ... -dir irMat1? .. " <<
	"<-orient x1? x2? x3? y1? y2? y3?>\n";
	return TCL_ERROR;
    }

    // create the array
    UniaxialMaterial **theMats = new UniaxialMaterial *[numMat];
    UniaxialMaterial **theDampMats = new UniaxialMaterial *[numMat];

    if (theMats == 0) {
      opserr << "WARNING out of memory " <<
	"creating material array of size " << numMat <<
	"- element ZeroLength eleTag? iNode? jNode? " <<
	"-mat matID1? ... -dir dirMat1? .. " <<
	"<-orient x1? x2? x3? y1? y2? y3?>\n";
	return TCL_ERROR;
    }

    // fill in the material array
    argi=6; 
    for (int i=0; i<numMat; i++) {
      theDampMats[i] = 0;

      int matID;	
      
      // read the material tag	
      if (Tcl_GetInt(interp, argv[argi], &matID) != TCL_OK) {
	opserr << "WARNING invalid matID " << argv[argi] <<
	  "- element ZeroLength eleTag? iNode? jNode? " <<
	  "-mat matID1? ... -dir dirMat1? .. " <<
	  "<-orient x1? x2? x3? y1? y2? y3?>\n";
	delete [] theMats;	    
        return TCL_ERROR;
      } else {

	// get a pointer to the material from the modelbuilder	    
	argi++;
	UniaxialMaterial *theMat = OPS_getUniaxialMaterial(matID);
	if (theMat == 0) {
	  opserr << "WARNING no material " << matID <<
	    "exitsts - element ZeroLength eleTag? iNode? jNode? " <<
	    "-mat matID1? ... -dir dirMat1? .. " <<
	    "<-orient x1? x2? x3? y1? y2? y3?>\n"  ;
	  delete [] theMats;		
	  return TCL_ERROR;		
	} else {
	  
		// add the material to the array
		theMats[i] = theMat;
	    }
	}
    }
    

    // now read the dirn ID's for the materials added
    argi = 6 + numMat;
    if (strcmp(argv[argi],"-dir") != 0) {
      opserr << "WARNING expecting -dirn flag " << argv[argi] << 
	  "- element ZeroLength eleTag? iNode? jNode? " <<
	  "-mat matID1? ... -dir dirMat1? .. " <<
	"<-orient x1? x2? x3? y1? y2? y3?>\n";

    delete [] theMats;
	return TCL_ERROR;	
    }    
    if ((argi + numMat) > argc) {
	opserr << "WARNING not enough directions provided for ele " << eleTag <<
	  "- element ZeroLength eleTag? iNode? jNode? " <<
	  "-mat matID1? ... -dir dirMat1? .. " <<
	  "<-orient x1? x2? x3? y1? y2? y3?>\n";
	
	delete [] theMats;	
	return TCL_ERROR;		
    }
    
    // create an ID to hold the directions
    ID theDirns(numMat);
    argi++; 
    int dirnID;	

    // read the dirn identifiers
    for (int j=0; j<numMat; j++) {
	if (Tcl_GetInt(interp, argv[argi], &dirnID) != TCL_OK) {
	  opserr << "WARNING invalid directiion " << argv[argi] <<
	    "- element ZeroLength eleTag? iNode? jNode? " <<
	    "-mat matID1? ... -dir dirMat1? .. " <<
	    "<-orient x1? x2? x3? y1? y2? y3?>\n";	
	  
	  delete [] theMats;	    
	  return TCL_ERROR;
	} else {
	  theDirns[j] = dirnID -1; // the minus g3 to C++
	  argi++;
	}
    }

    // create the vectors for the element orientation
    Vector x(3); x(0) = 1.0; x(1) = 0.0; x(2) = 0.0;
    Vector y(3); y(0) = 0.0; y(1) = 1.0; y(2) = 0.0;

    // finally check the command line to see if user specified orientation
    int doRayleighDamping = 0;

    while (argi < argc) {
	if (strcmp(argv[argi],"-orient") == 0) {
	    if (argc < (argi+7)) {
	      opserr << "WARNING not enough parameters after -orient flag for ele " << eleTag <<
		"- element ZeroLength eleTag? iNode? jNode? " <<
		"-mat matID1? ... -dir dirMat1? .. " <<
		"<-orient x1? x2? x3? y1? y2? y3?>\n";	      
	      delete [] theMats;		
	      return TCL_ERROR;		
	    } else {
	      argi++;
	      double value;
	      // read the x values
	      for (int i=0; i<3; i++)  {
		if (Tcl_GetDouble(interp, argv[argi], &value) != TCL_OK) {
		  opserr << "WARNING invalid -orient value for ele  " << eleTag << argv[i] <<
		    "- element ZeroLength eleTag? iNode? jNode? " <<
		    "-mat matID1? ... -dir dirMat1? .. " <<
		    "<-orient x1? x2? x3? y1? y2? y3?>\n";	
		  delete [] theMats;			
		  return TCL_ERROR;
		} else {
		  argi++;
		  x(i) = value;
		}
	      }
	      // read the y values
	      for (int j=0; j<3; j++)  {
		if (Tcl_GetDouble(interp, argv[argi], &value) != TCL_OK) {
		  opserr << "WARNING invalid -orient value for ele  " <<
		    eleTag << argv[argi] <<
		    "- element ZeroLength eleTag? iNode? jNode? " <<
		    "-mat matID1? ... -dir dirMat1? .. " <<
		    "<-orient x1? x2? x3? y1? y2? y3?>\n";	
		  delete [] theMats;			
		  return TCL_ERROR;
		} else {
		  argi++;
		  y(j) = value;		
		}
	      }
	    }
	    
	    argi++;
	} else 	if (strcmp(argv[argi],"-doRayleigh") == 0)  {
	  doRayleighDamping = 1;
	  argi++;
	  if (argi < argc) 
	    if ((Tcl_GetInt(interp, argv[argi], &doRayleighDamping) == TCL_OK))
	      argi++;
	} else 	if (strcmp(argv[argi],"-dampMats") == 0)  {
	  doRayleighDamping = 2;
	  argi++;
	  for (int i=0; i<numMat; i++) {

	    int matID;	
      
	    // read the material tag	
	    if (Tcl_GetInt(interp, argv[argi], &matID) != TCL_OK) {
	      opserr << "WARNING invalid matID " << argv[argi] <<
		"- element ZeroLength eleTag? iNode? jNode? " <<
		"-mat matID1? ... -dir dirMat1? .. " <<
		"<-orient x1? x2? x3? y1? y2? y3?>\n";
	      delete [] theMats;	    
	      return TCL_ERROR;
	    } else {
	      UniaxialMaterial *theMat = OPS_getUniaxialMaterial(matID);
	      if (theMat == 0) {
		opserr << "WARNING no material " << matID <<
		  "exitsts - element ZeroLength eleTag? iNode? jNode? " <<
		  "-mat matID1? ... -dir dirMat1? .. " <<
		  "<-orient x1? x2? x3? y1? y2? y3?>\n"  ;
		delete [] theMats;		
		return TCL_ERROR;		
	      } else {
		theDampMats[i] = theMat;
	      }
	    }

	    argi++;
	  }

	}  else



	  argi++;
    }
    
    //
    // now we create the element and add it to the domain
    //

    Element *theEle;

    if (doRayleighDamping != 2) 
      theEle = new ZeroLength(eleTag, ndm, iNode, jNode, x, y, numMat, theMats, theDirns, doRayleighDamping);
    else
      theEle = new ZeroLength(eleTag, ndm, iNode, jNode, x, y, numMat, theMats, theDampMats, theDirns, doRayleighDamping);

    if (theEle == 0) {
	delete [] theMats;	
	return TCL_ERROR;
    }
   
    if (theDomain->addElement(theEle) == false) {
	delete [] theMats;
	return TCL_ERROR;
    }

    // return the memory we stole and return OK
    delete [] theMats;    
    delete [] theDampMats;
    return TCL_OK;
}
int TclModelBuilder_addElastomericBearingPlasticity(ClientData clientData,
    Tcl_Interp *interp, int argc, TCL_Char **argv, Domain *theTclDomain,
    TclModelBuilder *theTclBuilder, int eleArgStart)
{
    // ensure the destructor has not been called
    if (theTclBuilder == 0)  {
        opserr << "WARNING builder has been destroyed - elastomericBearing\n";
        return TCL_ERROR;
    }
    
    Element *theElement = 0;
    int ndm = theTclBuilder->getNDM();
    int ndf = theTclBuilder->getNDF();
    int tag;
    
    if (ndm == 2)  {
        // check plane frame problem has 3 dof per node
        if (ndf != 3)  {
            opserr << "WARNING invalid ndf: " << ndf;
            opserr << ", for plane problem need 3 - elastomericBearing\n";
            return TCL_ERROR;
        } 
        
        // check the number of arguments is correct
        if ((argc-eleArgStart) < 13)  {
            opserr << "WARNING insufficient arguments\n";
            printCommand(argc, argv);
            opserr << "Want: elastomericBearing eleTag iNode jNode kInit fy alpha1 alpha2 mu -P matTag -Mz matTag <-orient x1 x2 x3 y1 y2 y3> <-shearDist sDratio> <-doRayleigh> <-mass m>\n";
            return TCL_ERROR;
        }    
        
        // get the id and end nodes
        int iNode, jNode, matTag, argi, j;
        int recvMat = 0;
        double kInit, fy, alpha1;
        double alpha2 = 0.0;
        double mu = 2.0;
        double shearDistI = 0.5;
        int doRayleigh = 0;
        double mass = 0.0;
        
        if (Tcl_GetInt(interp, argv[1+eleArgStart], &tag) != TCL_OK)  {
            opserr << "WARNING invalid elastomericBearing eleTag\n";
            return TCL_ERROR;
        }
        if (Tcl_GetInt(interp, argv[2+eleArgStart], &iNode) != TCL_OK)  {
            opserr << "WARNING invalid iNode\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetInt(interp, argv[3+eleArgStart], &jNode) != TCL_OK)  {
            opserr << "WARNING invalid jNode\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetDouble(interp, argv[4+eleArgStart], &kInit) != TCL_OK)  {
            opserr << "WARNING invalid kInit\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetDouble(interp, argv[5+eleArgStart], &fy) != TCL_OK)  {
            opserr << "WARNING invalid fy\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetDouble(interp, argv[6+eleArgStart], &alpha1) != TCL_OK)  {
            opserr << "WARNING invalid alpha1\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetDouble(interp, argv[7+eleArgStart], &alpha2) != TCL_OK)  {
            opserr << "WARNING invalid alpha2\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetDouble(interp, argv[8+eleArgStart], &mu) != TCL_OK)  {
            opserr << "WARNING invalid mu\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        UniaxialMaterial *theMaterials[2];
        for (int i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-P") == 0)  {
                theMaterials[0] = 0;
                if (Tcl_GetInt(interp, argv[i+1], &matTag) != TCL_OK)  {
                    opserr << "WARNING invalid matTag\n";
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                theMaterials[0] = OPS_getUniaxialMaterial(matTag);
                if (theMaterials[0] == 0)  {
                    opserr << "WARNING material model not found\n";
                    opserr << "uniaxialMaterial: " << matTag << endln;
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                recvMat++;
            }
        }
        for (int i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-Mz") == 0)  {
                if (Tcl_GetInt(interp, argv[i+1], &matTag) != TCL_OK)  {
                    opserr << "WARNING invalid matTag\n";
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                theMaterials[1] = OPS_getUniaxialMaterial(matTag);
                if (theMaterials[1] == 0)  {
                    opserr << "WARNING material model not found\n";
                    opserr << "uniaxialMaterial: " << matTag << endln;
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                recvMat++;
            }
        }
        if (recvMat != 2)  {
            opserr << "WARNING wrong number of materials\n";
            opserr << "got " << recvMat << " materials, but want 2 materials\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        
        // check for optional arguments
        Vector x = 0;
        Vector y = 0;
        for (int i = 9+eleArgStart; i < argc; i++)  {
            if (strcmp(argv[i],"-orient") == 0)  {
                j = i+1;
                int numOrient = 0;
                while (j < argc &&
                    strcmp(argv[j],"-shearDist") != 0 &&
                    strcmp(argv[j],"-doRayleigh") != 0 &&
                    strcmp(argv[j],"-mass") != 0)  {
                        numOrient++;
                        j++;
                }
                if (numOrient == 6)  {
                    argi = i+1;
                    x.resize(3);
                    y.resize(3);
                    double value;
                    // read the x values
                    for (j=0; j<3; j++)  {
                        if (Tcl_GetDouble(interp, argv[argi], &value) != TCL_OK)  {
                            opserr << "WARNING invalid -orient value\n";
                            opserr << "elastomericBearing element: " << tag << endln;
                            return TCL_ERROR;
                        } else  {
                            argi++;
                            x(j) = value;
                        }
                    }
                    // read the y values
                    for (j=0; j<3; j++)  {
                        if (Tcl_GetDouble(interp, argv[argi], &value) != TCL_OK)  {
                            opserr << "WARNING invalid -orient value\n";
                            opserr << "elastomericBearing element: " << tag << endln;
                            return TCL_ERROR;
                        } else  {
                            argi++;
                            y(j) = value;
                        }
                    }
                }
                else  {
                    opserr << "WARNING insufficient arguments after -orient flag\n";
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        for (int i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-shearDist") == 0)  {
                if (Tcl_GetDouble(interp, argv[i+1], &shearDistI) != TCL_OK)  {
                    opserr << "WARNING invalid -shearDist value\n";
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        for (int i = 9+eleArgStart; i < argc; i++)  {
            if (strcmp(argv[i], "-doRayleigh") == 0)
                doRayleigh = 1;
        }
        for (int i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-mass") == 0)  {
                if (Tcl_GetDouble(interp, argv[i+1], &mass) != TCL_OK)  {
                    opserr << "WARNING invalid -mass value\n";
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        
        // now create the elastomericBearing
        theElement = new ElastomericBearingPlasticity2d(tag, iNode, jNode, kInit, fy, 
            alpha1, theMaterials, y, x, alpha2, mu, shearDistI, doRayleigh, mass);
        
        if (theElement == 0)  {
            opserr << "WARNING ran out of memory creating element\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        
        // then add the elastomericBearing to the domain
        if (theTclDomain->addElement(theElement) == false)  {
            opserr << "WARNING could not add element to the domain\n";
            opserr << "elastomericBearing element: " << tag << endln;
            delete theElement;
            return TCL_ERROR;
        }       
    }
    
    else if (ndm == 3)  {
        // check space frame problem has 6 dof per node
        if (ndf != 6)  {
            opserr << "WARNING invalid ndf: " << ndf;
            opserr << ", for space problem need 6 - elastomericBearing \n";
            return TCL_ERROR;
        } 
        
        // check the number of arguments is correct
        if ((argc-eleArgStart) < 17)  {
            opserr << "WARNING insufficient arguments\n";
            printCommand(argc, argv);
            opserr << "Want: elastomericBearing eleTag iNode jNode kInit fy alpha1 alpha2 mu -P matTag -T matTag -My matTag -Mz matTag <-orient <x1 x2 x3> y1 y2 y3> <-shearDist sDratio> <-mass m>\n";
            return TCL_ERROR;
        }
        
        // get the id and end nodes
        int iNode, jNode, matTag, argi, i, j;
        int recvMat = 0;
        double kInit, fy, alpha1;
        double alpha2 = 0.0;
        double mu = 2.0;
        double shearDistI = 0.5;
        int doRayleigh = 0;
        double mass = 0.0;
        
        if (Tcl_GetInt(interp, argv[1+eleArgStart], &tag) != TCL_OK)  {
            opserr << "WARNING invalid elastomericBearing eleTag\n";
            return TCL_ERROR;
        }
        if (Tcl_GetInt(interp, argv[2+eleArgStart], &iNode) != TCL_OK)  {
            opserr << "WARNING invalid iNode\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetInt(interp, argv[3+eleArgStart], &jNode) != TCL_OK)  {
            opserr << "WARNING invalid jNode\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetDouble(interp, argv[4+eleArgStart], &kInit) != TCL_OK)  {
            opserr << "WARNING invalid kInit\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetDouble(interp, argv[5+eleArgStart], &fy) != TCL_OK)  {
            opserr << "WARNING invalid fy\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetDouble(interp, argv[6+eleArgStart], &alpha1) != TCL_OK)  {
            opserr << "WARNING invalid alpha1\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetDouble(interp, argv[7+eleArgStart], &alpha2) != TCL_OK)  {
            opserr << "WARNING invalid alpha2\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetDouble(interp, argv[8+eleArgStart], &mu) != TCL_OK)  {
            opserr << "WARNING invalid mu\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        UniaxialMaterial *theMaterials[4];
        for (i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-P") == 0)  {
                if (Tcl_GetInt(interp, argv[i+1], &matTag) != TCL_OK)  {
                    opserr << "WARNING invalid axial matTag\n";
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                theMaterials[0] = OPS_getUniaxialMaterial(matTag);
                if (theMaterials[0] == 0)  {
                    opserr << "WARNING material model not found\n";
                    opserr << "uniaxialMaterial: " << matTag << endln;
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                recvMat++;
            }
        }
        for (i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-T") == 0)  {
                if (Tcl_GetInt(interp, argv[i+1], &matTag) != TCL_OK)  {
                    opserr << "WARNING invalid torsional matTag\n";
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                theMaterials[1] = OPS_getUniaxialMaterial(matTag);
                if (theMaterials[1] == 0)  {
                    opserr << "WARNING material model not found\n";
                    opserr << "uniaxialMaterial: " << matTag << endln;
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                recvMat++;
            }
        }
        for (i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-My") == 0)  {
                if (Tcl_GetInt(interp, argv[i+1], &matTag) != TCL_OK)  {
                    opserr << "WARNING invalid moment y matTag\n";
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                theMaterials[2] = OPS_getUniaxialMaterial(matTag);
                if (theMaterials[2] == 0)  {
                    opserr << "WARNING material model not found\n";
                    opserr << "uniaxialMaterial: " << matTag << endln;
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                recvMat++;
            }
        }
        for (i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-Mz") == 0)  {
                if (Tcl_GetInt(interp, argv[i+1], &matTag) != TCL_OK)  {
                    opserr << "WARNING invalid moment z matTag\n";
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                theMaterials[3] = OPS_getUniaxialMaterial(matTag);
                if (theMaterials[3] == 0)  {
                    opserr << "WARNING material model not found\n";
                    opserr << "uniaxialMaterial: " << matTag << endln;
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                recvMat++;
            }
        }
        if (recvMat != 4)  {
            opserr << "WARNING wrong number of materials\n";
            opserr << "got " << recvMat << " materials, but want 4 materials\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        
        // check for optional arguments
        Vector x(0);
        Vector y(3); y(0) = 0.0; y(1) = 1.0; y(2) = 0.0;
        for (i = 9+eleArgStart; i < argc; i++)  {
            if (strcmp(argv[i],"-orient") == 0)  {
                j = i+1;
                int numOrient = 0;
                while (j < argc &&
                    strcmp(argv[j],"-shearDist") != 0 &&
                    strcmp(argv[j],"-doRayleigh") != 0 &&
                    strcmp(argv[j],"-mass") != 0)  {
                        numOrient++;
                        j++;
                }
                if (numOrient == 3)  {
                    argi = i+1;
                    double value;
                    // read the y values
                    for (j=0; j<3; j++)  {
                        if (Tcl_GetDouble(interp, argv[argi], &value) != TCL_OK)  {
                            opserr << "WARNING invalid -orient value\n";
                            opserr << "elastomericBearing element: " << tag << endln;
                            return TCL_ERROR;
                        } else  {
                            argi++;
                            y(j) = value;
                        }
                    }
                }
                else if (numOrient == 6)  {
                    argi = i+1;
                    x.resize(3);
                    double value;
                    // read the x values
                    for (j=0; j<3; j++)  {
                        if (Tcl_GetDouble(interp, argv[argi], &value) != TCL_OK)  {
                            opserr << "WARNING invalid -orient value\n";
                            opserr << "elastomericBearing element: " << tag << endln;
                            return TCL_ERROR;
                        } else  {
                            argi++;
                            x(j) = value;
                        }
                    }
                    // read the y values
                    for (j=0; j<3; j++)  {
                        if (Tcl_GetDouble(interp, argv[argi], &value) != TCL_OK)  {
                            opserr << "WARNING invalid -orient value\n";
                            opserr << "elastomericBearing element: " << tag << endln;
                            return TCL_ERROR;
                        } else  {
                            argi++;
                            y(j) = value;		
                        }
                    }
                }
                else  {
                    opserr << "WARNING insufficient arguments after -orient flag\n";
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        for (i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-shearDist") == 0)  {
                if (Tcl_GetDouble(interp, argv[i+1], &shearDistI) != TCL_OK)  {
                    opserr << "WARNING invalid -shearDist value\n";
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        for (i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-doRayleigh") == 0)
                doRayleigh = 1;
        }
        for (i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-mass") == 0)  {
                if (Tcl_GetDouble(interp, argv[i+1], &mass) != TCL_OK)  {
                    opserr << "WARNING invalid -mass value\n";
                    opserr << "elastomericBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        
        // now create the elastomericBearing
        theElement = new ElastomericBearingPlasticity3d(tag, iNode, jNode, kInit, fy, 
            alpha1, theMaterials, y, x, alpha2, mu, shearDistI, doRayleigh, mass);
        
        if (theElement == 0)  {
            opserr << "WARNING ran out of memory creating element\n";
            opserr << "elastomericBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        
        // then add the elastomericBearing to the domain
        if (theTclDomain->addElement(theElement) == false)  {
            opserr << "WARNING could not add element to the domain\n";
            opserr << "elastomericBearing element: " << tag << endln;
            delete theElement;
            return TCL_ERROR;
        }       
    }
    
    else  {
        opserr << "WARNING elastomericBearing command only works when ndm is 2 or 3, ndm: ";
        opserr << ndm << endln;
        return TCL_ERROR;
    }
    
    // if get here we have sucessfully created the elastomericBearing and added it to the domain
    return TCL_OK;
}
Beispiel #7
0
void *
OPS_ParallelMaterial(void)
{
  // Pointer to a uniaxial material that will be returned
  UniaxialMaterial *theMaterial = 0;
  Vector *theFactors = 0;

  int argc = OPS_GetNumRemainingInputArgs();

  if (argc < 2) {
    opserr << "Invalid #args,  want: uniaxialMaterial Parallel $tag $tag1 $tag2 ... <-factors $fact1 $fact2 ...>" << endln;
    return 0;
  }

  // count the number of materials
  int numMats = -1;
  int gotFactors = 0;

  while (argc > 0)  {
    const char *argvLoc = OPS_GetString();
    if (strcmp(argvLoc, "-factors") == 0) {
      gotFactors = 1;
      break;
    }
    numMats++;
    argc = OPS_GetNumRemainingInputArgs();
  }
  
  // reset to read from beginning
  OPS_ResetCurrentInputArg(2);
  
  int numData = 1+numMats;
  int *iData = new int[numData];
  UniaxialMaterial **theMats = new UniaxialMaterial *[numMats];
  double *dData = 0;

  if (gotFactors) {
      dData = new double[numMats];
      theFactors = new Vector(dData, numMats);
  }
  
  if (OPS_GetIntInput(&numData, iData) != 0) {
    opserr << "WARNING invalid data for uniaxialMaterial Parallel" << endln;
    return 0;
  }

  for (int i=1; i<numMats+1; i++) {
    UniaxialMaterial *theMat = OPS_getUniaxialMaterial(iData[i]);
    if (theMat == 0) {
      opserr << "WARNING no existing material with tag " << iData[i] 
	     << " for uniaxialMaterial Parallel" << iData[0] << endln;
      delete [] iData;
      delete [] theMats;
      return 0;
    }
    theMats[i-1] = theMat;
  }
  
  if (gotFactors) {
    const char *argvLoc = OPS_GetString();
    if (OPS_GetDoubleInput(&numMats, dData) != 0) {
      opserr << "WARNING invalid factors for uniaxialMaterial Parallel" << endln;
      return 0;
    }
  }

  // Parsing was successful, allocate the material
  theMaterial = new ParallelMaterial(iData[0], numMats, theMats, theFactors);
  if (theMaterial == 0) {
    opserr << "WARNING could not create uniaxialMaterial of type Parallel\n";
    return 0;
  }
  
  delete [] iData;
  delete [] theMats;

  if (theFactors != 0) 
    delete theFactors;
  
  return theMaterial;
}
Beispiel #8
0
UniaxialMaterial *OPS_GetUniaxialMaterial(int matTag)
{
    return OPS_getUniaxialMaterial(matTag);
}
int OPS_Layer()
{
    // num args
    if(OPS_GetNumRemainingInputArgs() < 1) {
	opserr<<"WARNING insufficient args: layer type ...\n";
	return -1;
    }

    // create patch
    ReinfLayer *theLayer = 0;
    const char* type = OPS_GetString();

    if(strcmp(type,"straight")==0) {
	theLayer = (ReinfLayer*) OPS_StraightReinfLayer();
    } else if(strcmp(type,"circ")==0 || strcmp(type,"circular")==0) {
	theLayer = (ReinfLayer*) OPS_CircReinfLayer();
    } else {
	opserr<<"ERROR unknow layer type\n";
	return -1;
    }

    if (theLayer == 0) {
	opserr<<"WARNING failed to create layer\n";
	return -1;
    }

    // add fibers to the section
    int numReinfBars = theLayer->getNumReinfBars();
    ReinfBar* reinfBar = theLayer->getReinfBars();
    int matTag = theLayer->getMaterialID();

    if(reinfBar == 0) {
	opserr<<"ERROR out of run to create fibers\n";
	delete theLayer;
	return -1;
    }

    for(int j=0; j<numReinfBars; j++) {

	// get fiber data
	double area = reinfBar[j].getArea();
	const Vector& cPos = reinfBar[j].getPosition();

	// create fibers
	Fiber *theFiber = 0;
	UniaxialMaterial *material = 0;
	NDMaterial *ndmaterial = 0;

	if (theActiveFiberSection2d != 0) {

	    material = OPS_getUniaxialMaterial(matTag);
	    if (material == 0) {
		opserr << "WARNING material "<<matTag<<" cannot be found\n";
		delete theLayer;
		return -1;
	    }
	    theFiber = new UniaxialFiber2d(j,*material,area,cPos(0));
	    theActiveFiberSection2d->addFiber(*theFiber);

	} else if (theActiveFiberSection2dThermal != 0) {

	    material = OPS_getUniaxialMaterial(matTag);
	    if (material == 0) {
		opserr << "WARNING material "<<matTag<<" cannot be found\n";
		delete theLayer;
		return -1;
	    }
	    theFiber = new UniaxialFiber2d(j,*material,area,cPos(0));
	    theActiveFiberSection2dThermal->addFiber(*theFiber);

	} else if (theActiveFiberSection3d != 0) {

	    material = OPS_getUniaxialMaterial(matTag);
	    if (material == 0) {
		opserr << "WARNING material "<<matTag<<" cannot be found\n";
		delete theLayer;
		return -1;
	    }
	    theFiber = new UniaxialFiber3d(j,*material,area,cPos);
	    theActiveFiberSection3d->addFiber(*theFiber);

	} else if (theActiveFiberSection3dThermal != 0) {

	    material = OPS_getUniaxialMaterial(matTag);
	    if (material == 0) {
		opserr << "WARNING material "<<matTag<<" cannot be found\n";
		delete theLayer;
		return -1;
	    }
	    theFiber = new UniaxialFiber3d(j,*material,area,cPos);
	    theActiveFiberSection3dThermal->addFiber(*theFiber);

	} else if (theActiveFiberSectionGJThermal != 0) {

	    material = OPS_getUniaxialMaterial(matTag);
	    if (material == 0) {
		opserr << "WARNING material "<<matTag<<" cannot be found\n";
		delete theLayer;
		return -1;
	    }
	    theFiber = new UniaxialFiber3d(j,*material,area,cPos);
	    theActiveFiberSectionGJThermal->addFiber(*theFiber);

	} else if (theActiveNDFiberSection2d != 0) {

	    ndmaterial = OPS_getNDMaterial(matTag);
	    if (ndmaterial == 0) {
		opserr << "WARNING material "<<matTag<<" cannot be found\n";
		delete theLayer;
		return -1;
	    }
	    theFiber = new NDFiber2d(j,*ndmaterial,area,cPos(0));
	    theActiveNDFiberSection2d->addFiber(*theFiber);

	} else if (theActiveNDFiberSection3d != 0) {

	    ndmaterial = OPS_getNDMaterial(matTag);
	    if (ndmaterial == 0) {
		opserr << "WARNING material "<<matTag<<" cannot be found\n";
		delete theLayer;
		return -1;
	    }
	    theFiber = new NDFiber3d(j,*ndmaterial,area,cPos(0),cPos(1));
	    theActiveNDFiberSection3d->addFiber(*theFiber);
	}

    }

    delete [] reinfBar;
    delete theLayer;


    return 0;
}
int OPS_Patch()
{
    // num args
    if(OPS_GetNumRemainingInputArgs() < 1) {
	opserr<<"WARNING insufficient args: patch type ...\n";
	return -1;
    }

    // create patch
    Patch *thePatch = 0;
    const char* type = OPS_GetString();
    if(strcmp(type,"quad")==0 || strcmp(type,"quadr")==0 || strcmp(type,"quadrilateral")==0) {
	thePatch = (QuadPatch*) OPS_QuadPatch();
    } else if(strcmp(type,"rect")==0 || strcmp(type,"rectangular")==0) {
	thePatch = (QuadPatch*) OPS_RectPatch();
    } else if(strcmp(type,"circ")==0 || strcmp(type,"circular")==0) {
	thePatch = (CircPatch*) OPS_CircPatch();
    } else {
	opserr<<"ERROR unknow patch type\n";
	return -1;
    }

    if (thePatch == 0) {
	opserr<<"WARNING failed to create patch\n";
	return -1;
    }

    // add fibers to the section
    int numCells = thePatch->getNumCells();
    int matTag = thePatch->getMaterialID();
    Cell** cells = thePatch->getCells();
    if(cells == 0) {
	opserr << "ERROR out of run to create fibers\n";
	delete thePatch;
	return -1;
    }
    for(int j=0; j<numCells; j++) {
	// get fiber data
	double area = cells[j]->getArea();
	const Vector& cPos = cells[j]->getCentroidPosition();

	// create fibers
	Fiber *theFiber = 0;
	UniaxialMaterial *material = 0;
	NDMaterial *ndmaterial = 0;

	if (theActiveFiberSection2d != 0) {

	    material = OPS_getUniaxialMaterial(matTag);
	    if (material == 0) {
		opserr << "WARNING material "<<matTag<<" cannot be found\n";
		delete thePatch;
		return -1;
	    }
	    theFiber = new UniaxialFiber2d(j,*material,area,cPos(0));
	    theActiveFiberSection2d->addFiber(*theFiber);

	} else if (theActiveFiberSection2dThermal != 0) {

	    material = OPS_getUniaxialMaterial(matTag);
	    if (material == 0) {
		opserr << "WARNING material "<<matTag<<" cannot be found\n";
		delete thePatch;
		return -1;
	    }
	    theFiber = new UniaxialFiber2d(j,*material,area,cPos(0));
	    theActiveFiberSection2dThermal->addFiber(*theFiber);

	} else if (theActiveFiberSection3d != 0) {

	    material = OPS_getUniaxialMaterial(matTag);
	    if (material == 0) {
		opserr << "WARNING material "<<matTag<<" cannot be found\n";
		delete thePatch;
		return -1;
	    }
	    theFiber = new UniaxialFiber3d(j,*material,area,cPos);
	    theActiveFiberSection3d->addFiber(*theFiber);

	} else if (theActiveFiberSection3dThermal != 0) {

	    material = OPS_getUniaxialMaterial(matTag);
	    if (material == 0) {
		opserr << "WARNING material "<<matTag<<" cannot be found\n";
		delete thePatch;
		return -1;
	    }
	    theFiber = new UniaxialFiber3d(j,*material,area,cPos);
	    theActiveFiberSection3dThermal->addFiber(*theFiber);

	} else if (theActiveFiberSectionGJThermal != 0) {

	    material = OPS_getUniaxialMaterial(matTag);
	    if (material == 0) {
		opserr << "WARNING material "<<matTag<<" cannot be found\n";
		delete thePatch;
		return -1;
	    }
	    theFiber = new UniaxialFiber3d(j,*material,area,cPos);
	    theActiveFiberSectionGJThermal->addFiber(*theFiber);

	} else if (theActiveNDFiberSection2d != 0) {

	    ndmaterial = OPS_getNDMaterial(matTag);
	    if (ndmaterial == 0) {
		opserr << "WARNING material "<<matTag<<" cannot be found\n";
		delete thePatch;
		return -1;
	    }
	    theFiber = new NDFiber2d(j,*ndmaterial,area,cPos(0));
	    theActiveNDFiberSection2d->addFiber(*theFiber);

	} else if (theActiveNDFiberSection3d != 0) {

	    ndmaterial = OPS_getNDMaterial(matTag);
	    if (ndmaterial == 0) {
		opserr << "WARNING material "<<matTag<<" cannot be found\n";
		delete thePatch;
		return -1;
	    }
	    theFiber = new NDFiber3d(j,*ndmaterial,area,cPos(0),cPos(1));
	    theActiveNDFiberSection3d->addFiber(*theFiber);
	}

	delete cells[j];
    }

    delete [] cells;
    delete thePatch;
    return 0;
}
int TclModelBuilder_addRJWatsonEqsBearing(ClientData clientData,
    Tcl_Interp *interp, int argc, TCL_Char **argv, Domain *theTclDomain,
    TclModelBuilder *theTclBuilder, int eleArgStart)
{
    // ensure the destructor has not been called
    if (theTclBuilder == 0)  {
        opserr << "WARNING builder has been destroyed - RJWatsonEqsBearing\n";
        return TCL_ERROR;
    }
    
    Element *theElement = 0;
    int ndm = theTclBuilder->getNDM();
    int ndf = theTclBuilder->getNDF();
    int tag;
    
    if (ndm == 2)  {
        // check plane frame problem has 3 dof per node
        if (ndf != 3)  {
            opserr << "WARNING invalid ndf: " << ndf;
            opserr << ", for plane problem need 3 - RJWatsonEqsBearing\n";
            return TCL_ERROR;
        }
        
        // check the number of arguments is correct
        if ((argc-eleArgStart) < 13)  {
            opserr << "WARNING insufficient arguments\n";
            printCommand(argc, argv);
            opserr << "Want: RJWatsonEqsBearing eleTag iNode jNode frnMdlTag kInit k2 k3 mu -P matTag -Mz matTag <-orient x1 x2 x3 y1 y2 y3> <-shearDist sDratio> <-doRayleigh> <-mass m> <-iter maxIter tol>\n";
            return TCL_ERROR;
        }
        
        // get the id and end nodes
        int iNode, jNode, frnMdlTag, matTag, argi, i, j;
        int recvMat = 0;
        double kInit, k2;
        double k3 = 0.0;
        double mu = 2.0;
        double shearDistI = 1.0;
        int doRayleigh = 0;
        double mass = 0.0;
        int maxIter = 25;
        double tol = 1E-12;
        double kFactUplift = 1E-12;
        
        if (Tcl_GetInt(interp, argv[1+eleArgStart], &tag) != TCL_OK)  {
            opserr << "WARNING invalid RJWatsonEqsBearing eleTag\n";
            return TCL_ERROR;
        }
        if (Tcl_GetInt(interp, argv[2+eleArgStart], &iNode) != TCL_OK)  {
            opserr << "WARNING invalid iNode\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetInt(interp, argv[3+eleArgStart], &jNode) != TCL_OK)  {
            opserr << "WARNING invalid jNode\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetInt(interp, argv[4+eleArgStart], &frnMdlTag) != TCL_OK)  {
            opserr << "WARNING invalid frnMdlTag\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        FrictionModel *theFrnMdl = OPS_getFrictionModel(frnMdlTag);
        if (theFrnMdl == 0)  {
            opserr << "WARNING friction model not found\n";
            opserr << "frictionModel: " << frnMdlTag << endln;
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetDouble(interp, argv[5+eleArgStart], &kInit) != TCL_OK)  {
            opserr << "WARNING invalid kInit\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
         if (Tcl_GetDouble(interp, argv[6+eleArgStart], &k2) != TCL_OK)  {
            opserr << "WARNING invalid k2\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetDouble(interp, argv[7+eleArgStart], &k3) != TCL_OK)  {
            opserr << "WARNING invalid k3\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetDouble(interp, argv[8+eleArgStart], &mu) != TCL_OK)  {
            opserr << "WARNING invalid mu\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        UniaxialMaterial *theMaterials[2];
        for (i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-P") == 0)  {
                theMaterials[0] = 0;
                if (Tcl_GetInt(interp, argv[i+1], &matTag) != TCL_OK)  {
                    opserr << "WARNING invalid matTag\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                theMaterials[0] = OPS_getUniaxialMaterial(matTag);
                if (theMaterials[0] == 0)  {
                    opserr << "WARNING material model not found\n";
                    opserr << "uniaxialMaterial: " << matTag << endln;
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                recvMat++;
            }
        }
        for (i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-Mz") == 0)  {
                if (Tcl_GetInt(interp, argv[i+1], &matTag) != TCL_OK)  {
                    opserr << "WARNING invalid matTag\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                theMaterials[1] = OPS_getUniaxialMaterial(matTag);
                if (theMaterials[1] == 0)  {
                    opserr << "WARNING material model not found\n";
                    opserr << "uniaxialMaterial: " << matTag << endln;
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                recvMat++;
            }
        }
        if (recvMat != 2)  {
            opserr << "WARNING wrong number of materials\n";
            opserr << "got " << recvMat << " materials, but want 2 materials\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        
        // check for optional arguments
        Vector x = 0;
        Vector y = 0;
        for (i = 9+eleArgStart; i < argc; i++)  {
            if (strcmp(argv[i],"-orient") == 0)  {
                j = i+1;
                int numOrient = 0;
                while (j < argc &&
                    strcmp(argv[j],"-shearDist") != 0 &&
                    strcmp(argv[j],"-doRayleigh") != 0 &&
                    strcmp(argv[j],"-mass") != 0 &&
                    strcmp(argv[j],"-iter") != 0 &&
                    strcmp(argv[j],"-kFactUplift") != 0)  {
                    numOrient++;
                    j++;
                }
                if (numOrient == 6)  {
                    argi = i+1;
                    x.resize(3);
                    y.resize(3);
                    double value;
                    // read the x values
                    for (j=0; j<3; j++)  {
                        if (Tcl_GetDouble(interp, argv[argi], &value) != TCL_OK)  {
                            opserr << "WARNING invalid -orient value\n";
                            opserr << "RJWatsonEqsBearing element: " << tag << endln;
                            return TCL_ERROR;
                        } else  {
                            argi++;
                            x(j) = value;
                        }
                    }
                    // read the y values
                    for (j=0; j<3; j++)  {
                        if (Tcl_GetDouble(interp, argv[argi], &value) != TCL_OK)  {
                            opserr << "WARNING invalid -orient value\n";
                            opserr << "RJWatsonEqsBearing element: " << tag << endln;
                            return TCL_ERROR;
                        } else  {
                            argi++;
                            y(j) = value;
                        }
                    }
                }
                else  {
                    opserr << "WARNING insufficient arguments after -orient flag\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        for (int i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-shearDist") == 0)  {
                if (Tcl_GetDouble(interp, argv[i+1], &shearDistI) != TCL_OK)  {
                    opserr << "WARNING invalid -shearDist value\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        for (int i = 9+eleArgStart; i < argc; i++)  {
            if (strcmp(argv[i], "-doRayleigh") == 0)
                doRayleigh = 1;
        }
        for (int i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-mass") == 0)  {
                if (Tcl_GetDouble(interp, argv[i+1], &mass) != TCL_OK)  {
                    opserr << "WARNING invalid -mass value\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        for (int i = 9+eleArgStart; i < argc; i++)  {
            if (i+2 < argc && strcmp(argv[i], "-iter") == 0)  {
                if (Tcl_GetInt(interp, argv[i+1], &maxIter) != TCL_OK)  {
                    opserr << "WARNING invalid maxIter\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                if (Tcl_GetDouble(interp, argv[i+2], &tol) != TCL_OK)  {
                    opserr << "WARNING invalid tol\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        for (int i = 9+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-kFactUplift") == 0)  {
                if (Tcl_GetDouble(interp, argv[i+1], &kFactUplift) != TCL_OK)  {
                    opserr << "WARNING invalid kFactUplift\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        
        // now create the RJWatsonEqsBearing
        theElement = new RJWatsonEQS2d(tag, iNode, jNode, *theFrnMdl, kInit, k2,
            theMaterials, y, x, k3, mu, shearDistI, doRayleigh, mass,
            maxIter, tol, kFactUplift);
        
        if (theElement == 0)  {
            opserr << "WARNING ran out of memory creating element\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        
        // then add the RJWatsonEqsBearing to the domain
        if (theTclDomain->addElement(theElement) == false)  {
            opserr << "WARNING could not add element to the domain\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            delete theElement;
            return TCL_ERROR;
        }
    }
    
    else if (ndm == 3)  {
        // check space frame problem has 6 dof per node
        if (ndf != 6)  {
            opserr << "WARNING invalid ndf: " << ndf;
            opserr << ", for space problem need 6 - RJWatsonEqsBearing \n";
            return TCL_ERROR;
        }
        
        // check the number of arguments is correct
        if ((argc-eleArgStart) < 18)  {
            opserr << "WARNING insufficient arguments\n";
            printCommand(argc, argv);
            opserr << "Want: RJWatsonEqsBearing eleTag iNode jNode frnMdlTag kInit -P matTag -Vy matTag -Vz matTag -T matTag -My matTag -Mz matTag <-orient <x1 x2 x3> y1 y2 y3> <-shearDist sDratio> <-doRayleigh> <-mass m> <-iter maxIter tol>\n";
            return TCL_ERROR;
        }
        
        // get the id and end nodes 
        int iNode, jNode, frnMdlTag, matTag, argi, i, j;
        int recvMat = 0;
        double kInit;
        double shearDistI = 1.0;
        int doRayleigh = 0;
        double mass = 0.0;
        int maxIter = 25;
        double tol = 1E-12;
        double kFactUplift = 1E-12;
        
        if (Tcl_GetInt(interp, argv[1+eleArgStart], &tag) != TCL_OK)  {
            opserr << "WARNING invalid RJWatsonEqsBearing eleTag\n";
            return TCL_ERROR;
        }
        if (Tcl_GetInt(interp, argv[2+eleArgStart], &iNode) != TCL_OK)  {
            opserr << "WARNING invalid iNode\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetInt(interp, argv[3+eleArgStart], &jNode) != TCL_OK)  {
            opserr << "WARNING invalid jNode\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetInt(interp, argv[4+eleArgStart], &frnMdlTag) != TCL_OK)  {
            opserr << "WARNING invalid frnMdlTag\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        FrictionModel *theFrnMdl = OPS_getFrictionModel(frnMdlTag);
        if (theFrnMdl == 0)  {
            opserr << "WARNING friction model not found\n";
            opserr << "frictionModel: " << frnMdlTag << endln;
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        if (Tcl_GetDouble(interp, argv[5+eleArgStart], &kInit) != TCL_OK)  {
            opserr << "WARNING invalid kInit\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        UniaxialMaterial *theMaterials[6];
        for (i = 6+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-P") == 0)  {
                if (Tcl_GetInt(interp, argv[i+1], &matTag) != TCL_OK)  {
                    opserr << "WARNING invalid axial matTag\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                theMaterials[0] = OPS_getUniaxialMaterial(matTag);
                if (theMaterials[0] == 0)  {
                    opserr << "WARNING material model not found\n";
                    opserr << "uniaxialMaterial: " << matTag << endln;
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                recvMat++;
            }
        }
        for (i = 6+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-Vy") == 0)  {
                if (Tcl_GetInt(interp, argv[i+1], &matTag) != TCL_OK)  {
                    opserr << "WARNING invalid shear y matTag\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                theMaterials[1] = OPS_getUniaxialMaterial(matTag);
                if (theMaterials[1] == 0)  {
                    opserr << "WARNING material model not found\n";
                    opserr << "uniaxialMaterial: " << matTag << endln;
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                recvMat++;
            }
        }
        for (i = 6+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-Vz") == 0)  {
                if (Tcl_GetInt(interp, argv[i+1], &matTag) != TCL_OK)  {
                    opserr << "WARNING invalid shear z matTag\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                theMaterials[2] = OPS_getUniaxialMaterial(matTag);
                if (theMaterials[2] == 0)  {
                    opserr << "WARNING material model not found\n";
                    opserr << "uniaxialMaterial: " << matTag << endln;
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                recvMat++;
            }
        }
        for (i = 6+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-T") == 0)  {
                if (Tcl_GetInt(interp, argv[i+1], &matTag) != TCL_OK)  {
                    opserr << "WARNING invalid torsional matTag\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                theMaterials[3] = OPS_getUniaxialMaterial(matTag);
                if (theMaterials[3] == 0)  {
                    opserr << "WARNING material model not found\n";
                    opserr << "uniaxialMaterial: " << matTag << endln;
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                recvMat++;
            }
        }
        for (i = 6+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-My") == 0)  {
                if (Tcl_GetInt(interp, argv[i+1], &matTag) != TCL_OK)  {
                    opserr << "WARNING invalid moment y matTag\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                theMaterials[4] = OPS_getUniaxialMaterial(matTag);
                if (theMaterials[4] == 0)  {
                    opserr << "WARNING material model not found\n";
                    opserr << "uniaxialMaterial: " << matTag << endln;
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                recvMat++;
            }
        }
        for (i = 6+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-Mz") == 0)  {
                if (Tcl_GetInt(interp, argv[i+1], &matTag) != TCL_OK)  {
                    opserr << "WARNING invalid moment z matTag\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                theMaterials[5] = OPS_getUniaxialMaterial(matTag);
                if (theMaterials[5] == 0)  {
                    opserr << "WARNING material model not found\n";
                    opserr << "uniaxialMaterial: " << matTag << endln;
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                recvMat++;
            }
        }
        if (recvMat != 6)  {
            opserr << "WARNING wrong number of materials\n";
            opserr << "got " << recvMat << " materials, but want 6 materials\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        
        // check for optional arguments
        Vector x(0);
        Vector y(3); y(0) = 0.0; y(1) = 1.0; y(2) = 0.0;
        for (i = 6+eleArgStart; i < argc; i++)  {
            if (strcmp(argv[i],"-orient") == 0)  {
                j = i+1;
                int numOrient = 0;
                while (j < argc &&
                    strcmp(argv[j],"-shearDist") != 0 &&
                    strcmp(argv[j],"-doRayleigh") != 0 &&
                    strcmp(argv[j],"-mass") != 0 &&
                    strcmp(argv[j],"-iter") != 0 &&
                    strcmp(argv[j],"-kFactUplift") != 0)  {
                    numOrient++;
                    j++;
                }
                if (numOrient == 3)  {
                    argi = i+1;
                    double value;
                    // read the y values
                    for (j=0; j<3; j++)  {
                        if (Tcl_GetDouble(interp, argv[argi], &value) != TCL_OK)  {
                            opserr << "WARNING invalid -orient value\n";
                            opserr << "RJWatsonEqsBearing element: " << tag << endln;
                            return TCL_ERROR;
                        } else  {
                            argi++;
                            y(j) = value;
                        }
                    }
                }
                else if (numOrient == 6)  {
                    argi = i+1;
                    x.resize(3);
                    double value;
                    // read the x values
                    for (j=0; j<3; j++)  {
                        if (Tcl_GetDouble(interp, argv[argi], &value) != TCL_OK)  {
                            opserr << "WARNING invalid -orient value\n";
                            opserr << "RJWatsonEqsBearing element: " << tag << endln;
                            return TCL_ERROR;
                        } else  {
                            argi++;
                            x(j) = value;
                        }
                    }
                    // read the y values
                    for (j=0; j<3; j++)  {
                        if (Tcl_GetDouble(interp, argv[argi], &value) != TCL_OK)  {
                            opserr << "WARNING invalid -orient value\n";
                            opserr << "RJWatsonEqsBearing element: " << tag << endln;
                            return TCL_ERROR;
                        } else  {
                            argi++;
                            y(j) = value;
                        }
                    }
                }
                else  {
                    opserr << "WARNING insufficient arguments after -orient flag\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        for (i = 6+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-shearDist") == 0)  {
                if (Tcl_GetDouble(interp, argv[i+1], &shearDistI) != TCL_OK)  {
                    opserr << "WARNING invalid -shearDist value\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        for (i = 6+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-doRayleigh") == 0)
                doRayleigh = 1;
        }
        for (i = 6+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-mass") == 0)  {
                if (Tcl_GetDouble(interp, argv[i+1], &mass) != TCL_OK)  {
                    opserr << "WARNING invalid -mass value\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        for (int i = 6+eleArgStart; i < argc; i++)  {
            if (i+2 < argc && strcmp(argv[i], "-iter") == 0)  {
                if (Tcl_GetInt(interp, argv[i+1], &maxIter) != TCL_OK)  {
                    opserr << "WARNING invalid maxIter\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
                if (Tcl_GetDouble(interp, argv[i+2], &tol) != TCL_OK)  {
                    opserr << "WARNING invalid tol\n";
                    opserr << "RJWatsonEqsBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        for (int i = 6+eleArgStart; i < argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-kFactUplift") == 0)  {
                if (Tcl_GetDouble(interp, argv[i+1], &kFactUplift) != TCL_OK)  {
                    opserr << "WARNING invalid kFactUplift\n";
                    opserr << "singleFPBearing element: " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        
        // now create the RJWatsonEqsBearing
        theElement = new RJWatsonEQS3d(tag, iNode, jNode, *theFrnMdl, kInit,
            theMaterials, y, x, shearDistI, doRayleigh, mass, maxIter, tol,
            kFactUplift);
        
        if (theElement == 0)  {
            opserr << "WARNING ran out of memory creating element\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            return TCL_ERROR;
        }
        
        // then add the RJWatsonEqsBearing to the domain
        if (theTclDomain->addElement(theElement) == false)  {
            opserr << "WARNING could not add element to the domain\n";
            opserr << "RJWatsonEqsBearing element: " << tag << endln;
            delete theElement;
            return TCL_ERROR;
        }
    }
    
    else  {
        opserr << "WARNING RJWatsonEqsBearing command only works when ndm is 2 or 3, ndm: ";
        opserr << ndm << endln;
        return TCL_ERROR;
    }
    
    // if get here we have sucessfully created the RJWatsonEqsBearing and added it to the domain
    return TCL_OK;
}
Beispiel #12
0
void* OPS_ZeroLengthND()
{
    int ndm = OPS_GetNDM();
    int numdata = OPS_GetNumRemainingInputArgs();
    if (numdata < 4) {
        opserr << "WARNING too few arguments " <<
            "want - element zeroLengthND eleTag? iNode? jNode? " <<
	    "NDTag? <1DTag?>" <<
	    "<-orient x1? x2? x3? y1? y2? y3?>\n";

        return 0;
    }

    int idata [4];
    numdata = 4;
    if (OPS_GetIntInput(&numdata,idata) < 0) {
        opserr << "WARNING: failed to get integer data\n";
        return 0;
    }
    NDMaterial* nmat = OPS_getNDMaterial(idata[3]);
    if (nmat == 0) {
	opserr<<"WARNING: NDMaterial "<<idata[3]<<" is not defined\n";
	return 0;
    }

    UniaxialMaterial* umat = 0;
    int uniTag;
    if (OPS_GetIntInput(&numdata,&uniTag) >= 0) {
	umat = OPS_getUniaxialMaterial(uniTag);
	if (umat == 0) {
	    opserr<<"WARNING: uniaxial material "<<uniTag<<" is not defined\n";
	    return 0;
	}
    } else {
	OPS_ResetCurrentInputArg(-1);
    }

    const char* type = OPS_GetString();
    Vector x(3); x(0) = 1.0; x(1) = 0.0; x(2) = 0.0;
    Vector y(3); y(0) = 0.0; y(1) = 1.0; y(2) = 0.0;
    if (strcmp(type,"orient") == 0) {
	if (OPS_GetNumRemainingInputArgs() < 6) {
	    opserr<<"WARNING: insufficient orient values\n";
	    return 0;
	}
	numdata = 3;
	if (OPS_GetDoubleInput(&numdata,&x(0)) < 0) {
	    opserr<<"WARNING: invalid double input\n";
	    return 0;
	}
	if (OPS_GetDoubleInput(&numdata,&y(0)) < 0) {
	    opserr<<"WARNING: invalid double input\n";
	    return 0;
	}
    }

    if (umat == 0) {
	return new ZeroLengthND(idata[0],ndm,idata[1],idata[2],x,y,*nmat);
    } else {
	return new ZeroLengthND(idata[0],ndm,idata[1],idata[2],x,y,*nmat,*umat);
    }
}
Beispiel #13
0
int
TclModelBuilder_Pipelin2(ClientData clientData, Tcl_Interp *interp, int argc,
	TCL_Char **argv, Domain*theTclDomain,
	TclModelBuilder *theTclBuilder,
	int eleArgStart)
{
	//make sure at least one other argument to contain type of system
	if (argc!=8 && argc!=9){
		interp->result = "WARNING bad command - Pipelin2 eleId iNode jNode matID Area c_3 Gamma";
		return TCL_ERROR;
	}
	
	//get the id, x_loc, y_loc
	int trussId, iNode, jNode, matID;
	double A, C_3, Gamma=0.0;
	if (Tcl_GetInt(interp,argv[2], &trussId)!= TCL_OK){
		interp->result = "WARNING invalid eleId - Pipelin2 eleId iNode jNode matID Area c_3 Gamma";
		return TCL_ERROR;
	}

	if (Tcl_GetInt(interp, argv[3], &iNode) != TCL_OK) {
		interp->result = "WARNING invalid iNode - Pipelin2 eleId iNode jNode matID Area c_3 Gamma";
		return TCL_ERROR;
	}
	if (Tcl_GetInt(interp, argv[4], &jNode) != TCL_OK) {
		interp->result = "WARNING invalid jNode - Pipelin2 eleId iNode jNode matID Area c_3 Gamma";
		return TCL_ERROR;
	}

	if (Tcl_GetInt(interp, argv[5], &matID) != TCL_OK) {
		interp->result = "WARNING invalid matID - Pipelin2 eleId iNode jNode matID Area c_3 Gamma";
		return TCL_ERROR;
	}

	if (Tcl_GetDouble(interp, argv[6], &A) != TCL_OK) {
		interp->result = "WARNING invalid Area - Pipelin2 eleId iNode jNode matID Area c_3 Gamma";
		return TCL_ERROR;
	}

	if (Tcl_GetDouble(interp, argv[7], &C_3) != TCL_OK) {
		interp->result = "WARNING invalid C_3 - Pipelin2 eleId iNode jNode matID Area c_3 Gamma";
		return TCL_ERROR;
	}

	if (Tcl_GetDouble(interp, argv[8], &Gamma) != TCL_OK) {
		interp->result = "WARNING invalid C_3 - Pipelin2 eleId iNode jNode matID Area c_3 gamma";
		return TCL_ERROR;
	}

	UniaxialMaterial *theMaterial = OPS_getUniaxialMaterial(matID);
	if (theMaterial ==0) {
		opserr << "WARNING TclPipelin2 - Pipelin2 - no Material found with tag ";
		opserr << matID << endln;
		return TCL_ERROR;
	}

	//now create the truss and add it to the domain
	Element *theTruss = 0;
	theTruss=new Pipelin2(trussId,iNode,jNode,*theMaterial,A,C_3,Gamma);
	if (theTruss==0) {
		opserr << "WARNING TclPipelin2 - Pipelin2 - ran out of memory for node ";
		opserr << trussId << endln;
		return TCL_ERROR;
	}
	if (theTclDomain->addElement(theTruss)==false) {
		delete theTruss;
		opserr << "WARNING TclPipelin2 - Pipelin2 - could not add Pipelin2 to the domain";
		opserr << trussId << endln;
		return TCL_ERROR;
	}
	//Everything is OK
	return TCL_OK;
}