Ejemplo n.º 1
0
void* OPS_CTestNormDispIncr()
{
    if(OPS_GetNumRemainingInputArgs() < 2) {
	opserr<<"insufficient number of arguments\n";
	return 0;
    }

    // tolerance
    double tol = 1e-6;
    int numData = 1;
    if(OPS_GetDoubleInput(&numData,&tol) < 0) return 0;

    // maxIter
    numData = OPS_GetNumRemainingInputArgs();
    if(numData > 3) numData = 3;
    int data[3] = {0,0,2};
    if(OPS_GetIntInput(&numData,&data[0]) < 0) return 0;

    // maxTol
    double maxTol = OPS_MAXTOL;
    if(OPS_GetNumRemainingInputArgs() > 0) {
	numData = 1;
	if(OPS_GetDoubleInput(&numData,&maxTol) < 0) return 0;
    }
    
    // create test
    return new CTestNormDispIncr(tol,data[0],data[1],data[2],maxTol);
}
Ejemplo n.º 2
0
void* OPS_PDeltaCrdTransf2d()
{
    if(OPS_GetNumRemainingInputArgs() < 1) {
	opserr<<"insufficient arguments for PDeltaCrdTransf2d\n";
	return 0;
    }

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

    // get option
    Vector jntOffsetI(2), jntOffsetJ(2);
    double *iptr=&jntOffsetI(0), *jptr=&jntOffsetJ(0);
    while(OPS_GetNumRemainingInputArgs() > 4) {
	std::string type = OPS_GetString();
	if(type == "-jntOffset") {
	    numData = 2;
	    if(OPS_GetDoubleInput(&numData,iptr) < 0) return 0;
	    if(OPS_GetDoubleInput(&numData,jptr) < 0) return 0;
	}
    }

    return new PDeltaCrdTransf2d(tag,jntOffsetI,jntOffsetJ);
}
Ejemplo n.º 3
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);
}
Ejemplo n.º 4
0
void* OPS_UniformExcitationPattern()
{
    TimeSeries* accelSeries = 0;
    TimeSeries* velSeries = 0;
    TimeSeries* dispSeries = 0;
    TimeSeriesIntegrator* seriesIntegrator = 0;
    double fact = 1.0;
    double vel0 = 0.0;
    int iData[2];

    if(OPS_GetNumRemainingInputArgs() < 2) {
	opserr<<"insufficient number of args\n";
	return 0;
    }
    
    // get tag and direction
    int numData = 2;
    if(OPS_GetIntInput(&numData,&iData[0]) < 0) return 0;
    iData[1]--; // subtract 1 for c indexing

    // get options
    numData = 1;
    while(OPS_GetNumRemainingInputArgs() > 1) {
	std::string type = OPS_GetString();
	if(type == "-accel"||type == "-acceleration") {
	    int tstag;
	    if(OPS_GetIntInput(&numData,&tstag) < 0) return 0;
	    accelSeries = OPS_getTimeSeries(tstag);
	} else if(type == "-vel"||type == "-velocity") {
	    int tstag;
	    if(OPS_GetIntInput(&numData,&tstag) < 0) return 0;
	    velSeries = OPS_getTimeSeries(tstag);
	} else if(type == "-disp"||type == "-displacement") {
	    int tstag;
	    if(OPS_GetIntInput(&numData,&tstag) < 0) return 0;
	    dispSeries = OPS_getTimeSeries(tstag);
	} else if(type == "-fact"||type == "-factor") {
	    if(OPS_GetDoubleInput(&numData,&fact) < 0) return 0;
	} else if(type == "-vel0"||type == "-initialVel") {
	    if(OPS_GetDoubleInput(&numData,&vel0) < 0) return 0;
	}
    }

    // create groundmotion
    if(accelSeries==0&&dispSeries==0&&velSeries==0) {
	opserr<<"no time series is specified\n";
	return 0;
    }

    GroundMotion* theMotion = new GroundMotion(dispSeries,velSeries,accelSeries,seriesIntegrator);
    if(theMotion == 0) {
	opserr << "WARNING ran out of memory creating ground motion - pattern UniformExcitation\n";
	return 0;
    }

    //
    return new UniformExcitation(*theMotion,iData[1],iData[0],vel0,fact);
}
Ejemplo n.º 5
0
void *
OPS_ElasticMaterial(void)
{
  // Pointer to a uniaxial material that will be returned
  UniaxialMaterial *theMaterial = 0;

  if (OPS_GetNumRemainingInputArgs() < 2) {
    opserr << "Invalid #args,  want: uniaxialMaterial Elastic tag? E? <eta?> <Eneg?> ... " << endln;
    return 0;
  }
  
  int iData[1];
  double dData[3];
  int numData = 1;
  if (OPS_GetIntInput(&numData, iData) != 0) {
    opserr << "WARNING invalid tag for uniaxialMaterial Elastic" << endln;
    return 0;
  }

  numData = OPS_GetNumRemainingInputArgs();

  if (numData >= 3) {
    numData = 3;
    if (OPS_GetDoubleInput(&numData, dData) != 0) {
      opserr << "Invalid data for uniaxial Elastic " << iData[0] << endln;
      return 0;	
    }
  } else if (numData >= 2) {
    numData = 2;
    if (OPS_GetDoubleInput(&numData, dData) != 0) {
      opserr << "Invalid data for uniaxial Elastic " << iData[0] << endln;
      return 0;
    }
    dData[2] = dData[0];
  } else {
    numData = 1;
    if (OPS_GetDoubleInput(&numData, dData) != 0) {
      opserr << "Invalid data for uniaxialMaterial Elastic " << iData[0] << endln;
      return 0;	
    }
    dData[1] = 0.0;
    dData[2] = dData[0];
  }

  // Parsing was successful, allocate the material
  theMaterial = new ElasticMaterial(iData[0], dData[0], dData[1], dData[2]);
  if (theMaterial == 0) {
    opserr << "WARNING could not create uniaxialMaterial of type ElasticMaterial\n";
    return 0;
  }

  return theMaterial;
}
Ejemplo n.º 6
0
void* OPS_NDFiber2d()
{
    if(OPS_GetNumRemainingInputArgs() < 4) {
	opserr<<"insufficient arguments for NDFiber2d\n";
	return 0;
    }

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

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

    // get material
    NDMaterial* theMat = OPS_getNDMaterial(tag);
    if(theMat == 0) {
	opserr<<"invalid NDMaterial tag\n";
	return 0;
    }

    return new NDFiber2d(numNDFiber2d++,*theMat,data[2],data[0]);
}
int OPS_setStrain()
{
    if (OPS_GetNumRemainingInputArgs() != 1) {
	opserr<<"testUniaxialMaterial - You must provide a strain value.\n";
	return -1;
    }

    UniaxialMaterial* material = theTestingUniaxialMaterial;

    if (material == 0) {
	opserr<<"setStrain WARNING no active UniaxialMaterial - use testUniaxialMaterial command.\n";
	return -1;
    }

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

    material->setTrialStrain(strain);
    material->commitState();

    return 0;
}
void* OPS_ElasticMembranePlateSection()
{
    if (OPS_GetNumRemainingInputArgs() < 4) {
	opserr << "WARNING insufficient arguments\n";
	opserr << "Want: section ElasticMembranePlateSection tag? E? nu? h? <rho?>\n";
	return 0;
    }

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

    double data[4] = {0,0,0,0.0};
    numdata = OPS_GetNumRemainingInputArgs();
    if (numdata > 4) numdata = 4;
    if (OPS_GetDoubleInput(&numdata, data) < 0) {
	opserr << "WARNING invalid double values\n";
	return 0;
    }

    return new ElasticMembranePlateSection(tag,data[0],data[1],data[2],data[3]);
}
void* OPS_InterpolatedGroundMotion(MultiSupportPattern& thePattern)
{
    int numArgs = OPS_GetNumRemainingInputArgs();
    int numMotions = (numArgs-1)/2;
    GroundMotion* motions[numMotions];

    // get ground motion tags
    int gmTags[numMotions];
    if(OPS_GetIntInput(&numMotions,&gmTags[0]) < 0) return 0;

    // get factors
    Vector facts(numMotions);
    double* fact_ptr = &facts(0);
    std::string type = OPS_GetString();
    if(type == "-fact") {
	if(OPS_GetDoubleInput(&numMotions,fact_ptr) < 0) return 0;
    }

    // get ground motions
    for(int i=0; i<numMotions; i++) {
	motions[i] = thePattern.getMotion(gmTags[i]);
	if(motions[i] == 0) {
	    opserr<<"ground motion "<<gmTags[i]<<" is not found\n";
	    return 0;
	}
    }

    return new InterpolatedGroundMotion(motions,facts,false);
}
void* OPS_ElasticWarpingShearSection2d()
{
    if (OPS_GetNumRemainingInputArgs() < 9) {
	opserr << "WARNING insufficient arguments\n";
	opserr << "Want: section ElasticWarpingShear tag? E? A? Iz? G? alpha? J? B? C?>" << endln;
	return 0;
    }
	
    int tag;
    int numdata = 1;
    if (OPS_GetIntInput(&numdata, &tag) < 0) {
	opserr << "WARNING invalid section ElasticWarpingShearSection2d tag" << endln;
	return 0;
    }

    numdata = 8;
    double data[8];
    if (OPS_GetDoubleInput(&numdata, data) < 0) {
	opserr << "WARNING invalid double inputs" << endln;
	opserr << "ElasticWarpingShearSection2d section: " << tag << endln;	    
	return 0;
    }
    double E = data[0];
    double A = data[1];
    double Iz = data[2];
    double G = data[3];
    double alpha = data[4];
    double J = data[5];
    double B = data[6];
    double C = data[7];
      
    return new ElasticWarpingShearSection2d(tag, E, A, Iz, G, alpha, J, B, C);

}
Ejemplo n.º 11
0
void* OPS_ElasticPlateSection()
{
    if (OPS_GetNumRemainingInputArgs() < 4) {
	opserr << "WARNING insufficient arguments\n";
	opserr << "Want: section ElasticPlateSection tag? E? nu? h? " << endln;
	return 0;
    }
	
    int tag;
    int numdata = 1;
    if (OPS_GetIntInput(&numdata, &tag) < 0) {
	opserr << "WARNING invalid section ElasticPlateSection tag" << endln;
	return 0;
    }

    numdata = 3;
    double data[3];
    if (OPS_GetDoubleInput(&numdata, data) < 0) {
	opserr << "WARNING invalid section ElasticPlateSection double inputs" << endln;
	return 0;
    }
    double E = data[0];
    double nu = data[1];
    double h = data[2];

    return new ElasticPlateSection (tag, E, nu, h);
}
void* OPS_CTestRelativeNormUnbalance()
{
    if(OPS_GetNumRemainingInputArgs() < 2) {
	opserr<<"insufficient number of arguments\n";
	return 0;
    }

    // tolerance
    double tol = 1e-6;
    int numData = 1;
    if(OPS_GetDoubleInput(&numData,&tol) < 0) {
	opserr << "WARNING NormUnbalance failed to read tol\n";
	return 0;
    }

    // maxIter
    numData = OPS_GetNumRemainingInputArgs();
    if(numData > 3) numData = 3;
    int data[3] = {0,0,2};
    if(OPS_GetIntInput(&numData,&data[0]) < 0) {
	opserr << "WARNING NormUnbalance failed to read int values\n";
	return 0;
    }

    // create test
    return new CTestRelativeNormUnbalance(tol,data[0],data[1],data[2]);
}
Ejemplo n.º 13
0
OPS_Export void *
OPS_NewTendonL01Material(void)
{
    // Pointer to a uniaxial material that will be returned
    UniaxialMaterial *theMaterial = 0;

    int numRemainingArgs = OPS_GetNumRemainingInputArgs();
    if (numRemainingArgs < 6) {
        opserr << "Invalid Args want: uniaxialMaterial TendonL01 tag? fpy? Eps? fpu? rou? epsp? <ac?> <rc?>" << endln;
        return 0;
    }

    int    iData[1];
    double dData[7];
    int numData = 1;

    if (OPS_GetIntInput(&numData, iData) != 0) {
        opserr << "WARNING invalid uniaxialMaterial TendonL01 tag" << endln;
        return 0;
    }

    numRemainingArgs = OPS_GetNumRemainingInputArgs();
    if (numRemainingArgs == 5) {
        if (OPS_GetDoubleInput(&numRemainingArgs, dData) != 0) {
            opserr << "Invalid Args want: uniaxialMaterial TendonL01 tag? fpy? Eps? fpu? rou? epsp? <ac?> <rc?>" << endln;
            return 0;
        } else
            theMaterial = new TendonL01(iData[0], dData[0], dData[1], dData[2], dData[3], dData[4]);
    } else if (numRemainingArgs == 7) {
        if (OPS_GetDoubleInput(&numRemainingArgs, dData) != 0) {
            opserr << "Invalid Args want: uniaxialMaterial TendonL01 tag? fpy? Eps? fpu? rou? epsp? <ac?> <rc?>" << endln;
            return 0;
        } else
            theMaterial = new TendonL01(iData[0], dData[0], dData[1], dData[2], dData[3], dData[4], dData[5], dData[6]);
    } else {
        opserr << "Invalid Args want: uniaxialMaterial TendonL01 tag? fpy? Eps? fpu? rou? epsp? <ac?> <rc?>" << endln;
        return 0;
    }

    if (theMaterial == 0) {
        opserr << "WARNING could not create uniaxialMaterial of type TendonL01\n";
        return 0;
    }

    return theMaterial;
}
Ejemplo n.º 14
0
OPS_Export void *
OPS_NewSteelZ02Material(void)
{
  // Pointer to a uniaxial material that will be returned
  UniaxialMaterial *theMaterial = 0;

  int numRemainingArgs = OPS_GetNumRemainingInputArgs();
  if (numRemainingArgs < 5) {
    opserr << "Invalid Args want: uniaxialMaterial SteelZ02 tag? fy? E0? fpc? rou? <ac?> <rc?>" << endln;
    return 0;	
  }

  int    iData[1];
  double dData[6];
  int numData = 1;

  if (OPS_GetIntInput(&numData, iData) != 0) {
    opserr << "WARNING invalid uniaxialMaterial SteelZ02 tag" << endln;
    return 0;
  }

  numRemainingArgs = OPS_GetNumRemainingInputArgs();
  if (numRemainingArgs == 4) {
    if (OPS_GetDoubleInput(&numRemainingArgs, dData) != 0) {
      opserr << "Invalid Args want: uniaxialMaterial SteelZ02 tag? fy? E0? fpc? rou? <ac?> <rc?>" << endln;
      return 0;	
    } else
      theMaterial = new SteelZ02(iData[0], dData[0], dData[1], dData[2], dData[3]);
  } else if (numRemainingArgs == 6) {
    if (OPS_GetDoubleInput(&numRemainingArgs, dData) != 0) {
      opserr << "Invalid Args want: uniaxialMaterial SteelZ02 tag? fy? E0? fpc? rou? <ac?> <rc?>" << endln;
      return 0;	
    } else
      theMaterial = new SteelZ02(iData[0], dData[0], dData[1], dData[2], dData[3], dData[4], dData[5]);
  } else {

    return 0;
  }

  if (theMaterial == 0) {
    opserr << "WARNING could not create uniaxialMaterial of type SteelZ02\n";
    return 0;
  }

  return theMaterial;
}
Ejemplo n.º 15
0
void *
OPS_Quad4FiberOverlay(void)  
{
if (num_Quad4FiberOverlay == 0) {
	num_Quad4FiberOverlay++;
    OPS_Error("Quad4FiberOverlay element - Written: M.Chiaramonte, P.Arduino, P.Mackenzie-Helnwein, U.Washington\n", 1);
  }

  Element *theElement = 0;

  if (OPS_GetNumRemainingInputArgs() != 9) {
    opserr << "Want: Quad4FiberOverlay ?tag ?nd1 ?nd2 ?nd3 ?nd4 ?matTag ?AreaFiber B1  B2 \n";
    return 0;
  }
    
  int    iData[6];
  double dData[3];
  int matTag = 0;
  int eleTag = 0;
  int numData = 0;
  numData = 5;
  if (OPS_GetIntInput(&numData, iData) != 0) {
    opserr << "WARNING invalid integer data: element Quad4FiberOverlay" << endln;
    return 0;
  }
  eleTag = iData[0];

  numData = 1;
  if (OPS_GetIntInput(&numData, &matTag) != 0) {
    opserr << "WARNING element Quad4FiberOverlay: invalid matTag for element: " << eleTag << "\n";
    return 0;
  }
  numData = 3;
  if (OPS_GetDoubleInput(&numData, dData) != 0) {
    opserr << "WARNING invalid data: element Quad4FiberOverlay " << eleTag << endln;
    return 0;	
  }

  UniaxialMaterial *theMaterial = OPS_GetUniaxialMaterial(matTag);
  
  if (theMaterial == 0) {
    opserr << "WARNING material with tag " << matTag << "not found for element " << eleTag << endln;
    return 0;

  }

  // Parsing was successful, allocate the material
  theElement = new Quad4FiberOverlay(iData[0], iData[1], iData[2], iData[3], iData[4], *theMaterial, dData[0], dData[1], dData[2]);

  if (theElement == 0) {
    opserr << "WARNING could not create element of type Quad4FiberOverlay\n";
    return 0;
  }

  return theElement;

  opserr << "Element Passed First Inspection" << endln;
}
void* OPS_PressureDependentElastic3D()
{
    int argc = OPS_GetNumRemainingInputArgs() + 2;
    if (argc < 6) {
	opserr << "WARNING insufficient arguments\n";
	opserr << "Want: nDMaterial PressureDependentElastic3D tag? E? v? rho?\n";
	return 0;
    }

    int tag = 0;
    int numdata = 1;
    if (OPS_GetIntInput(&numdata, &tag) < 0) {
	opserr << "WARNING invalid PressureDependentElastic3D tag\n";
	return 0;
    }
    
    // double E = 0.0;
    // double v = 0.0;
    // double rho = 0.0;
    // double expp = 0.0;
    // double prp = 0.0;
    // double pop = 0.0;
    double data[6] = {0,0,0,0,0,0};
    numdata = OPS_GetNumRemainingInputArgs();
    if (numdata > 6) numdata = 6;
    if (OPS_GetDoubleInput(&numdata, data) < 0) {
	opserr << "WARNING invalid PressureDependentElastic3D double inputs\n";
	return 0;
    }

//////////////////////////////////////////////////////////////////////////////////
    if( argc == 6 )
    {
	return new PressureDependentElastic3D (tag, data[0], data[1], data[2]);
	//opserr << "nDMaterial PressureDependentElastic3D: expp =" << expp << endln;
    }
//////////////////////////////////////////////////////////////////////////////////
    else if( argc == 7 )
    {
	return new PressureDependentElastic3D (tag, data[0], data[1], data[2], data[3]);
	//opserr << "nDMaterial PressureDependentElastic3D: expp =" << expp << endln;
    }
//////////////////////////////////////////////////////////////////////////////////
    else if (argc == 8 )
    {
	return new PressureDependentElastic3D (tag, data[0], data[1], data[2], data[3],
					       data[4]);
    }
//////////////////////////////////////////////////////////////////////////////////
    else if (argc >= 9 )
    {
	return new PressureDependentElastic3D (tag, data[0], data[1], data[2], data[3],
					       data[4], data[5]);
    }

    return 0;
}
Ejemplo n.º 17
0
void *
OPS_TPB1D()
{
  // print out a message about who wrote this element & any copyright info wanted
  if (numMyTPB1D == 0) {
    opserr << "TPB1D2D element - Written by Troy/Fenz UC Berkeley Copyright 2011 - Use at your Own Peril\n";
    numMyTPB1D++;
  }

  Element *theEle = 0;

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

  if (numRemainingArgs != 20) {
    opserr << "ERROR - TPB1D2D not enough args provided, want: element TPB1D2D tag? iNode? jNode? direction? mu1? mu2? mu3? R1? R2? R3? h1? h2? h3? D1? D2? D3? d1? d2? d3? W?\n";
    numMyTPB1D++;
  }

  // get the id and end nodes 
  int iData[4];
  double dData[16];
  int numData;

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

  int eleTag = iData[0];

  numData = 16;
  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
  theEle = new TPB1D(eleTag, iData[1], iData[2], iData[3]-1, 
		     &dData[0],
		     &dData[3],
		     &dData[6],
		     &dData[9],
		     &dData[12],
		     dData[15]);

  if (theEle == 0) {
    opserr << "WARNING ran out of memory creating element type TPB1D with tag " << eleTag << endln;
    return 0;
  }

  return theEle;
}
Ejemplo n.º 18
0
OPS_Export void *
OPS_BeamEndContact3D(void)
{
  	if (num_BeamEndContact3D == 0) {
    	num_BeamEndContact3D++;
    	opserr<<"BeamEndContact3D element - Written: C.McGann, P.Arduino, P.Mackenzie-Helnwein, U.Washington\n";
  	}

  	// Pointer to an element that will be returned
  	Element *theElement = 0;

  	int numRemainingInputArgs = OPS_GetNumRemainingInputArgs();

  	if (numRemainingInputArgs < 8) {
    	opserr << "Invalid #args, want: element BeamEndContact3D eleTag? iNode? jNode? slaveNode? lambdaNode? radius? gapTol? forceTol <cFlag>?\n";
		return 0;
  	}

  	int iData[5];
  	double dData[3];
  	int icSwitch = 0;

  	int numData = 5;
  	if (OPS_GetIntInput(&numData, iData) != 0) {
    	opserr << "WARNING invalid integer data: element BeamEndContact3D " << iData[0] << endln;
		return 0;
  	}

  	numData = 3;
  	if (OPS_GetDoubleInput(&numData, dData) !=0) {
    	opserr << "WARNING invalid double data: element BeamEndContact3D " << iData[0] << endln;
		return 0;
  	}
  
  	numRemainingInputArgs -= 8;
  	while (numRemainingInputArgs >= 1) {
    	numData = 1;
    	if (OPS_GetIntInput(&numData, &icSwitch) != 0) {
      		opserr << "WARNING invalid initial contact flag: element BeamEndContact3D " << iData[0] << endln;
	  		return 0;
    	}
		numRemainingInputArgs -= 1;
  	}

  	// Parsing was successful, allocate the element
  	theElement = new BeamEndContact3D(iData[0], iData[1], iData[2], iData[3], iData[4], 
                                      dData[0], dData[1], dData[2], icSwitch);

  	if (theElement == 0) {
    	opserr << "WARNING could not create element of type BeamEndContact3DElement\n";
		return 0;
  	}

  	return theElement;
}
Ejemplo n.º 19
0
void* OPS_LoadPattern()
{
    if(OPS_GetNumRemainingInputArgs() < 2) {
	opserr<<"insufficient number of args\n";
	return 0;
    }

    LoadPattern *thePattern = 0;

    // get tags
    int tags[2];
    int numData = 2;
    if(OPS_GetIntInput(&numData, &tags[0]) < 0) {
	opserr << "WARNING failed to get load pattern tag\n";
	return 0;
    }

    // get factor
    double fact = 1.0;
    if(OPS_GetNumRemainingInputArgs() > 1) {
	std::string type = OPS_GetString();
	if(type=="-fact" || type=="-factor") {
	    numData = 1;
	    if(OPS_GetDoubleInput(&numData,&fact) < 0) {
		opserr << "WARNING failed to get load pattern factor\n";
		return 0;
	    }
	}
    }

    // create pattern
    thePattern = new LoadPattern(tags[0], fact);
    TimeSeries *theSeries = OPS_getTimeSeries(tags[1]);

    // check 
    if(thePattern == 0 || theSeries == 0) {

	if(thePattern == 0) {
	    opserr << "WARNING - out of memory creating LoadPattern \n";
	} else {
	    opserr << "WARNING - problem creating TimeSeries for LoadPattern \n";
	}

	// clean up the memory and return an error
	if(thePattern != 0)
	    delete thePattern;
	return 0;
    }
    
    thePattern->setTimeSeries(theSeries);

    return thePattern;
}
Ejemplo n.º 20
0
OPS_Export void *
OPS_ratchet()
{
  // Pointer to a uniaxial material that will be returned
  UniaxialMaterial *theMaterial = 0;

  int numData;
  int sDataLength = 40;
  char *sData = new char[sDataLength];

  int tag;
  double E;
  double direction;
  int numSurfaces;

  numData = 1;
  if (OPS_GetIntInput(&numData, &tag) != 0) {
    opserr << "WARNING invalid uniaxialMaterial ratchet tag \n" << endln;
    return 0;
  }


  if ( OPS_GetStringCopy(&sData) != 0 ) {
    opserr << "WARNING invalid input";
    return 0;
  }

  if ( strcmp(sData,"tension") == 0 ) {
    direction = 1.0;
  } else if ( strcmp(sData,"compression") == 0 ) {
    direction = -1.0;
  } else {
    opserr << "WARNING invalid direction: " << sData << "\n";
    return 0;
  }

  numData = 1;
  if (OPS_GetDoubleInput(&numData, &E) != 0) {
    opserr << "WARNING invalid input, want: uniaxialMaterial ratchet tag direction E \n";
    return 0;
  }

  // Create material
  theMaterial = new ratchet(tag, direction, E);

  if (theMaterial == 0) {
    opserr << "WARNING could not create uniaxialMaterial of type ratchet\n";
    return 0;
  }

  return theMaterial;
}
Ejemplo n.º 21
0
void *
OPS_ViscousDamper(void)

