示例#1
0
void* OPS_ElasticBeam2d()
{
    if(OPS_GetNumRemainingInputArgs() < 7) {
	opserr<<"insufficient arguments:eleTag,iNode,jNode,A,E,Iz,transfTag\n";
	return 0;
    }

    int ndm = OPS_GetNDM();
    int ndf = OPS_GetNDF();
    if(ndm != 2 || ndf != 3) {
	opserr<<"ndm must be 2 and ndf must be 3\n";
	return 0;
    }

    // inputs: 
    int iData[3];
    int numData = 3;
    if(OPS_GetIntInput(&numData,&iData[0]) < 0) return 0;

    double data[3];
    if(OPS_GetDoubleInput(&numData,&data[0]) < 0) return 0;

    numData = 1;
    int transfTag;
    if(OPS_GetIntInput(&numData,&transfTag) < 0) return 0;
    
    // 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 0;
	    }
	} else if(type == "-depth") {
	    if(OPS_GetNumRemainingInputArgs() > 0) {
		if(OPS_GetDoubleInput(&numData,&depth) < 0) return 0;
	    }

	} else if(type == "-mass") {
	    if(OPS_GetNumRemainingInputArgs() > 0) {
		if(OPS_GetDoubleInput(&numData,&mass) < 0) return 0;
	    }
	} else if(type == "-cMass") {
	    cMass = 1;
	}
    }

    // check transf
    CrdTransf* theTransf = OPS_GetCrdTransf(transfTag);
    if(theTransf == 0) {
	opserr<<"coord transfomration not found\n";
	return 0;
    }

    return new ElasticBeam2d(iData[0],data[0],data[1],data[2],iData[1],iData[2],
			     *theTransf,alpha,depth,mass,cMass);
}
void* OPS_ForceBeamColumn()
{
    int ndm = OPS_GetNDM();
    if(ndm == 2) {
	return OPS_ForceBeamColumn2d();
    } else {
	return OPS_ForceBeamColumn3d();
    }
}
void* OPS_ElasticBeam()
{
    int ndm = OPS_GetNDM();
    if(ndm == 2) {
	return OPS_ElasticBeam2d();
    } else {
	return OPS_ElasticBeam3d();
    }
}
void* OPS_NDFiberSection()
{
    void* theSec = 0;
    int ndm = OPS_GetNDM();
    if(ndm == 2) {
	theSec = OPS_NDFiberSection2d();
    } else if(ndm == 3) {
	theSec = OPS_NDFiberSection3d();
    }

    return theSec;
}
void* OPS_CorotCrdTransf()
{
    int ndm = OPS_GetNDM();
    int ndf = OPS_GetNDF();
    if(ndm == 2 && ndf == 3) {
	return OPS_CorotCrdTransf2d();
    } else if(ndm == 3 && ndf == 6) {
	return OPS_CorotCrdTransf3d();
    } else {
	opserr<<"current NDM and NDF is incompatible with frame elements\n";
	return 0;
    }
}
示例#6
0
void* OPS_NodalLoad()
{
    // check inputs
    int ndm = OPS_GetNDM();
    int ndf = OPS_GetNDF();

    if(ndm<=0 || ndf<=0) {
	opserr<<"zero ndm or ndf\n";
	return 0;
    }
    
    if(OPS_GetNumRemainingInputArgs() < 1+ndf) {
	opserr<<"insufficient number of args\n";
	return 0;
    }

    // get node tag
    int ndtag;
    int numData = 1;
    if(OPS_GetIntInput(&numData, &ndtag) < 0) return 0;

    // get load vector
    Vector forces(ndf);
    if(OPS_GetDoubleInput(&ndf, &forces(0)) < 0) return 0;

    // get load const
    bool isLoadConst = false;
    if(OPS_GetNumRemainingInputArgs() > 0) {
	std::string type = OPS_GetString();
	if(type == "-const") {
	    isLoadConst = true;
	}
    }

    // create the load
    NodalLoad* theLoad = new NodalLoad(nodeLoadTag, ndtag, forces, isLoadConst);

    if(theLoad == 0) return 0;

    nodeLoadTag++;

    return theLoad;
       
}
示例#7
0
void* OPS_fElmt02()
{

    int ndm = OPS_GetNDM();
    int ndf = OPS_GetNDF();

    if (ndm != 2 && ndf != 2) {
	opserr << "WARNING - fTruss eleTag? iNode? jNode? A? E? needs ndm=2, ndf=2\n";
	return 0;
    }

    // check the number of arguments is correct
    int argc = OPS_GetNumRemainingInputArgs() + 2;
    int eleArgStart = 2;
    if ((argc-eleArgStart) < 5) {
	opserr << "WARNING insufficient arguments\n";
	opserr << "Want: element fTruss eleTag? iNode? jNode? A? E?\n";
	return 0;
    }    


    // get the id and end nodes
    int idata[3];
    int numdata = 3;
    if (OPS_GetIntInput(&numdata, idata) < 0) {
	opserr << "WARNING invalid truss eleTag, iNode or jNode" << endln;
	return 0;
    }
    int trussId=idata[0], iNode=idata[1], jNode=idata[2];

    double ddata[2];
    numdata = 2;
    if (OPS_GetDoubleInput(&numdata, ddata) < 0) {
	opserr << "WARNING invalid truss A or E" << endln;
	return 0;
    }
    
    double A=ddata[0],E=ddata[1];
 
    // now create the truss and add it to the Domain
    return new fElmt02(trussId,iNode,jNode,A,E);
}
void *OPS_ElasticSection(void)
{
    int numData = OPS_GetNumRemainingInputArgs();
    void* theSec = 0;
    int ndm = OPS_GetNDM();
    if(ndm == 2) {
	if(numData == 4) {
	    theSec = OPS_ElasticSection2d();
	} else if(numData >=5) {
	    theSec = OPS_ElasticShearSection2d();
	}
    } else if(ndm == 3) {
	if(numData == 7) {
	    theSec = OPS_ElasticSection3d();
	} else if(numData >= 8) {
	    theSec = OPS_ElasticShearSection3d();
	}
    }

    return theSec;
}
示例#9
0
OPS_Export void *
OPS_NewTrussSectionElement()
{
  Element *theElement = 0;

  int numRemainingArgs = OPS_GetNumRemainingInputArgs();

  if (numRemainingArgs < 4) {
    opserr << "Invalid Args want: element TrussSection $tag $iNode $jNode $sectTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
    return 0;	
  }

  int    iData[4];
  double rho = 0.0;
  int ndm = OPS_GetNDM();
  int doRayleigh = 0; // by default rayleigh not done
  int cMass = 0; // by default use lumped mass matrix

  int numData = 4;
  if (OPS_GetInt(&numData, iData) != 0) {
    opserr << "WARNING invalid integer (tag, iNode, jNode, sectTag) in element TrussSection " << endln;
    return 0;
  }

  SectionForceDeformation *theSection = OPS_GetSectionForceDeformation(iData[3]);
    
  if (theSection == 0) {
    opserr << "WARNING: Invalid section not found element TrussSection " << iData[0] << " $iNode $jNode " << 
      iData[3] << " <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
    return 0;
  }
  
  numRemainingArgs -= 4;
  while (numRemainingArgs > 1) {
    char argvS[15];
    if (OPS_GetString(argvS, 15) != 0) {
      opserr << "WARNING: Invalid optional string element TrussSection " << iData[0] << 
	" $iNode $jNode $sectTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
      return 0;
    } 
  
    if (strcmp(argvS,"-rho") == 0) {
      numData = 1;
      if (OPS_GetDouble(&numData, &rho) != 0) {
	opserr << "WARNING Invalid rho in element TrussSection " << iData[0] << 
	  " $iNode $jNode $secTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
	return 0;
      }
    } else if (strcmp(argvS,"-cMass") == 0) {
      numData = 1;
      if (OPS_GetInt(&numData, &cMass) != 0) {
	opserr << "WARNING: Invalid cMass in element TrussSection " << iData[0] << 
	  " $iNode $jNode $sectTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
	return 0;
      }
    } else if (strcmp(argvS,"-doRayleigh") == 0) {
      numData = 1;
      if (OPS_GetInt(&numData, &doRayleigh) != 0) {
	opserr << "WARNING: Invalid doRayleigh in element TrussSection " << iData[0] << 
	  " $iNode $jNode $sectTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
	return 0;
      }
    } else {
      opserr << "WARNING: Invalid option " << argvS << "  in: element TrussSection " << iData[0] << 
	" $iNode $jNode $secTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
      return 0;
    }
    numRemainingArgs -= 2;
  }

  // now create the TrussSection
  theElement = new TrussSection(iData[0], ndm, iData[1], iData[2], *theSection, rho, doRayleigh, cMass);

  if (theElement == 0) {
    opserr << "WARNING: out of memory: element TrussSection " << iData[0] << 
      " $iNode $jNode $secTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
  }

  return theElement;
}
示例#10
0
OPS_Export void *
OPS_NewCorotTrussElement()
{
  Element *theElement = 0;

  int numRemainingArgs = OPS_GetNumRemainingInputArgs();

  if (numRemainingArgs < 4) {
    opserr << "Invalid Args want: element CorotTruss $tag $iNode $jNode $sectTag <-rho $rho>";
    opserr << " or: element CorotTruss $tag $iNode $jNode $A $matTag <-rho $rho>\n";
    return 0;	
  }

  if (numRemainingArgs == 4 || numRemainingArgs == 6)
    return 0; // it's a CorotTrussSection

  int    iData[3];
  double A = 0.0;
  double rho = 0.0;
  int matTag = 0;
  int ndm = OPS_GetNDM();


  int numData = 3;
  if (OPS_GetInt(&numData, iData) != 0) {
    opserr << "WARNING invalid integer (tag, iNode, jNode) in element CorotTruss " << endln;
    return 0;
  }

  numData = 1;
  if (OPS_GetDouble(&numData, &A) != 0) {
    opserr << "WARNING: Invalid A: element CorotTruss " << iData[0] << 
      " $iNode $jNode $A $matTag <-rho $rho> <-rayleig $flagh>\n";
    return 0;	
  }

  numData = 1;
  if (OPS_GetInt(&numData, &matTag) != 0) {
    opserr << "WARNING: Invalid matTag: element CorotTruss " << iData[0] << 
      " $iNode $jNode $A $matTag <-rho $rho> <-rayleig $flagh>\n";
    return 0;
  }

  UniaxialMaterial *theUniaxialMaterial = OPS_GetUniaxialMaterial(matTag);
    
  if (theUniaxialMaterial == 0) {
    opserr << "WARNING: Invalid material not found element CorotTruss " << iData[0] << " $iNode $jNode $A " << 
      matTag << " <-rho $rho> <-rayleigh $flagh>\n";
    return 0;
  }
  
  numRemainingArgs -= 5;
  while (numRemainingArgs > 1) {
    char argvS[10];
    if (OPS_GetString(argvS, 10) != 0) {
      opserr << "WARNING: Invalid optional string element CorotTruss " << iData[0] << 
	" $iNode $jNode $A $matTag <-rho $rho> <-rayleigh $flagh>\n";
      return 0;
    } 
  
    if (strcmp(argvS,"-rho") == 0) {
      numData = 1;
      if (OPS_GetDouble(&numData, &rho) != 0) {
	opserr << "WARNING Invalid rho in element CorotTruss " << iData[0] << 
	  " $iNode $jNode $A $matTag <-rho $rho> <-rayleigh $flagh>\n";
	return 0;
      }
    } else {
      opserr << "WARNING: Invalid option " << argvS << "  in: element CorotTruss " << iData[0] << 
	" $iNode $jNode $A $matTag <-rho $rho> <-rayleigh $flagh>\n";
      return 0;
    }      
    numRemainingArgs -= 2;
  }

  //now create the ReinforcedConcretePlaneStress
  theElement = new CorotTruss(iData[0], ndm, iData[1], iData[2], *theUniaxialMaterial, A, rho);

  if (theElement == 0) {
    opserr << "WARNING: out of memory: element CorotTruss " << iData[0] << 
      " $iNode $jNode $A $matTag <-rho $rho> \n";
  }

  return theElement;
}
示例#11
0
void *
OPS_Truss2(void)
{
	Element *theElement = 0;

	int numRemainingArgs = OPS_GetNumRemainingInputArgs();

	if (numRemainingArgs < 7) {
		opserr << "Invalid Args want: element Truss2 $tag $iNode $jNode $auxN1 $auxN2 $A $matTag <-rho $rho> <-rayleigh $flag>\n";
		return 0;	
	}

	int    iData[5];
	double A = 0.0;
	double rho = 0.0;
	int matTag = 0;
	int doRayleigh = 0;
	int ndm = OPS_GetNDM();

	int numData = 5;
	if (OPS_GetInt(&numData, iData) != 0) {
		opserr << "WARNING invalid integer (tag, iNode, jNode, auxN1, auxN2) in element Truss2 " << endln;
		return 0;
	}

	numData = 1;
	if (OPS_GetDouble(&numData, &A) != 0) {
		opserr << "WARNING: Invalid A: element Truss2 " << iData[0] << 
			" $iNode $jNode $auxN1 $auxN2 $A $matTag <-rho $rho> <-rayleig $flagh>\n";
		return 0;	
	}

	numData = 1;
	if (OPS_GetInt(&numData, &matTag) != 0) {
		opserr << "WARNING: Invalid matTag: element Truss2 " << iData[0] << 
			" $iNode $jNode $auxN1 $auxN2 $A $matTag <-rho $rho> <-rayleig $flagh>\n";
		return 0;
	}

	UniaxialMaterial *theUniaxialMaterial = OPS_GetUniaxialMaterial(matTag);

	if (theUniaxialMaterial == 0) {
		opserr << "WARNING: Invalid material not found element Truss2 " << iData[0] << " $iNode $jNode $auxN1 $auxN2 $A " << 
			matTag << " <-rho $rho> <-rayleig $flagh>\n";
		return 0;
	}

	numRemainingArgs -= 7;
	while (numRemainingArgs > 1) {
	  const char *argvS = OPS_GetString();

		if (strcmp(argvS,"-rho") == 0) {
			numData = 1;
			if (OPS_GetDouble(&numData, &rho) != 0) {
				opserr << "WARNING Invalid rho in element Truss " << iData[0] << 
					" $iNode $jNode $A $matTag <-rho $rho> <-doRayleigh $flagh>\n";
				return 0;
			}
		} else if (strcmp(argvS,"-doRayleigh") == 0) {
			numData = 1;
			if (OPS_GetInt(&numData, &doRayleigh) != 0) {
				opserr << "WARNING: Invalid doRayleigh in element Truss " << iData[0] << 
					" $iNode $jNode $A $matTag <-rho $rho> <-doRayleigh $flagh>\n";
				return 0;
			}
		} else {
			opserr << "WARNING: Invalid option " << argvS << "  in: element Truss " << iData[0] << 
				" $iNode $jNode $A $matTag <-rho $rho> <-doRayleigh $flagh>\n";
			return 0;
		}      
		numRemainingArgs -= 2;
	}

	//now create the ReinforcedConcretePlaneStress
	theElement = new Truss2(iData[0], ndm, iData[1], iData[2], iData[3], iData[4], *theUniaxialMaterial, A, rho, doRayleigh);

	if (theElement == 0) {
		opserr << "WARNING: out of memory: element Truss2 " << iData[0] << 
			" $iNode $jNode $auxN1 $auxN2 $A $matTag <-rho $rho>\n";
	}

	return theElement;
}
void* OPS_FourNodeQuadWithSensitivity()
{
    int ndm = OPS_GetNDM();
    int ndf = OPS_GetNDF();

    if (ndm != 2 || ndf != 2) {
	opserr << "WARNING -- model dimensions and/or nodal DOF not compatible with quad element\n";
	return 0;
    }
    
    if (OPS_GetNumRemainingInputArgs() < 8) {
	opserr << "WARNING insufficient arguments\n";
	opserr << "Want: element FourNodeQuadWithSensitivity eleTag? iNode? jNode? kNode? lNode? thk? type? matTag? <pressure? rho? b1? b2?>\n";
	return 0;
    }

    // FourNodeQuadId, iNode, jNode, kNode, lNode
    int idata[5];
    int num = 5;
    if (OPS_GetIntInput(&num,idata) < 0) {
	opserr<<"WARNING: invalid integer inputs\n";
	return 0;
    }

    double thk = 0.0;
    num = 1;
    if (OPS_GetDoubleInput(&num,&thk) < 0) {
	opserr<<"WARNING: invalid double inputs\n";
	return 0;
    }

    const char* type = OPS_GetString();

    int matTag;
    num = 1;
    if (OPS_GetIntInput(&num,&matTag) < 0) {
	opserr<<"WARNING: invalid matTag\n";
	return 0;
    }

    NDMaterial* mat = OPS_getNDMaterial(matTag);
    if (mat == 0) {
	opserr << "WARNING material not found\n";
	opserr << "Material: " << matTag;
	opserr << "\nFourNodeQuad element: " << idata[0] << endln;
	return 0;
    }

    // p, rho, b1, b2
    double data[4] = {0,0,0,0};
    num = OPS_GetNumRemainingInputArgs();
    if (num > 4) {
	num = 4;
    }
    if (num > 0) {
	if (OPS_GetDoubleInput(&num,data) < 0) {
	    opserr<<"WARNING: invalid integer data\n";
	    return 0;
	}	
    }

    return new FourNodeQuadWithSensitivity(idata[0],idata[1],idata[2],idata[3],idata[4],
					   *mat,type,thk,data[0],data[1],data[2],data[3]);
}
示例#13
0
void* OPS_ElasticBeam2d(const ID &info)
{
    if(OPS_GetNumRemainingInputArgs() < 5) {
	opserr<<"insufficient arguments:eleTag,iNode,jNode,<A,E,Iz>or<sectionTag>,transfTag\n";
	return 0;
    }

    int ndm = OPS_GetNDM();
    int ndf = OPS_GetNDF();
    if(ndm != 2 || ndf != 3) {
	opserr<<"ndm must be 2 and ndf must be 3\n";
	return 0;
    }

    // inputs: 
    int iData[3];
    int numData = 3;
    if(OPS_GetIntInput(&numData,&iData[0]) < 0) {
	opserr<<"WARNING failed to read integers\n";
	return 0;
    }

    bool section = false;
    int sectionTag;
    double data[3];
    if (OPS_GetNumRemainingInputArgs() > 3) {
      // Read A, E, Iz
      numData = 3;
      if(OPS_GetDoubleInput(&numData,&data[0]) < 0) {
	opserr<<"WARNING failed to read doubles\n";
	return 0;
      }
    } else {
      // Read a section tag
      numData = 1;
      if(OPS_GetIntInput(&numData,&sectionTag) < 0) {
	opserr<<"WARNING sectionTag is not integer\n";
	return 0;
      }
      section = true;
    }
    numData = 1;
    int transfTag;
    if(OPS_GetIntInput(&numData,&transfTag) < 0) {
	opserr<<"WARNING transfTag is not integer\n";
	return 0;
    }
    
    // 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 0;
	    }
	} else if(type == "-depth") {
	    if(OPS_GetNumRemainingInputArgs() > 0) {
		if(OPS_GetDoubleInput(&numData,&depth) < 0) return 0;
	    }

	} else if(type == "-mass") {
	    if(OPS_GetNumRemainingInputArgs() > 0) {
		if(OPS_GetDoubleInput(&numData,&mass) < 0) return 0;
	    }
	} else if(type == "-cMass") {
	    cMass = 1;
	}
    }

    // check transf
    CrdTransf* theTransf = OPS_getCrdTransf(transfTag);
    if(theTransf == 0) {
	opserr<<"coord transfomration not found\n";
	return 0;
    }

    if (section) {
      SectionForceDeformation *theSection = OPS_getSectionForceDeformation(sectionTag);
      if (theSection == 0) {
	opserr << "section not found\n";
	return 0;
      }
      return new ElasticBeam2d(iData[0],iData[1],iData[2],*theSection,
			       *theTransf,alpha,depth,mass,cMass);
    } else {
      return new ElasticBeam2d(iData[0],data[0],data[1],data[2],iData[1],iData[2],
			       *theTransf,alpha,depth,mass,cMass);
    }
}
示例#14
0
void* OPS_NineFourNodeQuadUP()
{
    if (OPS_GetNDM() != 2) {
	opserr << "WARNING -- model dimensions not compatible with 9-4-NodeQuadUP element\n";
	return 0;
    }
    if (OPS_GetNumRemainingInputArgs() < 16) {
	opserr << "WARNING insufficient arguments\n";
	opserr << "Want: element FourNodeQuadUP eleTag? Node1? ... Node9? thk? type? matTag? bulk? rho? perm_x? perm_y? <b1? b2? pressure? dM? dK?>\n";
	return 0;
    }

    // NineFourNodeQuadUPId, Node[9]
    int tags[10];
    int num = 10;
    if (OPS_GetIntInput(&num,tags) < 0) {
	opserr<<"WARNING: invalid integer input\n";
	return 0;
    }

    double thk;
    num = 1;
    if (OPS_GetDoubleInput(&num,&thk) < 0) {
	opserr<<"WARNING: invalid double input\n";
	return 0;
    }

    int matTag;
    if (OPS_GetIntInput(&num,&matTag) < 0) {
	opserr<<"WARNING: invalid integer input\n";
	return 0;
    }
    NDMaterial* mat = OPS_getNDMaterial(matTag);
    if (mat == 0) {
	opserr << "WARNING material not found\n";
	opserr << "material tag: " << matTag;
	opserr << "\nQuad element: " << tags[0] << endln;
    }

    // bk, r, perm1, perm2
    double data[4];
    num = 4;
    if (OPS_GetDoubleInput(&num,data) < 0) {
	opserr<<"WARNING: invalid double input\n";
	return 0;
    }

    // b1, b2
    double opt[2] = {0,0};
    num = OPS_GetNumRemainingInputArgs();
    if (num > 2) {
	num = 2;
    }
    if (num > 0) {
	if (OPS_GetDoubleInput(&num,opt) < 0) {
	    opserr<<"WARNING: invalid double input\n";
	    return 0;
	}
    }

    return new NineFourNodeQuadUP(tags[0],tags[1],tags[2],tags[3],tags[4],
				  tags[5],tags[6],tags[7],tags[8],tags[9],
				  *mat,"PlaneStrain",thk,data[0],data[1],data[2],data[3],
				  opt[0],opt[1]);
}
示例#15
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);
    }
}
示例#16
0
void *
OPS_N4BiaxialTruss(void)
{
	Element *theElement = 0;

	int numRemainingArgs = OPS_GetNumRemainingInputArgs();

	if (numRemainingArgs < 7) {
		opserr << "Invalid Args want: element N4BiaxialTruss $tag $i1Node $j1Node $iG2Node $j2Node $A $matTag1 <-rho $rho> <-doRayleigh $flag>\n";
		return 0;	
	}

	int    iData[5]; //tag, iNode, jNode, iGNode, jGNode
	double A = 0.0;
	double rho = 0.0;
	int matTag1 = 0;
	int matTag2 = 0;
	int doRayleigh = 0;
	int ndm = OPS_GetNDM();

	int numData = 5;
	if (OPS_GetInt(&numData, iData) != 0) {
		opserr << "WARNING invalid integer (tag, iNode, jNode, iGNode, jGNode) in element N4BiaxialTruss " << endln;
		return 0;
	}

	numData = 1;
	if (OPS_GetDouble(&numData, &A) != 0) {
		opserr << "WARNING: Invalid A: element N4BiaxialTruss " << iData[0] << 
		" $i1Node $j1Node $iG2Node $j2Node $A $matTag1 <-rho $rho> <-doRayleigh $flag>\n";
		return 0;	
	}

	numData = 1;
	if (OPS_GetInt(&numData, &matTag1) != 0) {
		opserr << "WARNING: Invalid matTag1: element N4BiaxialTruss " << iData[0] << 
		" $i1Node $j1Node $iG2Node $j2Node $A $matTag1 <-rho $rho> <-doRayleigh $flag>\n";
		return 0;
	}

	UniaxialMaterial *theUniaxialMaterial_1 = OPS_GetUniaxialMaterial(matTag1);
	if (theUniaxialMaterial_1 == 0) {
		opserr << "WARNING: Invalid material not found element N4BiaxialTruss " << iData[0] << " $mattag1: " << matTag1 << " \n";
		return 0;
	}

	numRemainingArgs -= 6;
	while (numRemainingArgs > 1) {
		char argvS[15];
		if (OPS_GetString(argvS, 15) != 0) {
			opserr << "WARNING: Invalid optional string element N4BiaxialTruss " << iData[0] << 
		    " $i1Node $j1Node $iG2Node $j2Node $A $matTag1 <-rho $rho> <-doRayleigh $flag>\n";
			return 0;
		} 

		if (strcmp(argvS,"-rho") == 0) {
			numData = 1;
			if (OPS_GetDouble(&numData, &rho) != 0) {
				opserr << "WARNING Invalid rho in element N4BiaxialTruss " << iData[0] << 
				" $i1Node $j1Node $iG2Node $j2Node $A $matTag1 <-rho $rho> <-doRayleigh $flag>\n";
				return 0;
			}
		} else if (strcmp(argvS,"-doRayleigh") == 0) {
			numData = 1;
			if (OPS_GetInt(&numData, &doRayleigh) != 0) {
				opserr << "WARNING: Invalid doRayleigh in element N4BiaxialTruss " << iData[0] << 
				" $i1Node $j1Node $iG2Node $j2Node $A $matTag1 <-rho $rho> <-doRayleigh $flag>\n";
				return 0;
			}
		} else {
			opserr << "WARNING: Invalid option " << argvS << "  in: element N4BiaxialTruss " << iData[0] << 
			" $i1Node $j1Node $iG2Node $j2Node $A $matTag1 <-rho $rho> <-doRayleigh $flag>\n";
			return 0;
		}      
		numRemainingArgs -= 2;
	}

	//now create the ReinforcedConcretePlaneStress
	theElement = new N4BiaxialTruss(iData[0], ndm, iData[1], iData[2], iData[3], iData[4], *theUniaxialMaterial_1, A, rho, doRayleigh);

	if (theElement == 0) {
		opserr << "WARNING: out of memory: element N4BiaxialTruss " << iData[0] << 
		" $i1Node $j1Node $iG2Node $j2Node $A $matTag1 <-rho $rho> <-doRayleigh $flag>\n";
	}

	return theElement;
}
示例#17
0
int TclExpCPCommand(ClientData clientData, Tcl_Interp *interp,
    int argc, TCL_Char **argv, Domain *theDomain)
{
    if (theExperimentalCPs == 0)
        theExperimentalCPs = new ArrayOfTaggedObjects(32);
    
    // make sure there is a minimum number of arguments
    if (argc < 4)  {
        opserr << "WARNING invalid number of arguments\n";
        printCommand(argc,argv);
        opserr << "Want: expControlPoint tag <-node nodeTag> dof rspType <-fact f> <-lim l u> <-isRel> ...\n";
        return TCL_ERROR;
    }
    
    int tag, i, argi = 1;
    int nodeTag = 0, ndf = 0, ndm = 0;
    Node *theNode = 0;
    int numSignals = 0, numLim = 0, numRefType = 0;
    double f, lim;
    ExperimentalCP *theCP = 0;
    
    if (Tcl_GetInt(interp, argv[argi], &tag) != TCL_OK)  {
        opserr << "WARNING invalid expControlPoint tag\n";
        return TCL_ERROR;
    }
    argi++;
    if (strcmp(argv[argi],"-node") == 0)  {
        argi++;
        if (Tcl_GetInt(interp, argv[argi], &nodeTag) != TCL_OK)  {
            opserr << "WARNING invalid nodeTag for control point: " << tag << endln;
            printCommand(argc,argv);
            opserr << "Want: expControlPoint tag <-node nodeTag> dof rspType <-fact f> <-lim l u> <-isRel> ...\n";
            return TCL_ERROR;
        }
        theNode = theDomain->getNode(nodeTag);
        ndf = theNode->getNumberDOF();
        ndm = OPS_GetNDM();
        argi++;
    }
    // count number of signals
    i = argi;
    while (i < argc)  {
        if (strcmp(argv[i],"-fact") == 0 || strcmp(argv[i],"-factor") == 0)
            i += 2;
        else if (strcmp(argv[i],"-isRel") == 0 || strcmp(argv[i],"-isRelative") == 0)
            i++;
        else if (strcmp(argv[i],"-lim") == 0 || strcmp(argv[i],"-limit") == 0)  {
            i += 3;
            numLim++;
        }
        else  {
            i += 2;
            numSignals++;
        }
    }
    if (numSignals == 0)  {
        opserr << "WARNING invalid number of arguments for control point: " << tag << endln;
        printCommand(argc,argv);
        opserr << "Want: expControlPoint tag <-node nodeTag> dof rspType <-fact f> <-lim l u> <-isRel> ...\n";
        return TCL_ERROR;
    }
    if (numLim > 0 && numLim != numSignals)  {
        opserr << "WARNING invalid number of limits for control point: " << tag << endln;
        printCommand(argc,argv);
        opserr << "Want: expControlPoint tag <-node nodeTag> dof rspType <-fact f> <-lim l u> <-isRel> ...\n";
        return TCL_ERROR;
    }
    ID dof(numSignals);
    ID rspType(numSignals);
    Vector factor(numSignals);
    Vector lowerLim(numSignals);
    Vector upperLim(numSignals);
    ID isRelative(numSignals);
    for (i=0; i<numSignals; i++)  {
        if (ndf == 0)  {
            int dofID = 0;
            if (sscanf(argv[argi],"%d",&dofID) != 1)  {
                if (sscanf(argv[argi],"%*[dfouDFOU]%d",&dofID) != 1)  {
                    opserr << "WARNING invalid dof for control point: " << tag << endln;
                    printCommand(argc,argv);
                    opserr << "Want: expControlPoint tag <-node nodeTag> dof rspType <-fact f> <-lim l u> <-isRel> ...\n";
                    return TCL_ERROR;
                }
            }
            dof(i) = dofID - 1;
        }
        else if (ndm == 1 && ndf == 1)  {
            if (strcmp(argv[argi],"1") == 0 || 
                strcmp(argv[argi],"dof1") == 0 || strcmp(argv[argi],"DOF1") == 0 ||
                strcmp(argv[argi],"u1") == 0 || strcmp(argv[argi],"U1") == 0 ||
                strcmp(argv[argi],"ux") == 0 || strcmp(argv[argi],"UX") == 0)
                dof(i) = 0;
            else  {
                opserr << "WARNING invalid dof for control point: " << tag << endln;
                printCommand(argc,argv);
                opserr << "Want: expControlPoint tag <-node nodeTag> dof rspType <-fact f> <-lim l u> <-isRel> ...\n";
                return TCL_ERROR;
            }
        }
        else if (ndm == 2 && ndf == 2)  {
            if (strcmp(argv[argi],"1") == 0 ||
                strcmp(argv[argi],"dof1") == 0 || strcmp(argv[argi],"DOF1") == 0 ||
                strcmp(argv[argi],"u1") == 0 || strcmp(argv[argi],"U1") == 0 ||
                strcmp(argv[argi],"ux") == 0 || strcmp(argv[argi],"UX") == 0)
                dof(i) = 0;
            else if (strcmp(argv[argi],"2") == 0 ||
                strcmp(argv[argi],"dof2") == 0 || strcmp(argv[argi],"DOF2") == 0 ||
                strcmp(argv[argi],"u2") == 0 || strcmp(argv[argi],"U2") == 0 ||
                strcmp(argv[argi],"uy") == 0 || strcmp(argv[argi],"UY") == 0)
                dof(i) = 1;
            else  {
                opserr << "WARNING invalid dof for control point: " << tag << endln;
                printCommand(argc,argv);
                opserr << "Want: expControlPoint tag <-node nodeTag> dof rspType <-fact f> <-lim l u> <-isRel> ...\n";
                return TCL_ERROR;
            }
        }
        else if (ndm == 2 && ndf == 3)  {
            if (strcmp(argv[argi],"1") == 0 ||
                strcmp(argv[argi],"dof1") == 0 || strcmp(argv[argi],"DOF1") == 0 ||
                strcmp(argv[argi],"u1") == 0 || strcmp(argv[argi],"U1") == 0 ||
                strcmp(argv[argi],"ux") == 0 || strcmp(argv[argi],"UX") == 0)
                dof(i) = 0;
            else if (strcmp(argv[argi],"2") == 0 ||
                strcmp(argv[argi],"dof2") == 0 || strcmp(argv[argi],"DOF2") == 0 ||
                strcmp(argv[argi],"u2") == 0 || strcmp(argv[argi],"U2") == 0 ||
                strcmp(argv[argi],"uy") == 0 || strcmp(argv[argi],"UY") == 0)
                dof(i) = 1;
            else if (strcmp(argv[argi],"3") == 0 ||
                strcmp(argv[argi],"dof3") == 0 || strcmp(argv[argi],"DOF3") == 0 ||
                strcmp(argv[argi],"r3") == 0 || strcmp(argv[argi],"R3") == 0 ||
                strcmp(argv[argi],"rz") == 0 || strcmp(argv[argi],"RZ") == 0)
                dof(i) = 2;
            else  {
                opserr << "WARNING invalid dof for control point: " << tag << endln;
                printCommand(argc,argv);
                opserr << "Want: expControlPoint tag <-node nodeTag> dof rspType <-fact f> <-lim l u> <-isRel> ...\n";
                return TCL_ERROR;
            }
        }
        else if (ndm == 3 && ndf == 3)  {
            if (strcmp(argv[argi],"1") == 0 ||
                strcmp(argv[argi],"dof1") == 0 || strcmp(argv[argi],"DOF1") == 0 ||
                strcmp(argv[argi],"u1") == 0 || strcmp(argv[argi],"U1") == 0 ||
                strcmp(argv[argi],"ux") == 0 || strcmp(argv[argi],"UX") == 0)
                dof(i) = 0;
            else if (strcmp(argv[argi],"2") == 0 ||
                strcmp(argv[argi],"dof2") == 0 || strcmp(argv[argi],"DOF2") == 0 ||
                strcmp(argv[argi],"u2") == 0 || strcmp(argv[argi],"U2") == 0 ||
                strcmp(argv[argi],"uy") == 0 || strcmp(argv[argi],"UY") == 0)
                dof(i) = 1;
            else if (strcmp(argv[argi],"3") == 0 ||
                strcmp(argv[argi],"dof3") == 0 || strcmp(argv[argi],"DOF3") == 0 ||
                strcmp(argv[argi],"u3") == 0 || strcmp(argv[argi],"U3") == 0 ||
                strcmp(argv[argi],"uz") == 0 || strcmp(argv[argi],"UZ") == 0)
                dof(i) = 2;
            else  {
                opserr << "WARNING invalid dof for control point: " << tag << endln;
                printCommand(argc,argv);
                opserr << "Want: expControlPoint tag <-node nodeTag> dof rspType <-fact f> <-lim l u> <-isRel> ...\n";
                return TCL_ERROR;
            }
        }
        else if (ndm == 3 && ndf == 6)  {
            if (strcmp(argv[argi],"1") == 0 ||
                strcmp(argv[argi],"dof1") == 0 || strcmp(argv[argi],"DOF1") == 0 ||
                strcmp(argv[argi],"u1") == 0 || strcmp(argv[argi],"U1") == 0 ||
                strcmp(argv[argi],"ux") == 0 || strcmp(argv[argi],"UX") == 0)
                dof(i) = 0;
            else if (strcmp(argv[argi],"2") == 0 ||
                strcmp(argv[argi],"dof2") == 0 || strcmp(argv[argi],"DOF2") == 0 ||
                strcmp(argv[argi],"u2") == 0 || strcmp(argv[argi],"U2") == 0 ||
                strcmp(argv[argi],"uy") == 0 || strcmp(argv[argi],"UY") == 0)
                dof(i) = 1;
            else if (strcmp(argv[argi],"3") == 0 ||
                strcmp(argv[argi],"dof3") == 0 || strcmp(argv[argi],"DOF3") == 0 ||
                strcmp(argv[argi],"u3") == 0 || strcmp(argv[argi],"U3") == 0 ||
                strcmp(argv[argi],"uz") == 0 || strcmp(argv[argi],"UZ") == 0)
                dof(i) = 2;
            else if (strcmp(argv[argi],"4") == 0 ||
                strcmp(argv[argi],"dof4") == 0 || strcmp(argv[argi],"DOF4") == 0 ||
                strcmp(argv[argi],"r1") == 0 || strcmp(argv[argi],"R1") == 0 ||
                strcmp(argv[argi],"rx") == 0 || strcmp(argv[argi],"RX") == 0)
                dof(i) = 3;
            else if (strcmp(argv[argi],"5") == 0 ||
                strcmp(argv[argi],"dof5") == 0 || strcmp(argv[argi],"DOF5") == 0 ||
                strcmp(argv[argi],"r2") == 0 || strcmp(argv[argi],"R2") == 0 ||
                strcmp(argv[argi],"ry") == 0 || strcmp(argv[argi],"RY") == 0)
                dof(i) = 4;
            else if (strcmp(argv[argi],"6") == 0 ||
                strcmp(argv[argi],"dof6") == 0 || strcmp(argv[argi],"DOF6") == 0 ||
                strcmp(argv[argi],"r3") == 0 || strcmp(argv[argi],"R3") == 0 ||
                strcmp(argv[argi],"rz") == 0 || strcmp(argv[argi],"RZ") == 0)
                dof(i) = 5;
            else  {
                opserr << "WARNING invalid dof for control point: " << tag << endln;
                printCommand(argc,argv);
                opserr << "Want: expControlPoint tag <-node nodeTag> dof rspType <-fact f> <-lim l u> <-isRel> ...\n";
               return TCL_ERROR;
            }
        }
        argi++;
        if (strcmp(argv[argi],"1") == 0 || strcmp(argv[argi],"dsp") == 0 ||
            strcmp(argv[argi],"disp") == 0 || strcmp(argv[argi],"displacement") == 0)
            rspType(i) = OF_Resp_Disp;
        else if (strcmp(argv[argi],"2") == 0 || strcmp(argv[argi],"vel") == 0 ||
            strcmp(argv[argi],"velocity") == 0)
            rspType(i) = OF_Resp_Vel;
        else if (strcmp(argv[argi],"3") == 0 || strcmp(argv[argi],"acc") == 0 ||
            strcmp(argv[argi],"accel") == 0 || strcmp(argv[argi],"acceleration") == 0)
            rspType(i) = OF_Resp_Accel;
        else if (strcmp(argv[argi],"4") == 0 || strcmp(argv[argi],"frc") == 0 ||
            strcmp(argv[argi],"force") == 0)
            rspType(i) = OF_Resp_Force;
        else if (strcmp(argv[argi],"5") == 0 ||  strcmp(argv[argi],"t") == 0 ||
            strcmp(argv[argi],"tme") == 0 || strcmp(argv[argi],"time") == 0)
            rspType(i) = OF_Resp_Time;
        else  {
            opserr << "WARNING invalid rspType for control point: " << tag << endln;
            printCommand(argc,argv);
            opserr << "Want: expControlPoint tag <-node nodeTag> dof rspType <-fact f> <-lim l u> <-isRel> ...\n";
            return TCL_ERROR;
        }
        argi++;
        if (argi<argc && (strcmp(argv[argi],"-fact") == 0 || strcmp(argv[argi],"-factor") == 0))  {
            argi++;
            if (Tcl_GetDouble(interp, argv[argi], &f) != TCL_OK)  {
                opserr << "WARNING invalid factor for control point: " << tag << endln;
                printCommand(argc,argv);
                opserr << "Want: expControlPoint tag <-node nodeTag> dof rspType <-fact f> <-lim l u> <-isRel> ...\n";
                return TCL_ERROR;
            }
            factor(i) = f;
            argi++;
        } else  {
            factor(i) = 1.0;
        }
        if (argi<argc && (strcmp(argv[argi],"-lim") == 0 || strcmp(argv[argi],"-limit") == 0))  {
            argi++;
            if (Tcl_GetDouble(interp, argv[argi], &lim) != TCL_OK)  {
                opserr << "WARNING invalid lower limit for control point: " << tag << endln;
                printCommand(argc,argv);
                opserr << "Want: expControlPoint tag <-node nodeTag> dof rspType <-fact f> <-lim l u> <-isRel> ...\n";
                return TCL_ERROR;
            }
            lowerLim(i) = lim;
            argi++;
            if (Tcl_GetDouble(interp, argv[argi], &lim) != TCL_OK)  {
                opserr << "WARNING invalid upper limit for control point: " << tag << endln;
                printCommand(argc,argv);
                opserr << "Want: expControlPoint tag <-node nodeTag> dof rspType <-fact f> <-lim l u> <-isRel> ...\n";
                return TCL_ERROR;
            }
            upperLim(i) = lim;
            argi++;
        }
        if (argi<argc && (strcmp(argv[argi],"-isRel") == 0 || strcmp(argv[argi],"-isRelative") == 0))  {
            isRelative(i) = 1;
            numRefType++;
            argi++;
        }
    }
    
    // parsing was successful, allocate the control point
    theCP = new ExperimentalCP(tag, dof, rspType, factor);
    
    if (theCP == 0)  {
        opserr << "WARNING could not create experimental control point " << argv[1] << endln;
        return TCL_ERROR;
    }
    
    // add limits if available
    if (numLim > 0)
        theCP->setLimits(lowerLim, upperLim);
    
    // add signal reference types if available
    if (numRefType > 0)
        theCP->setSigRefType(isRelative);
    
    // add node if available
    if (theNode != 0)
        theCP->setNode(theNode);
    
    // now add the control point to the modelBuilder
    if (addExperimentalCP(*theCP) < 0)  {
        delete theCP; // invoke the destructor, otherwise mem leak
        return TCL_ERROR;
    }
    
    return TCL_OK;
}
示例#18
0
void* OPS_ElasticBeam3d(void)
{
    int numArgs = OPS_GetNumRemainingInputArgs();
    if(numArgs < 10 && numArgs != 5) {
	opserr<<"insufficient arguments:eleTag,iNode,jNode,A,E,G,J,Iy,Iz,transfTag\n";
	return 0;
    }

    int ndm = OPS_GetNDM();
    int ndf = OPS_GetNDF();
    if(ndm != 3 || ndf != 6) {
	opserr<<"ndm must be 3 and ndf must be 6\n";
	return 0;
    }

    // inputs: 
    int iData[3];
    int numData = 3;
    if(OPS_GetIntInput(&numData,&iData[0]) < 0) return 0;

    SectionForceDeformation* theSection = 0;
    CrdTransf* theTrans = 0;
    double data[6];
    int transfTag, secTag;

    if(numArgs == 5) {
	numData = 1;
	if(OPS_GetIntInput(&numData,&secTag) < 0) return 0;
	if(OPS_GetIntInput(&numData,&transfTag) < 0) return 0;

	theSection = OPS_getSectionForceDeformation(secTag);
	if(theSection == 0) {
	    opserr<<"no section is found\n";
	    return 0;
	}
	theTrans = OPS_getCrdTransf(transfTag);
	if(theTrans == 0) {
	    opserr<<"no CrdTransf is found\n";
	    return 0;
	}
    } else {
	numData = 6;
	if(OPS_GetDoubleInput(&numData,&data[0]) < 0) return 0;
	numData = 1;
	if(OPS_GetIntInput(&numData,&transfTag) < 0) return 0;
	theTrans = OPS_getCrdTransf(transfTag);
	if(theTrans == 0) {
	    opserr<<"no CrdTransf is found\n";
	    return 0;
	}
    }
    
    // options
    double mass = 0.0;
    int cMass = 0;
    while(OPS_GetNumRemainingInputArgs() > 0) {
	std::string theType = OPS_GetString();
	if (theType == "-mass") {
	    if(OPS_GetNumRemainingInputArgs() > 0) {
		if(OPS_GetDoubleInput(&numData,&mass) < 0) return 0;
	    }
	} else if (theType == "-cMass") {
	    cMass = 1;
	}
    }

    if (theSection != 0) {
	return new ElasticBeam3d(iData[0],iData[1],iData[2],theSection,*theTrans,mass,cMass); 
    } else {
	return new ElasticBeam3d(iData[0],data[0],data[1],data[2],data[3],data[4],
				 data[5],iData[1],iData[2],*theTrans, mass,cMass);
    }
}
示例#19
0
int
Mesh::setEleArgs()
{
    // no elements
    if (OPS_GetNumRemainingInputArgs() < 1) {
        eleType = 0;
        return 0;
    }

    // get type and set info
    const char* type = OPS_GetString();
    int ndm = OPS_GetNDM();
    ID info(2);
    info(0) = 1; //save data
    info(1) = this->getTag();

    if (strcmp(type, "elasticBeamColumn") == 0) {
        if (ndm == 2) {
            eleType = ELE_TAG_ElasticBeam2d;
            if (OPS_ElasticBeam2d(info) == 0) {
                opserr << "WARNING: failed to read eleArgs\n";
                return -1;
            }
	    numelenodes = 2;
        }

    } else if(strcmp(type, "forceBeamColumn") == 0) {
        if (ndm == 2) {
            eleType = ELE_TAG_ForceBeamColumn2d;
            if (OPS_ForceBeamColumn2d(info) == 0) {
                opserr << "WARNING: failed to read eleArgs\n";
                return -1;
            }
	    numelenodes = 2;
        }

    } else if(strcmp(type, "dispBeamColumn") == 0) {
        if (ndm == 2) {
            eleType = ELE_TAG_DispBeamColumn2d;
            if (OPS_DispBeamColumn2d(info) == 0) {
                opserr << "WARNING: failed to read eleArgs\n";
                return -1;
            }
	    numelenodes = 2;
        }

    } else if(strcmp(type, "PFEMElementBubble") == 0) {
        if (ndm == 2) {
            eleType = ELE_TAG_PFEMElement2DBubble;
            if (OPS_PFEMElement2DBubble(info) == 0) {
                opserr << "WARNING: failed to read eleArgs\n";
                return -1;
            }
            fluid = true;
	    numelenodes = 3;
	    
        } else {
	    eleType = ELE_TAG_PFEMElement3DBubble;
            if (OPS_PFEMElement3DBubble(info) == 0) {
                opserr << "WARNING: failed to read eleArgs\n";
                return -1;
            }
            fluid = true;
	    numelenodes = 4;
	}

    } else if(strcmp(type, "MINI") == 0) {
        if (ndm == 2) {
            eleType = ELE_TAG_PFEMElement2Dmini;
            if (OPS_PFEMElement2Dmini(info) == 0) {
                opserr << "WARNING: failed to read eleArgs\n";
                return -1;
            }
            fluid = true;
	    numelenodes = 3;
        }

    } else if(strcmp(type, "PFEMElementCompressible") == 0) {
        if (ndm == 2) {
            eleType = ELE_TAG_PFEMElement2DCompressible;
            if (OPS_PFEMElement2DCompressible(info) == 0) {
                opserr << "WARNING: failed to read eleArgs\n";
                return -1;
            }
            fluid = true;
	    numelenodes = 3;
        }

    } else if(strcmp(type, "tri31") == 0) {
        eleType = ELE_TAG_Tri31;
        if (OPS_Tri31(info) == 0) {
            opserr << "WARNING: failed to read eleArgs\n";
            return -1;
        }
	numelenodes = 3;

    } else if(strcmp(type, "FourNodeTetrahedron") == 0) {
        eleType = ELE_TAG_FourNodeTetrahedron;
        if (OPS_FourNodeTetrahedron(info) == 0) {
            opserr << "WARNING: failed to read eleArgs\n";
            return -1;
        }
	numelenodes = 4;
    } else if (strcmp(type, "ShellMITC4") == 0) {
	eleType = ELE_TAG_ShellMITC4;
        if (OPS_ShellMITC4(info) == 0) {
            opserr << "WARNING: failed to read eleArgs\n";
            return -1;
        }
	numelenodes = 4;
	
    } else {
        opserr << "WARNING: element "<<type<<" is not currently supported in mesh\n";
        return -1;
    }

    return 0;
}
示例#20
0
void *
OPS_TFP_Bearing()
{
  // print out a message about who wrote this element & any copyright info wanted
  if (numMyBearing == 0) {
    opserr << "TFP_Bearing element - Written by Tracy Becker, UC Berkeley Copyright 2011\n";
    numMyBearing++;
  }

  Element *theEle = 0;

  int numRemainingArgs = OPS_GetNumRemainingInputArgs();
  if (numRemainingArgs == 0) { // parallel processing
    theEle = new TFP_Bearing();
    return theEle;
  }

  if (numRemainingArgs != 25 && numRemainingArgs != 24 && numRemainingArgs != 26 != numRemainingArgs != 27) {
    opserr << "ERROR - TFP_Bearing incorrect # args provided, want: element TFP_Bearing tag? iNode? jNode? ";
    opserr << "$R1 $R2 $R3 $R4 $do1 $do2 $do3 $do4 $din1 $din2 $din3 $din4 $mu1 $mu2 $mu3 $mu4";
    opserr << " $h1 $h2 $h3 $h4 $H0 <$a> <$K>\n";
    return theEle;
  }

  // get the id and end nodes 
  int iData[3];
  double dData[24];
  int numData;

  numData = 3;
  if (OPS_GetIntInput(&numData, iData) != 0) {
    opserr << "WARNING invalid element data\n";
    return 0;
  }

  int eleTag = iData[0];

  if (numRemainingArgs == 24) {
    numData = 21;
    dData[21] = 10.0; // initial Axial Load = 0.0
    dData[22] = 1.0e12;
    dData[23] = 0.01;
  } else if (numRemainingArgs == 25) {
    numData = 22;
    dData[22] = 1.0e12;    
    dData[23] = 0.01;
  } else if (numRemainingArgs == 26) {
    numData = 23;
    dData[22] = 1.0e12;
  } else {
    numData = 24;
  }

  if (OPS_GetDoubleInput(&numData, dData) != 0) {
    opserr << "WARNING error reading element area for element" << eleTag << endln;
    return 0;
  }

  // now create the truss and add it to the Domain
  int ndm = OPS_GetNDM();
  if (ndm == 3) {
    theEle = new TFP_Bearing(eleTag, 
			     iData[1], 
			     iData[2], 
			     &dData[0],
			     &dData[4],
			     &dData[8],
			     &dData[12],
			     &dData[16],
			     dData[20],
			     dData[21],
			     dData[23],
			     dData[22]);
  } else {
    theEle = new TFP_Bearing2d(eleTag, 
			       iData[1], 
			       iData[2], 
			       &dData[0],
			       &dData[4],
			       &dData[8],
			       &dData[12],
			       &dData[16],
			       dData[20],
			       dData[21],
			       dData[23],
			       dData[22]);
  }
    
  if (theEle == 0) {
    opserr << "WARNING ran out of memory creating element with tag " << eleTag << endln;
    return 0;
  }

  return theEle;
}
示例#21
0
int
TetMesh::remesh(double alpha)
{
    int ndm = OPS_GetNDM();
    if (ndm != 3) {
	opserr << "WARNING: TetMesh::remesh is only for 3D problem\n";
	return -1;
    }
    Domain* domain = OPS_GetDomain();
    if (domain == 0) {
        opserr << "WARNING: domain is not created\n";
        return -1;
    }

    // get all nodes
    std::map<int, std::vector<int> > ndinfo;
    TaggedObjectIter& meshes = OPS_getAllMesh();
    ID nodetags;
    Mesh* msh = 0;
    while((msh = dynamic_cast<Mesh*>(meshes())) != 0) {

        int id = msh->getID();
        int mtag = msh->getTag();

        if (id == 0) continue;

        // get bound nodes
        const ID& tags = msh->getNodeTags();
        for (int i=0; i<tags.Size(); ++i) {
            std::vector<int>& info = ndinfo[tags(i)];
            info.push_back(mtag);
            info.push_back(id);
            nodetags.insert(tags(i));
        }

        // get internal nodes
        const ID& newtags = msh->getNewNodeTags();
        for (int i=0; i<newtags.Size(); ++i) {
            std::vector<int>& info = ndinfo[newtags(i)];
            info.push_back(mtag);
            info.push_back(id);
            nodetags.insert(newtags(i));
        }
    }

    if (nodetags.Size() == 0) return 0;

    // calling mesh generator
    TetMeshGenerator gen;
    int nodecounter = nextNodeTag();
    for(int i=0; i<nodetags.Size(); ++i) {

        // get node
        Node* theNode = domain->getNode(nodetags(i));
        if(theNode == 0) {
            opserr<<"WARNING: node "<<nodetags(i)<<" is not defined\n";
            return -1;
        }
        const Vector& crds = theNode->getCrds();
        const Vector& disp = theNode->getTrialDisp();
        if(crds.Size() < ndm || disp.Size() < ndm) {
            opserr<<"WARNING: ndm < 3 or ndf < 3\n";
            return -1;
        }

	// create pc if not
	Pressure_Constraint* thePC = domain->getPressure_Constraint(nodetags(i));
	if(thePC != 0) {
	    thePC->setDomain(domain);
	} else {

	    // create pressure node
	    Node* pnode = 0;
	    pnode = new Node(nodecounter++, 1, crds(0), crds(1), crds(2));
	    if (pnode == 0) {
		opserr << "WARNING: run out of memory -- BgMesh::gridNodes\n";
		return -1;
	    }
	    if (domain->addNode(pnode) == false) {
		opserr << "WARNING: failed to add node to domain -- BgMesh::gridNodes\n";
		delete pnode;
		return -1;
	    }

	    thePC = new Pressure_Constraint(nodetags(i), pnode->getTag());
	    if(thePC == 0) {
		opserr<<"WARNING: no enough memory for Pressure_Constraint\n";
		return -1;
	    }
	    if (domain->addPressure_Constraint(thePC) == false) {
		opserr << "WARNING: failed to add PC to domain -- BgMesh::gridNodes\n";
		delete thePC;
		return -1;
	    }
	}

        // add point
        gen.addPoint(crds(0)+disp(0), crds(1)+disp(1), crds(2)+disp(2), 0);
    }

    // meshing
    gen.remesh(alpha);

    // get elenodes
    std::map<int,ID> meshelenodes;
    for(int i=0; i<gen.getNumTets(); i++) {

        // get points
        int p1,p2,p3,p4;
        gen.getTet(i,p1,p2,p3,p4);

        // get nodes
        int nds[4];
        nds[0] = nodetags(p1);
        nds[1] = nodetags(p2);
        nds[2] = nodetags(p3);
	nds[3] = nodetags(p4);

        // check if all nodes in same mesh
        std::vector<int>& info1 = ndinfo[nds[0]];
        int mtag = 0, id = 0;
        bool same = false;
        for (int k=0; k<(int)info1.size()/2; ++k) {
            // check if any mesh of node 1 is same for another three nodes
            mtag = info1[2*k];
            id = info1[2*k+1];

            int num = 0;
            for (int j=1; j<4; ++j) {
                std::vector<int>& infoj = ndinfo[nds[j]];
                for (int kj=0; kj<(int)infoj.size()/2; ++kj) {
                    int mtagj = infoj[2*kj];
                    if (mtag == mtagj) {
                        ++num;
                        break;
                    }
                }

            }
            if (num == 3) {
                same = true;
                break;
            }
        }

        // nodes in different mesh
        if (!same) {
            mtag = 0;
            id = 0;
            for (int j=0; j<4; ++j) {
                std::vector<int>& info = ndinfo[nds[j]];
                for (int k=0; k<(int)info.size()/2; ++k) {
                    if (info[2*k+1] < id) {
                        if (dynamic_cast<TetMesh*>(OPS_getMesh(info[2*k])) != 0) {
                            mtag = info[2*k];
                            id = info[2*k+1];
                        }
                    }
                }
            }
        }

        // if all connected to structure
        if (id >= 0) continue;

        // add elenodes to its mesh
        ID& elenodes = meshelenodes[mtag];
        for (int j=0; j<4; ++j) {
            elenodes[elenodes.Size()] = nds[j];
        }
    }

    // creat elements
    for (std::map<int,ID>::iterator it=meshelenodes.begin();
	 it!=meshelenodes.end(); ++it) {

        int mtag = it->first;
        ID& elenodes = it->second;

        msh = OPS_getMesh(mtag);
        if (msh != 0) {

            int id = msh->getID();

            // remove mesh for id<0
            if (id < 0) {
                if (msh->clearEles() < 0) {
                    opserr << "WARNING: failed to clear element in mesh"<<mtag<<"\n";
                    return -1;
                }

                if (msh->newElements(elenodes) < 0) {
                    opserr << "WARNING: failed to create new elements in mesh"<<mtag<<"\n";
                    return -1;
                }
            }
        }
    }

    return 0;
}
示例#22
0
void* OPS_YamamotoBiaxialHDR()
{
    // 3-dim, 6-dof
    int ndm = OPS_GetNDM();
    int ndf = OPS_GetNDF();

    if (ndm != 3 || ndf != 6) {
	opserr << "ndm=" << ndm << ", ndf=" << ndf << endln;
	opserr << "WARNING YamamotoBiaxialHDR command only works when ndm is 3 and ndf is 6" << endln;
	return 0;
    }


    //arguments (necessary)
    int eleTag;
    int iNode;
    int jNode;

    int Tp = 1;
    double DDo;
    double DDi;
    double Hr;

    //arguments (optional)
    double Cr=1.0;
    double Cs=1.0;
    Vector oriX(0);
    Vector oriYp(3); oriYp(0) = 0.0; oriYp(1) = 1.0; oriYp(2) = 0.0;
    double mass = 0.0;


    //
    Element *theElement = 0;


    //error flag
    bool ifNoError = true;

    // 
    int numdata = 1;

    if (OPS_GetNumRemainingInputArgs() < 7)  {
        // element YamamotoBiaxialHDR eleTag? iNode? jNode? Tp? DDo? DDi? Hr?
	// argc =            1           2             3      4      5     6   7    8    9
	// argv =       argv[0]      argv[1]      argv[2]  argv[3] ................. argv[8]
	opserr << "WARNING insufficient arguments\n";
	ifNoError = false;
	
    } else {


	//argv[2~8]
	if (OPS_GetIntInput(&numdata, &eleTag) < 0) {
	    opserr << "WARNING invalid YamamotoBiaxialHDR eleTag\n";
	    ifNoError = false;
	}

	// iNode
	if (OPS_GetIntInput(&numdata, &iNode) < 0) {
	    opserr << "WARNING invalid iNode\n";
	    ifNoError = false;
	}

	// jNode
	if (OPS_GetIntInput(&numdata, &jNode) < 0) {
	    opserr << "WARNING invalid jNode\n";
	    ifNoError = false;
	}

	// Tp
	const char* tparg = OPS_GetString();
	if (strcmp(tparg,"1") == 0) {
	    Tp = 1; // Bridgestone X0.6R (EESD version)
	} else {
	    opserr << "WARNING invalid YamamotoBiaxialHDR Tp" << endln;
	    ifNoError = false;
	}

	// DDo
	if (OPS_GetDoubleInput(&numdata, &DDo) < 0 || DDo <= 0.0) {
	    opserr << "WARNING invalid YamamotoBiaxialHDR DDo" << endln;
	    ifNoError = false;
	}

	// DDi
	if (OPS_GetDoubleInput(&numdata, &DDi) < 0 || DDi < 0.0) {
	    opserr << "WARNING invalid YamamotoBiaxialHDR DDi" << endln;
	    ifNoError = false;
	}

	// Hr
	if (OPS_GetDoubleInput(&numdata, &Hr) < 0 || Hr <= 0.0) {
	    opserr << "WARNING invalid YamamotoBiaxialHDR Hr" << endln;
	    ifNoError = false;
	}

	// check print--------------------------------------------/
	//  opserr << "   \n";
	//  opserr << "TclModelBuilder_addYamamotoBiaxialHDR()\n";
	//  opserr << "  tp  = " << Tp << endln;
	//  opserr << "  ddo = " << DDo << endln;
	//  opserr << "  ddi = " << DDi << endln;
	//  opserr << "  hr  = " << Hr << endln;
	//------------------------------------------------------

	// argv[9~]
	while (OPS_GetNumRemainingInputArgs() > 0) {
	    double value;
	    const char* flag = OPS_GetString();
	    if (strcmp(flag,"-orient")==0 && OPS_GetNumRemainingInputArgs() >= 6) { // <-orient x1? x2? x3? yp1? yp2? yp3?>

		oriX.resize(3);

		// x1, x2, x3
		for (int j=1; j<=3; j++) {
		    if (OPS_GetDoubleInput(&numdata, &value) < 0) {
			opserr << "WARNING invalid -orient value\n";
			ifNoError = false;
		    } else {
			oriX(j-1) = value;
		    }
		}
	
		// yp1, yp2, yp3
		for (int j=1; j<=3; j++) {
		    if (OPS_GetDoubleInput(&numdata, &value) < 0) {
			opserr << "WARNING invalid -orient value\n";
			ifNoError = false;
		    } else {
			oriYp(j-1) = value;
		    }
		}
	
	    } else if (strcmp(flag,"-orient")==0 && OPS_GetNumRemainingInputArgs() >= 3) { // <-orient yp1? yp2? yp3?>
	
		for (int j=1; j<=3; j++) {
		    if (OPS_GetDoubleInput(&numdata, &value) < 0) {
			opserr << "WARNING invalid -orient value\n";
			ifNoError = false;
		    } else {
			oriYp(j-1) = value;
		    }
		}
	
	    } else if (strcmp(flag,"-mass")==0 && OPS_GetNumRemainingInputArgs()>0) { // <-mass m?>

		if (OPS_GetDoubleInput(&numdata, &mass) < 0 || mass <= 0) {
		    opserr << "WARNING invalid mass\n";
		    ifNoError = false;
		}

	    } else if (strcmp(flag,"-coRS")==0 && OPS_GetNumRemainingInputArgs()>=2) { // <-coRS cr? cs?>
		if (OPS_GetDoubleInput(&numdata, &Cr) < 0 || Cr <= 0) {
		    opserr << "WARNING invalid cr\n";
		    ifNoError = false;
		}
		if (OPS_GetDoubleInput(&numdata, &Cs) < 0 || Cs <= 0) {
		    opserr << "WARNING invalid cs\n";
		    ifNoError = false;
		}

	    } else {
	
		opserr << "WARNING invalid optional arguments \n";
		ifNoError = false;
		break;
	
	    }
	}

    } //end input

  
    //if error detected
    if (!ifNoError) {
	//input:
	//want:
	opserr << "Want: element YamamotoBiaxialHDR eleTag? iNode? jNode? Tp? DDo? DDi? Hr?  <-coRS cr? cs?> <-orient <x1? x2? x3?> y1? y2? y3?> <-mass m?>\n";
	return 0;
    }
  

    // now create the YamamotoBiaxialHDR
    theElement = new YamamotoBiaxialHDR(eleTag, iNode, jNode, Tp, DDo, DDi, Hr, Cr, Cs, oriYp, oriX, mass);
  
    // if get here we have successfully created the YamamotoBiaxialHDR and added it to the domain
    return theElement;
}
示例#23
0
OPS_Export void *
OPS_NewTrussElement()
{
  Element *theElement = 0;

  int numRemainingArgs = OPS_GetNumRemainingInputArgs();

  if (numRemainingArgs < 4) {
    opserr << "Invalid Args want: element Truss $tag $iNode $jNode $sectTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
    opserr << " or: element Truss $tag $iNode $jNode $A $matTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
    return 0;	
  }

  if (numRemainingArgs == 4 || numRemainingArgs == 6 || numRemainingArgs == 8 || numRemainingArgs == 10)
    return 0; // it's a TrussSection

  int iData[3];
  double A = 0.0;
  double rho = 0.0;
  int matTag = 0;
  int doRayleigh = 0; // by default rayleigh not done
  int cMass = 0; // by default use lumped mass matrix
  int ndm = OPS_GetNDM();

  int numData = 3;
  if (OPS_GetInt(&numData, iData) != 0) {
    opserr << "WARNING invalid integer (tag, iNode, jNode) in element Truss " << endln;
    return 0;
  }

  numData = 1;
  if (OPS_GetDouble(&numData, &A) != 0) {
    opserr << "WARNING: Invalid A: element Truss " << iData[0] << 
      " $iNode $jNode $A $matTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
    return 0;	
  }

  numData = 1;
  if (OPS_GetInt(&numData, &matTag) != 0) {
    opserr << "WARNING: Invalid matTag: element Truss " << iData[0] << 
      " $iNode $jNode $A $matTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
    return 0;
  }

  UniaxialMaterial *theUniaxialMaterial = OPS_GetUniaxialMaterial(matTag);
    
  if (theUniaxialMaterial == 0) {
    opserr << "WARNING: Invalid material not found element Truss " << iData[0] << " $iNode $jNode $A " << 
      matTag << " <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
    return 0;
  }
  
  numRemainingArgs -= 5;
  while (numRemainingArgs > 1) {
    char argvS[15];
    if (OPS_GetString(argvS, 15) != 0) {
      opserr << "WARNING: Invalid optional string element Truss " << iData[0] << 
	" $iNode $jNode $A $matTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
      return 0;
    } 
  
    if (strcmp(argvS,"-rho") == 0) {
      numData = 1;
      if (OPS_GetDouble(&numData, &rho) != 0) {
	opserr << "WARNING Invalid rho in element Truss " << iData[0] << 
	  " $iNode $jNode $A $matTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
	return 0;
      }
    } else if (strcmp(argvS,"-cMass") == 0) {
      numData = 1;
      if (OPS_GetInt(&numData, &cMass) != 0) {
	opserr << "WARNING: Invalid cMass in element Truss " << iData[0] << 
	  " $iNode $jNode $A $matTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
	return 0;
      }
    } else if (strcmp(argvS,"-doRayleigh") == 0) {
      numData = 1;
      if (OPS_GetInt(&numData, &doRayleigh) != 0) {
	opserr << "WARNING: Invalid doRayleigh in element Truss " << iData[0] << 
	  " $iNode $jNode $A $matTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
	return 0;
      }
    } else {
      opserr << "WARNING: Invalid option " << argvS << "  in: element Truss " << iData[0] << 
	" $iNode $jNode $A $matTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
      return 0;
    }      
    numRemainingArgs -= 2;
  }

  // now create the Truss
  theElement = new Truss(iData[0], ndm, iData[1], iData[2], *theUniaxialMaterial, A, rho, doRayleigh, cMass);

  if (theElement == 0) {
    opserr << "WARNING: out of memory: element Truss " << iData[0] << 
      " $iNode $jNode $A $matTag <-rho $rho> <-cMass $flag> <-doRayleigh $flag>\n";
  }

  return theElement;
}