Exemplo n.º 1
0
Mesh::Mesh(int tag, int numelends)
    :TaggedObject(tag), meshsize(0.0),
     id(0), ndf(OPS_GetNDF()), numelenodes(numelends),
     ndtags(), newndtags(), eletags(), elenodes(),
     eleType(0), fluid(false)
{
}
Exemplo n.º 2
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_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;
    }
}
Exemplo n.º 4
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;
       
}
Exemplo n.º 5
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);
}
Exemplo n.º 6
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;
}
Exemplo n.º 7
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);
    }
}
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]);
}
Exemplo n.º 9
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);
    }
}