{
  if (numViscousDamperMaterials == 0) {
    numViscousDamperMaterials++;
    opserr << "ViscousDamper Model by Sarven Akcelyan and Dimitrios G. Lignos, PhD, McGill University\n";
  }
  
  // Pointer to a uniaxial material that will be returned
  UniaxialMaterial *theMaterial = 0;
  
  int    iData[1];
  double dData[6];
  int numData = 1;
        // Check tag
  if (OPS_GetIntInput(&numData, iData) != 0) {
    opserr << "WARNING invalid uniaxialMaterial  ViscousDamper tag" << endln;
    return 0;
  }
  // Check if we have 6 input variables for K, C, Alpha, NM, Tol, MaxHalf
  numData = OPS_GetNumRemainingInputArgs();

  if (numData != 3 && numData != 6) {
    opserr << "Invalid #args, want: uniaxialMaterial ViscousDamper " << iData[0] <<  "K? C? Alpha? <NM? Tol? MaxHalf?>" << endln;
    return 0;
  }

  if (OPS_GetDoubleInput(&numData, dData) != 0) {
    opserr << "Invalid #args want: uniaxialMaterial ViscousDamper " << iData[0] <<  "K? C? Alpha? <NM? Tol? MaxHalf?>" << endln;
    
    return 0;   
  }
    if (numData == 3) {
	// Default variables
    dData[3] = 1;
    dData[4] = 0.000001;
    dData[5] = 15;
  }
  
  // Parsing was successful, allocate the material with zero index
  theMaterial = new ViscousDamper(iData[0], 
                                  dData[0], dData[1], dData[2], dData[3], dData[4], dData[5]);
  
  if (theMaterial == 0) {
    opserr << "WARNING could not create uniaxialMaterial of type ViscousDamper Material\n";
    return 0;
  }
  
  return theMaterial;
}
Ejemplo n.º 22
0
void* OPS_CTestNormUnbalance()
{
    if(OPS_GetNumRemainingInputArgs() < 2) {
	opserr<<"insufficient number of arguments\n";
	return 0;
    }

    // tolerance
    double tol = 1e-6;
    int numData = 1;
    if(OPS_GetDoubleInput(&numData,&tol) < 0) {
	opserr << "WARNING NormUnbalance failed to read tol\n";
	return 0;
    }

    // maxIter
    numData = OPS_GetNumRemainingInputArgs();
    if(numData > 4) numData = 4;
    int data[4] = {0,0,2,-1};
    if(OPS_GetIntInput(&numData,&data[0]) < 0) {
	opserr << "WARNING NormUnbalance failed to read int values\n";
	return 0;
    }

    // maxTol
    double maxTol = OPS_MAXTOL;
    if(OPS_GetNumRemainingInputArgs() > 0) {
	numData = 1;
	if(OPS_GetDoubleInput(&numData,&maxTol) < 0) {
	    opserr << "WARNING NormUnbalance failed to read maxTol\n";
	    return 0;
	}
    }
    
    // create test
    return new CTestNormUnbalance(tol,data[0],data[1],data[2],data[3],maxTol);
}
Ejemplo n.º 23
0
int OPS_TriMesh(Domain& domain)
{
    if (OPS_GetNumRemainingInputArgs() < 4) {
	opserr<<"WARNING: want rtag? ndf? size? numnodes? nd1? ... bound1? ... eletype? ...\n";
	return -1;
    }

    int num = 2;
    int rtag[2];
    if (OPS_GetIntInput(&num,&rtag[0]) < 0) {
	opserr<<"WARNING: failed to read region tag\n";
	return -1;
    }

    num = 1;
    double size;
    if (OPS_GetDoubleInput(&num,&size) < 0) {
	opserr<<"WARNING: failed to read mesh size\n";
	return -1;
    }

    num = 1;
    int numnodes;
    if (OPS_GetIntInput(&num,&numnodes) < 0) {
	opserr<<"WARNING: failed to read number of nodes\n";
	return -1;
    }

    if (OPS_GetNumRemainingInputArgs() < 2*numnodes) {
	opserr<<"WARNING: insufficient input args\n";
	return -1;
    }

    ID nodes(numnodes);
    if (OPS_GetIntInput(&numnodes, &nodes(0)) < 0) {
	opserr<<"WARNING: failed to read node tags\n";
	return -1;
    }

    ID bound(numnodes);
    if (OPS_GetIntInput(&numnodes, &bound(0)) < 0) {
	opserr<<"WARNING: failed to read boundary values\n";
	return -1;
    }

    TriMesh mesh(domain,rtag[1]);

    return mesh.mesh(rtag[0],size,nodes,bound);
}
Ejemplo n.º 24
0
void *
OPS_Dodd_Restrepo(void)
{
  if (numDoddRestrepo == 0) {
    numDoddRestrepo++;
    opserr << "Dodd_Restrepo unaxial material - Written by L.L. Dodd & J. Restepo\n";
  }

  // Pointer to a uniaxial material that will be returned
  UniaxialMaterial *theMaterial = 0;

  int numArgs = OPS_GetNumRemainingInputArgs();
  if (numArgs < 8 || numArgs > 10) {
    opserr << "WARNING wrong # args: uniaxialMaterial $tag $Fy $Fsu $ESH $ESU $Youngs $ESHI $FSHI <$OmegaFac>" << endln;
    return 0;
  }

  int    iData[1];
  double dData[9];
  int numData;

  dData[7]=1.0; // omegaFac
  dData[8]=1.0; // Conv

  numData = 1;
  if (OPS_GetIntInput(&numData, iData) != 0) {
    opserr << "WARNING invalid uniaxialMaterial ElasticPP tag" << endln;
    return 0;
  }

  numData = numArgs-1;  
  if (OPS_GetDoubleInput(&numData, dData) != 0) {
    opserr << "WARNING invalid E & ep\n";
    return 0;	
  }

  theMaterial = new Dodd_Restrepo(iData[0], dData[0], dData[1], dData[2],
				  dData[3], dData[4], dData[5], dData[6],
				  dData[7], dData[8]);       
  
  if (theMaterial == 0) {
    opserr << "WARNING could not create uniaxialMaterial of type ElasticPPCpp\n";
    return 0;
  }
  
  return theMaterial;
}
Ejemplo n.º 25
0
void *
OPS_DoddRestr(void)
{
  // Pointer to a uniaxial material that will be returned
  UniaxialMaterial *theMaterial = 0;

  int    iData[1];
  double dData[12];
  int numData = 1;

  if (OPS_GetIntInput(&numData, iData) != 0) {
    opserr << "WARNING invalid uniaxialMaterial DoddRestr tag" << endln;
    return 0;
  }

  numData = OPS_GetNumRemainingInputArgs();

  if (numData != 9 && numData != 12) {
    opserr << "Invalid #args, want: uniaxialMaterial DoddRestr " << iData[0] << " Eo? fy? esh? esh1? fsh1? esu? fsu? Pmajor? Pminor? <slcf? tlcf? Dcrit?>>" << endln;
    return 0;
  }

  if (OPS_GetDoubleInput(&numData, dData) != 0) {
    opserr << "Invalid #args, want: uniaxialMaterial DoddRestr " << iData[0] << " Eo? fy? esh? esh1? fsh1? esu? fsu? Pmajor? Pminor? <slcf? tlcf? Dcrit?>>" << endln;
    return 0;
  }

  if (numData == 9) {
    dData[9] = 0.;
    dData[10] = 0.;
    dData[11] = 0.;
  }
  
  // Parsing was successful, allocate the material
  theMaterial = new DoddRestr(iData[0], dData[0], dData[1], dData[2], 
			      dData[3], dData[4], dData[5], dData[6], 
			      dData[7], dData[8], dData[9], dData[10], dData[11]);
  
  
  if (theMaterial == 0) {
    opserr << "WARNING could not create uniaxialMaterial of type DoddRestr Material\n";
    return 0;
  }

  return theMaterial;
}
Ejemplo n.º 26
0
void *
OPS_HystereticMaterial(void)
{
  // Pointer to a uniaxial material that will be returned
  UniaxialMaterial *theMaterial = 0;

  int numArgs = OPS_GetNumRemainingInputArgs();
  if (numArgs != 18 && numArgs != 17 && numArgs != 14 && numArgs != 13) {
    opserr << "Want: uniaxialMaterial Hysteretic tag? mom1p? rot1p? mom2p? rot2p? <mom3p? rot3p?> "
	   << "\nmom1n? rot1n? mom2n? rot2n? <mom3n? rot3n?> pinchX? pinchY? damfc1? damfc2? <beta?>";
    return 0;
  }
  
  int iData[1];
  double dData[17];
  for (int i=0; i<17; i++) 
    dData[i] = 0.0;

  int numData = 1;
  if (OPS_GetIntInput(&numData, iData) != 0) {
    opserr << "WARNING invalid tag for uniaxialMaterial Hysteretic" << endln;
    return 0;
  }

  numData = numArgs-1;
  if (OPS_GetDoubleInput(&numData, dData) != 0) {
    opserr << "Invalid data for uniaxial Hysteretic " << iData[0] << endln;
    return 0;	
  }

  // Parsing was successful, allocate the material
  if (numData > 13) 
    theMaterial = new HystereticMaterial(iData[0], dData[0], dData[1], dData[2], dData[3], dData[4], dData[5],
					 dData[6], dData[7], dData[8], dData[9], dData[10], dData[11], dData[12],
  					 dData[13], dData[14], dData[15], dData[16]);
  else
    theMaterial = new HystereticMaterial(iData[0], dData[0], dData[1], dData[2], dData[3], dData[4], dData[5],
					 dData[6], dData[7], dData[8], dData[9], dData[10], dData[11], dData[12]);

  if (theMaterial == 0) {
    opserr << "WARNING could not create uniaxialMaterial of type Hysteretic\n";
    return 0;
  }

  return theMaterial;
}
Ejemplo n.º 27
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;
       
}
Ejemplo n.º 28
0
void *
OPS_New_MultiLinear(void)
{
  // Pointer to a uniaxial material that will be returned
  UniaxialMaterial *theMaterial = 0;

  if (OPS_GetNumRemainingInputArgs() < 5) {
    opserr << "Invalid #args,  want: uniaxialMaterial MultiLinear tag? e1 s1 e2 s2 ... " << endln;
    return 0;
  }
    
  int iData[1];
  int numData = 1;
  if (OPS_GetIntInput(&numData, iData) != 0) {
    opserr << "WARNING invalid tag or soilType uniaxialMaterial MultiLinearMaterial" << endln;
    return 0;
  }

  numData = OPS_GetNumRemainingInputArgs();

  int numSlope = numData/2;
  double *dData = new double[numData];
  if (OPS_GetDoubleInput(&numData, dData) != 0) {
    opserr << "Invalid pyData data for material uniaxial MultiLinear " << iData[0] << endln;
    return 0;	
  }

  Vector e(numSlope);
  Vector s(numSlope);
  for (int i=0; i<numSlope; i++) {
    e(i) = dData[2*i];
    s(i) = dData[2*i+1];
  }

  // Parsing was successful, allocate the material
  theMaterial = new MultiLinear(iData[0], s, e);
  if (theMaterial == 0) {
    opserr << "WARNING could not create uniaxialMaterial of type MultiLinear\n";
    return 0;
  }

  return theMaterial;
}
Ejemplo n.º 29
0
void* OPS_ElasticSection2d()
{
    if(OPS_GetNumRemainingInputArgs() < 4) {
	opserr<<"insufficient arguments for ealstic section\n";
	return 0;
    }

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

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

    return new ElasticSection2d(tag,data[0],data[1],data[2]);
}
Ejemplo n.º 30
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);
}