Exemplo n.º 1
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;
}
Exemplo n.º 2
0
void *
OPS_CoupledZeroLength()
{

  Element *theEle = 0;

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

  if (numRemainingArgs != 6 && numRemainingArgs != 7) {
    opserr << "ERROR - CoupledZeroLength not enough args provided, want: element CoupledZeroLength tag? iNode? jNode? dirn1? dirn2? matTag? <useRayleigh?>\n";
  }

  // get the id and end nodes 
  int iData[7];
  int numData;

  iData[6] = 0; // turn off rayleigh damping by default

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

  int eleTag = iData[0];
  int matID = iData[5];
  UniaxialMaterial *theMaterial = OPS_GetUniaxialMaterial(matID);
  
  if (theMaterial == 0) {
    opserr << "WARNING material with tag " << matID << "not found for element " << eleTag << endln;
    return 0;
  }

  // now create the truss and add it to the Domain

  theEle = new CoupledZeroLength(eleTag, iData[1], iData[2], *theMaterial, iData[3]-1, iData[4]-1, iData[6]);

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

  return theEle;
}
Exemplo n.º 3
0
OPS_Export void *
OPS_NewInitStressMaterial(void)
{
  // Pointer to a uniaxial material that will be returned
  UniaxialMaterial *theMaterial = 0;
  UniaxialMaterial *theOtherMaterial = 0;

  int    iData[2];
  double dData[1];
  int numData = 2;
  if (OPS_GetIntInput(&numData, iData) != 0) {
    opserr << "WARNING invalid uniaxialMaterial InitStressMaterial $tag $otherTag" << endln;
    return 0;
  }

  theOtherMaterial = OPS_GetUniaxialMaterial(iData[1]);
  if (theOtherMaterial == 0) {
    opserr << "Could not find material with tag: " << iData[1] << "uniaxialMaterial InitStress $tag $otherTag $sig0" << endln;
    return 0;	
  }

  numData = 1;
  if (OPS_GetDoubleInput(&numData, dData) != 0) {
    opserr << "Invalid Args want: uniaxialMaterial InitStress $tag $otherTag $sig0" << endln;
    return 0;	
  }

  // Parsing was successful, allocate the material
  theMaterial = new InitStressMaterial(iData[0], *theOtherMaterial, dData[0]);

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

  return theMaterial;
}
OPS_Export void *
OPS_NewRAReinforcedConcretePlateFiberMaterial()
{
  if (numRAReinforcedConcretePlateFiberMaterials == 0) {
    numRAReinforcedConcretePlateFiberMaterials++;
    //opserr << "ReinforcedConcretePlateFiber unaxial material - Written by J.Zhong, Thomas T.C. Hsu and Y.L. Mo - Copyright@2009\n";
  }

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

  int numRemainingArgs = OPS_GetNumRemainingInputArgs();

  if (numRemainingArgs < 14) {
    opserr << "Invalid Args want: NDMaterial RAReinforcedConcretePlateFiber matTag? rho? UniaxiaMatTag1? UniaxiaMatTag2? UniaxiaMatTag3? UniaxiaMatTag4? angle1? angle2? rou1? rou2? fpc? fy? E0? epsc0?>\n";
    return 0;	
  }

  int tag;
  double rho;
  int    iData[4];
  double dData[8];
  int numData = 0;

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

  numData = 1;
  if (OPS_GetDouble(&numData, &rho) != 0) {
    opserr << "Invalid Arg rho: uniaxialMaterial RAReinforcedConcretePlateFiber tag? fy? E0? fpc? rou? <ac?> <rc?>" << endln;
    return 0;	
  }

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

  numData = 8;
  if (OPS_GetDouble(&numData, dData) != 0) {
    opserr << "WARNING invalid uniaxialMaterial RAReinforcedConcretePlateFiber tag" << endln;
    return 0;
  }

  UniaxialMaterial *theUniaxialMaterial1 = OPS_GetUniaxialMaterial(iData[0]);
    
  if (theUniaxialMaterial1 == 0) {
    opserr << "WARNING material not found\n";
    opserr << "Material: " << iData[0];
    opserr << "\nRAReinforcedConcretePlateFiber: " << tag << endln;
    return 0;
  }
  
  UniaxialMaterial *theUniaxialMaterial2 = OPS_GetUniaxialMaterial(iData[1]);

  if (theUniaxialMaterial2 == 0) {
    opserr << "WARNING material not found\n";
    opserr << "Material: " << iData[1];
    opserr << "\nRAReinforcedConcretePlateFiber: " << tag << endln;
    return 0;
  }
  
  UniaxialMaterial *theUniaxialMaterial3 = OPS_GetUniaxialMaterial(iData[2]);
  if (theUniaxialMaterial3 == 0) {
    opserr << "WARNING material not found\n";
    opserr << "Material: " << iData[2];
    opserr << "\nRAReinforcedConcretePlateFiber: " << tag << endln;
    return 0;
  }

  UniaxialMaterial *theUniaxialMaterial4 = OPS_GetUniaxialMaterial(iData[3]);  
  if (theUniaxialMaterial4 == 0) {
    opserr << "WARNING material not found\n";
    opserr << "Material: " << iData[3];
    opserr << "\nRAReinforcedConcretePlateFiber: " << tag << endln;
    return 0;
  }

  //now create the RAReinforcedConcretePlateFiber
  theMaterial = new RAReinforcedConcretePlateFiber (tag, 
						     rho,
						     theUniaxialMaterial1, 
						     theUniaxialMaterial2, 
						     theUniaxialMaterial3, 
						     theUniaxialMaterial4,
						     dData[0],
						     dData[1],
						     dData[2],
						     dData[3],
						     dData[4],
						     dData[5],
						     dData[6],
						     dData[7]);
       
  if (theMaterial == 0) {
    opserr << "WARNING ran out of memory creating material\n";
    opserr << "RAReinforcedConcretePlateFiber: " << tag << endln;
    return 0;
  }

  return theMaterial;
}
Exemplo n.º 5
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;
}
Exemplo n.º 6
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;
}
Exemplo n.º 7
0
OPS_Export void *
OPS_NewMinMaxMaterial(void)
{
  // Pointer to a uniaxial material that will be returned
  UniaxialMaterial *theMaterial = 0;
  UniaxialMaterial *theOtherMaterial = 0;
  double minStrain = -1.0e16;
  double maxStrain = 1.0e16;
  int    iData[2];

  int argc = OPS_GetNumRemainingInputArgs();
  if (argc < 2) {
    opserr << "WARNING invalid uniaxialMaterial MinMaxMaterial $tag $otherTag <-min $minStrain> <-max $maxStrain>" << endln;
    return 0;
  }

  int numData = 2;
  if (OPS_GetIntInput(&numData, iData) != 0) {
    opserr << "WARNING invalid uniaxialMaterial MinMaxMaterial $tag $otherTag" << endln;
    return 0;
  }

  theOtherMaterial = OPS_GetUniaxialMaterial(iData[1]);
  if (theOtherMaterial == 0) {
    opserr << "WARNING invalid otherTag uniaxialMaterial MinMax tag: " << iData[0] << endln;
    return 0;	
  }

  argc = OPS_GetNumRemainingInputArgs();  
  while (argc > 1) {
    char argvLoc[10];
    if (OPS_GetString(argvLoc, 10) != 0) {
      opserr << "WARNING invalid string option uniaxialMaterial MinMax tag: " << iData[0] << endln;
      return 0;
    }

    numData = 1;

    if ((strcmp(argvLoc, "-min") == 0) || (strcmp(argvLoc, "-Min") == 0) || (strcmp(argvLoc, "-MIN") == 0)) {
      if (OPS_GetDouble(&numData, &minStrain) != 0) {      
	opserr << "WARNING invalid min value  uniaxialMaterial MinMax tag: " << iData[0] << endln;	
	return 0;
      }
    } else if ((strcmp(argvLoc, "-max") == 0) || (strcmp(argvLoc, "-Max") == 0) || (strcmp(argvLoc, "-MAX") == 0)) {
      if (OPS_GetDouble(&numData, &maxStrain) != 0) {      
	opserr << "WARNING invalid min value  uniaxialMaterial MinMax tag: " << iData[0] << endln;  
	return 0;
      }
    } else {
      opserr << "WARNING invalid option:" << argvLoc << " uniaxialMaterial MinMax tag: " << iData[0] << endln;  
      return 0;
    }
    
    argc = OPS_GetNumRemainingInputArgs();
  }

  // Parsing was successful, allocate the material
  theMaterial = new MinMaxMaterial(iData[0], *theOtherMaterial, minStrain, maxStrain);

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

  return theMaterial;
}
Exemplo n.º 8
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;
}
OPS_Export void *
OPS_NewPrestressedConcretePlaneStressMaterial()
{
	if (numPrestressedConcretePlaneStressMaterials == 0) {
		numPrestressedConcretePlaneStressMaterials++;
		//OPS_Error("PrestressedConcretePlaneStress unaxial material - Written by A.Laskar, Thomas T.C. Hsu and Y.L. Mo - Copyright@2009\n", 1);
		}

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

	int numRemainingArgs = OPS_GetNumRemainingInputArgs();

	if (numRemainingArgs < 16) {
		opserr << "Want: nDMaterial PrestressedConcretePlaneStress matTag? rho? UniaxiaMatTag1? UniaxiaMatTag2? UniaxiaMatTag3? UniaxiaMatTag4? angle1? angle2? rou1? rou2? pstrain? fpc? fy1? fy2? E0? epsc0?\n";
		return 0;	
		}

	int tag;
	double rho;
	int    iData[6];
	double dData[10];
	int numData = 0;

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

	numData = 1;
	if (OPS_GetDouble(&numData, &rho) != 0) {
		opserr << "Invalid Arg rho: uniaxialMaterial PrestressedConcretePlaneStress tag " << tag << endln;
		return 0;	
		}

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

	numData = 10;
	if (OPS_GetDouble(&numData, dData) != 0) {
		opserr << "WARNING invalid data PrestressedConcretePlaneStress tag" << tag << endln;
		return 0;
		}

	UniaxialMaterial *theUniaxialMaterial1 = OPS_GetUniaxialMaterial(iData[0]);

	if (theUniaxialMaterial1 == 0) {
		opserr << "WARNING material not found\n";
		opserr << "Material: " << iData[0];
		opserr << "\nPrestressedConcretePlaneStress: " << tag << endln;
		return 0;
		}

	UniaxialMaterial *theUniaxialMaterial2 = OPS_GetUniaxialMaterial(iData[1]);

	if (theUniaxialMaterial2 == 0) {
		opserr << "WARNING material not found\n";
		opserr << "Material: " << iData[1];
		opserr << "\nPrestressedConcretePlaneStress: " << tag << endln;
		return 0;
		}

	UniaxialMaterial *theUniaxialMaterial3 = OPS_GetUniaxialMaterial(iData[2]);
	if (theUniaxialMaterial3 == 0) {
		opserr << "WARNING material not found\n";
		opserr << "Material: " << iData[2];
		opserr << "\nPrestressedConcretePlaneStress: " << tag << endln;
		return 0;
		}

	UniaxialMaterial *theUniaxialMaterial4 = OPS_GetUniaxialMaterial(iData[3]);  
	if (theUniaxialMaterial4 == 0) {
		opserr << "WARNING material not found\n";
		opserr << "Material: " << iData[3];
		opserr << "\nPrestressedConcretePlaneStress: " << tag << endln;
		return 0;
		}

	//now create the PrestressedConcretePlaneStress
	theMaterial = new PrestressConcretePlaneStress (tag, 
		rho,
		theUniaxialMaterial1, 
		theUniaxialMaterial2, 
		theUniaxialMaterial3, 
		theUniaxialMaterial4,
		dData[0],
		dData[1],
		dData[2],
		dData[3],
		dData[4],
		dData[5],
		dData[6],
		dData[7],
		dData[8],
		dData[9]);

	if (theMaterial == 0) {
		opserr << "WARNING ran out of memory creating material\n";
		opserr << "PrestressedConcretePlaneStress: " << tag << endln;
		return 0;
		}

	return theMaterial;
}
Exemplo n.º 10
0
int TclExpControlCommand(ClientData clientData, Tcl_Interp *interp,
    int argc, TCL_Char **argv, Domain *theDomain)
{
    if (theExperimentalControls == 0)
        theExperimentalControls = new ArrayOfTaggedObjects(32);
    
    // make sure there is a minimum number of arguments
    if (argc < 3)  {
        opserr << "WARNING insufficient number of experimental control arguments\n";
        opserr << "Want: expControl type tag <specific experimental control args>\n";
        return TCL_ERROR;
    }
    
    // pointer to control that will be added
    ExperimentalControl *theControl = 0;
    
    int tag, argi;
    
    // ----------------------------------------------------------------------------	
    if (strcmp(argv[1],"SimUniaxialMaterials") == 0)  {
        if (argc < 4)  {
            opserr << "WARNING invalid number of arguments\n";
            printCommand(argc,argv);
            opserr << "Want: expControl SimUniaxialMaterials tag matTags "
                << "<-ctrlFilters (5 filterTag)> <-daqFilters (5 filterTag)>\n";
            return TCL_ERROR;
        }
        
        int i, matTag, numMats = 0;
        
        argi = 2;
        if (Tcl_GetInt(interp, argv[argi], &tag) != TCL_OK)  {
            opserr << "WARNING invalid expControl SimUniaxialMaterials tag\n";
            return TCL_ERROR;
        }
        argi++;
        // now read the number of materials
        while (argi+numMats < argc &&
            strcmp(argv[argi+numMats],"-ctrlFilters") != 0 &&
            strcmp(argv[argi+numMats],"-daqFilters") != 0)  {
                numMats++;
        }
        if (numMats == 0)  {
            opserr << "WARNING no uniaxial materials specified\n";
            opserr << "expControl SimUniaxialMaterials " << tag << endln;
            return TCL_ERROR;
        }
        // create the array to hold the uniaxial materials
        UniaxialMaterial **theSpecimen = new UniaxialMaterial* [numMats];
        if (theSpecimen == 0)  {
            opserr << "WARNING out of memory\n";
            opserr << "expControl SimUniaxialMaterials " << tag << endln;
            return TCL_ERROR;
        }
        for (i=0; i<numMats; i++)  {
            theSpecimen[i] = 0;
            if (Tcl_GetInt(interp, argv[argi], &matTag) != TCL_OK)  {
                opserr << "WARNING invalid matTag\n";
                opserr << "expControl SimUniaxialMaterials " << tag << endln;
                return TCL_ERROR;	
            }
            theSpecimen[i] = OPS_GetUniaxialMaterial(matTag);
            if (theSpecimen[i] == 0)  {
                opserr << "WARNING uniaxial material not found\n";
                opserr << "uniaxialMaterial " << matTag << endln;
                opserr << "expControl SimUniaxialMaterials " << tag << endln;
                return TCL_ERROR;
            }
            argi++;
        }
        
        // parsing was successful, allocate the control
        theControl = new ECSimUniaxialMaterials(tag, numMats, theSpecimen);
        
        // cleanup dynamic memory
        if (theSpecimen != 0)
            delete [] theSpecimen;
    }
    
    /* ----------------------------------------------------------------------------	
    else if (strcmp(argv[1],"SimUniaxialMaterialsForce") == 0)  {
        if (argc < 4)  {
            opserr << "WARNING invalid number of arguments\n";
            printCommand(argc,argv);
            opserr << "Want: expControl SimUniaxialMaterialsForce tag matTags "
                << "<-ctrlFilters (5 filterTag)> <-daqFilters (5 filterTag)>\n";
            return TCL_ERROR;
        }
        
        int i, matTag, numMats = 0;
        
        argi = 2;
        if (Tcl_GetInt(interp, argv[argi], &tag) != TCL_OK)  {
            opserr << "WARNING invalid expControl SimUniaxialMaterialsForce tag\n";
            return TCL_ERROR;
        }
        argi++;
        // now read the number of materials
        while (argi+numMats < argc &&
            strcmp(argv[argi+numMats],"-ctrlFilters") != 0 &&
            strcmp(argv[argi+numMats],"-daqFilters") != 0)  {
                numMats++;
        }
        if (numMats == 0)  {
            opserr << "WARNING no uniaxial materials specified\n";
            opserr << "expControl SimUniaxialMaterialsForce " << tag << endln;
            return TCL_ERROR;
        }
        // create the array to hold the uniaxial materials
        UniaxialMaterial **theSpecimen = new UniaxialMaterial* [numMats];
        if (theSpecimen == 0)  {
            opserr << "WARNING out of memory\n";
            opserr << "expControl SimUniaxialMaterialsForce " << tag << endln;
            return TCL_ERROR;
        }
        for (i=0; i<numMats; i++)  {
            theSpecimen[i] = 0;
            if (Tcl_GetInt(interp, argv[argi], &matTag) != TCL_OK)  {
                opserr << "WARNING invalid matTag\n";
                opserr << "expControl SimUniaxialMaterialsForce " << tag << endln;
                return TCL_ERROR;
            }
            theSpecimen[i] = OPS_GetUniaxialMaterial(matTag);
            if (theSpecimen[i] == 0)  {
                opserr << "WARNING uniaxial material not found\n";
                opserr << "uniaxialMaterial " << matTag << endln;
                opserr << "expControl SimUniaxialMaterialsForce " << tag << endln;
                return TCL_ERROR;
            }
            argi++;
        }
        
        // parsing was successful, allocate the control
        theControl = new ECSimUniaxialMaterialsForce(tag, numMats, theSpecimen);
        
        // cleanup dynamic memory
        if (theSpecimen != 0)
            delete [] theSpecimen;
    }*/
    
    // ----------------------------------------------------------------------------	
    else if (strcmp(argv[1],"SimDomain") == 0)  {
        if (argc < 7)  {
            opserr << "WARNING invalid number of arguments\n";
            printCommand(argc,argv);
            opserr << "Want: expControl SimDomain tag -trialCP cpTags -outCP cpTags "
                << "<-ctrlFilters (5 filterTag)> <-daqFilters (5 filterTag)>\n";
            return TCL_ERROR;
        }
        
        int i, cpTag;
        int numTrialCPs = 0, numOutCPs = 0;
        
        argi = 2;
        if (Tcl_GetInt(interp, argv[argi], &tag) != TCL_OK)  {
            opserr << "WARNING invalid expControl SimDomain tag\n";
            return TCL_ERROR;
        }
        argi++;
        if (strcmp(argv[argi],"-trialCP") != 0)  {
            opserr << "WARNING expecting -trialCP cpTags\n";
            opserr << "expControl SimDomain " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        while (argi+numTrialCPs < argc &&
            strcmp(argv[argi+numTrialCPs],"-outCP") != 0)  {
                numTrialCPs++;
        }
        if (numTrialCPs == 0)  {
            opserr << "WARNING no trialCPTags specified\n";
            opserr << "expControl SimDomain " << tag << endln;
            return TCL_ERROR;
        }
        // create the array to hold the trial control points
        ExperimentalCP **trialCPs = new ExperimentalCP* [numTrialCPs];
        if (trialCPs == 0)  {
            opserr << "WARNING out of memory\n";
            opserr << "expControl SimDomain " << tag << endln;
            return TCL_ERROR;
        }
        for (i=0; i<numTrialCPs; i++)  {
            trialCPs[i] = 0;
            if (Tcl_GetInt(interp, argv[argi], &cpTag) != TCL_OK)  {
                opserr << "WARNING invalid cpTag\n";
                opserr << "expControl SimDomain " << tag << endln;
                return TCL_ERROR;
            }
            trialCPs[i] = getExperimentalCP(cpTag);
            if (trialCPs[i] == 0)  {
                opserr << "WARNING experimental control point not found\n";
                opserr << "expControlPoint " << cpTag << endln;
                opserr << "expControl SimDomain " << tag << endln;
                return TCL_ERROR;
            }
            argi++;
        }
        if (strcmp(argv[argi],"-outCP") != 0)  {
            opserr << "WARNING expecting -outCP cpTags\n";
            opserr << "expControl SimDomain " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        while (argi+numOutCPs < argc &&
            strcmp(argv[argi+numOutCPs],"-ctrlFilters") != 0 &&
            strcmp(argv[argi+numOutCPs],"-daqFilters") != 0)  {
                numOutCPs++;
        }
        if (numOutCPs == 0)  {
            opserr << "WARNING no outCPTags specified\n";
            opserr << "expControl SimDomain " << tag << endln;
            return TCL_ERROR;
        }
        // create the array to hold the output control points
        ExperimentalCP **outCPs = new ExperimentalCP* [numOutCPs];
        if (outCPs == 0)  {
            opserr << "WARNING out of memory\n";
            opserr << "expControl SimDomain " << tag << endln;
            return TCL_ERROR;
        }
        for (i=0; i<numOutCPs; i++)  {
            outCPs[i] = 0;
            if (Tcl_GetInt(interp, argv[argi], &cpTag) != TCL_OK)  {
                opserr << "WARNING invalid cpTag\n";
                opserr << "expControl SimDomain " << tag << endln;
                return TCL_ERROR;
            }
            outCPs[i] = getExperimentalCP(cpTag);
            if (outCPs[i] == 0)  {
                opserr << "WARNING experimental control point not found\n";
                opserr << "expControlPoint " << cpTag << endln;
                opserr << "expControl SimDomain " << tag << endln;
                return TCL_ERROR;
            }
            argi++;
        }
        
        // parsing was successful, allocate the control
        theControl = new ECSimDomain(tag, numTrialCPs, trialCPs,
            numOutCPs, outCPs, theDomain);
    }
    
    // ----------------------------------------------------------------------------	
    else if (strcmp(argv[1],"SimFEAdapter") == 0)  {
        if (argc < 9)  {
            opserr << "WARNING invalid number of arguments\n";
            printCommand(argc,argv);
            opserr << "Want: expControl SimFEAdapter tag ipAddr ipPort -trialCP cpTags -outCP cpTags "
                << "<-ctrlFilters (5 filterTag)> <-daqFilters (5 filterTag)>\n";
            return TCL_ERROR;
        }
        
        char *ipAddr;
        int i, cpTag, ipPort = 44000;
        int numTrialCPs = 0, numOutCPs = 0;
        
        argi = 2;
        if (Tcl_GetInt(interp, argv[argi], &tag) != TCL_OK)  {
            opserr << "WARNING invalid expControl SimFEAdapter tag\n";
            return TCL_ERROR;
        }
        argi++;
        ipAddr = new char [strlen(argv[argi])+1];
        strcpy(ipAddr,argv[argi]);
        argi++;
        if (Tcl_GetInt(interp, argv[argi], &ipPort) != TCL_OK)  {
            opserr << "WARNING invalid ipPort\n";
            opserr << "expControl SimFEAdapter " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        if (strcmp(argv[argi],"-trialCP") != 0)  {
            opserr << "WARNING expecting -trialCP cpTags\n";
            opserr << "expControl SimFEAdapter " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        while (argi+numTrialCPs < argc &&
            strcmp(argv[argi+numTrialCPs],"-outCP") != 0)  {
                numTrialCPs++;
        }
        if (numTrialCPs == 0)  {
            opserr << "WARNING no trialCPTags specified\n";
            opserr << "expControl SimFEAdapter " << tag << endln;
            return TCL_ERROR;
        }
        // create the array to hold the trial control points
        ExperimentalCP **trialCPs = new ExperimentalCP* [numTrialCPs];
        if (trialCPs == 0)  {
            opserr << "WARNING out of memory\n";
            opserr << "expControl SimFEAdapter " << tag << endln;
            return TCL_ERROR;
        }
        for (i=0; i<numTrialCPs; i++)  {
            trialCPs[i] = 0;
            if (Tcl_GetInt(interp, argv[argi], &cpTag) != TCL_OK)  {
                opserr << "WARNING invalid cpTag\n";
                opserr << "expControl SimFEAdapter " << tag << endln;
                return TCL_ERROR;
            }
            trialCPs[i] = getExperimentalCP(cpTag);
            if (trialCPs[i] == 0)  {
                opserr << "WARNING experimental control point not found\n";
                opserr << "expControlPoint " << cpTag << endln;
                opserr << "expControl SimFEAdapter " << tag << endln;
                return TCL_ERROR;
            }
            argi++;
        }
        if (strcmp(argv[argi],"-outCP") != 0)  {
            opserr << "WARNING expecting -outCP cpTags\n";
            opserr << "expControl SimFEAdapter " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        while (argi+numOutCPs < argc &&
            strcmp(argv[argi+numOutCPs],"-ctrlFilters") != 0 &&
            strcmp(argv[argi+numOutCPs],"-daqFilters") != 0)  {
                numOutCPs++;
        }
        if (numOutCPs == 0)  {
            opserr << "WARNING no outCPTags specified\n";
            opserr << "expControl SimFEAdapter " << tag << endln;
            return TCL_ERROR;
        }
        // create the array to hold the output control points
        ExperimentalCP **outCPs = new ExperimentalCP* [numOutCPs];
        if (outCPs == 0)  {
            opserr << "WARNING out of memory\n";
            opserr << "expControl SimFEAdapter " << tag << endln;
            return TCL_ERROR;
        }
        for (i=0; i<numOutCPs; i++)  {
            outCPs[i] = 0;
            if (Tcl_GetInt(interp, argv[argi], &cpTag) != TCL_OK)  {
                opserr << "WARNING invalid cpTag\n";
                opserr << "expControl SimFEAdapter " << tag << endln;
                return TCL_ERROR;
            }
            outCPs[i] = getExperimentalCP(cpTag);
            if (outCPs[i] == 0)  {
                opserr << "WARNING experimental control point not found\n";
                opserr << "expControlPoint " << cpTag << endln;
                opserr << "expControl SimFEAdapter " << tag << endln;
                return TCL_ERROR;
            }
            argi++;
        }
        
        // parsing was successful, allocate the control
        theControl = new ECSimFEAdapter(tag, numTrialCPs, trialCPs,
            numOutCPs, outCPs, ipAddr, ipPort);
    }
    
    // ----------------------------------------------------------------------------	
    else if (strcmp(argv[1],"SimSimulink") == 0)  {
        if (argc < 5)  {
            opserr << "WARNING invalid number of arguments\n";
            printCommand(argc,argv);
            opserr << "Want: expControl SimSimulink tag ipAddr ipPort "
                << "<-ctrlFilters (5 filterTag)> <-daqFilters (5 filterTag)>\n";
            return TCL_ERROR;
        }
        
        char *ipAddr;
        int ipPort = 44000;
        
        argi = 2;
        if (Tcl_GetInt(interp, argv[argi], &tag) != TCL_OK)  {
            opserr << "WARNING invalid expControl SimSimulink tag\n";
            return TCL_ERROR;
        }
        argi++;
        ipAddr = new char [strlen(argv[argi])+1];
        strcpy(ipAddr,argv[argi]);
        argi++;
        if (Tcl_GetInt(interp, argv[argi], &ipPort) != TCL_OK)  {
            opserr << "WARNING invalid ipPort\n";
            opserr << "expControl SimSimulink " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        
        // parsing was successful, allocate the control
        theControl = new ECSimSimulink(tag, ipAddr, ipPort);
    }

    // ----------------------------------------------------------------------------	
    else if (strcmp(argv[1],"GenericTCP") == 0)  {
        if (argc < 17)  {
            opserr << "WARNING invalid number of arguments\n";
            printCommand(argc,argv);
            opserr << "Want: expControl GenericTCP tag ipAddr ipPort -ctrlModes (5 mode) -daqModes (5 mode) "
                << "<-initFile fileName> <-ssl> <-udp> <-ctrlFilters (5 filterTag)> <-daqFilters (5 filterTag)>\n";
            return TCL_ERROR;
        }
        
        char *ipAddr;
        int i, ipPort, mode;
        ID ctrlModes(5), daqModes(5);
        char *initFileName = 0;
        int ssl = 0, udp = 0;
        
        argi = 2;
        if (Tcl_GetInt(interp, argv[argi], &tag) != TCL_OK)  {
            opserr << "WARNING invalid expControl GenericTCP tag\n";
            return TCL_ERROR;
        }
        argi++;
        ipAddr = new char [strlen(argv[argi])+1];
        strcpy(ipAddr,argv[argi]);
        argi++;
        if (Tcl_GetInt(interp, argv[argi], &ipPort) != TCL_OK)  {
            opserr << "WARNING invalid ipPort\n";
            opserr << "expControl GenericTCP " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        if (strcmp(argv[argi],"-ctrlModes") != 0)  {
            opserr << "WARNING expecting -ctrlModes (5 mode)\n";
            opserr << "expControl GenericTCP " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        for (i=0; i<5; i++)  {
            if (Tcl_GetInt(interp, argv[argi], &mode) != TCL_OK)  {
                opserr << "WARNING invalid mode\n";
                opserr << "expControl GenericTCP " << tag << endln;
                return TCL_ERROR;
            }
            ctrlModes(i) = mode;
            argi++;
        }
        if (strcmp(argv[argi],"-daqModes") != 0)  {
            opserr << "WARNING expecting -daqModes (5 mode)\n";
            opserr << "expControl GenericTCP " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        for (i=0; i<5; i++)  {
            if (Tcl_GetInt(interp, argv[argi], &mode) != TCL_OK)  {
                opserr << "WARNING invalid mode\n";
                opserr << "expControl GenericTCP " << tag << endln;
                return TCL_ERROR;
            }
            daqModes(i) = mode;
            argi++;
        }
        for (i=argi; i<argc; i++)  {
            if (strcmp(argv[i], "-initFile") == 0)  {
                initFileName = new char [strlen(argv[i+1])+1];
                strcpy(initFileName,argv[i+1]);
            }
        }
        for (i=argi; i<argc; i++)  {
            if (strcmp(argv[i], "-ssl") == 0)
                ssl = 1;
            else if (strcmp(argv[i], "-udp") == 0)
                udp = 1;
        }
        
        // parsing was successful, allocate the control
        theControl = new ECGenericTCP(tag, ipAddr, ipPort,
            ctrlModes, daqModes, initFileName, ssl, udp);
    }
    
#ifndef _WIN64
    // ----------------------------------------------------------------------------	
    else if (strcmp(argv[1],"dSpace") == 0)  {
        if (argc < 8)  {
            opserr << "WARNING invalid number of arguments\n";
            printCommand(argc,argv);
            opserr << "Want: expControl dSpace tag boardName -trialCP cpTags -outCP cpTags "
                << "<-ctrlFilters (5 filterTag)> <-daqFilters (5 filterTag)>\n";
            return TCL_ERROR;
        }
        
        char *boardName;
        int i, cpTag;
        int numTrialCPs = 0, numOutCPs = 0;
        
        argi = 2;
        if (Tcl_GetInt(interp, argv[argi], &tag) != TCL_OK)  {
            opserr << "WARNING invalid expControl dSpace tag\n";
            return TCL_ERROR;
        }
        argi++;
        boardName = new char [strlen(argv[argi])+1];
        strcpy(boardName,argv[argi]);
        argi++;
        if (strcmp(argv[argi],"-trialCP") != 0)  {
            opserr << "WARNING expecting -trialCP cpTags\n";
            opserr << "expControl dSpace " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        while (argi+numTrialCPs < argc &&
            strcmp(argv[argi+numTrialCPs],"-outCP") != 0)  {
                numTrialCPs++;
        }
        if (numTrialCPs == 0)  {
            opserr << "WARNING no trialCPTags specified\n";
            opserr << "expControl dSpace " << tag << endln;
            return TCL_ERROR;
        }
        // create the array to hold the trial control points
        ExperimentalCP **trialCPs = new ExperimentalCP* [numTrialCPs];
        if (trialCPs == 0)  {
            opserr << "WARNING out of memory\n";
            opserr << "expControl dSpace " << tag << endln;
            return TCL_ERROR;
        }
        for (i=0; i<numTrialCPs; i++)  {
            trialCPs[i] = 0;
            if (Tcl_GetInt(interp, argv[argi], &cpTag) != TCL_OK)  {
                opserr << "WARNING invalid cpTag\n";
                opserr << "expControl dSpace " << tag << endln;
                return TCL_ERROR;
            }
            trialCPs[i] = getExperimentalCP(cpTag);
            if (trialCPs[i] == 0)  {
                opserr << "WARNING experimental control point not found\n";
                opserr << "expControlPoint " << cpTag << endln;
                opserr << "expControl dSpace " << tag << endln;
                return TCL_ERROR;
            }
            argi++;
        }
        if (strcmp(argv[argi],"-outCP") != 0)  {
            opserr << "WARNING expecting -outCP cpTags\n";
            opserr << "expControl dSpace " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        while (argi+numOutCPs < argc &&
            strcmp(argv[argi+numOutCPs],"-ctrlFilters") != 0 &&
            strcmp(argv[argi+numOutCPs],"-daqFilters") != 0)  {
                numOutCPs++;
        }
        if (numOutCPs == 0)  {
            opserr << "WARNING no outCPTags specified\n";
            opserr << "expControl dSpace " << tag << endln;
            return TCL_ERROR;
        }
        // create the array to hold the output control points
        ExperimentalCP **outCPs = new ExperimentalCP* [numOutCPs];
        if (outCPs == 0)  {
            opserr << "WARNING out of memory\n";
            opserr << "expControl dSpace " << tag << endln;
            return TCL_ERROR;
        }
        for (i=0; i<numOutCPs; i++)  {
            outCPs[i] = 0;
            if (Tcl_GetInt(interp, argv[argi], &cpTag) != TCL_OK)  {
                opserr << "WARNING invalid cpTag\n";
                opserr << "expControl dSpace " << tag << endln;
                return TCL_ERROR;
            }
            outCPs[i] = getExperimentalCP(cpTag);
            if (outCPs[i] == 0)  {
                opserr << "WARNING experimental control point not found\n";
                opserr << "expControlPoint " << cpTag << endln;
                opserr << "expControl dSpace " << tag << endln;
                return TCL_ERROR;
            }
            argi++;
        }
        
        // parsing was successful, allocate the control
        theControl = new ECdSpace(tag, numTrialCPs, trialCPs,
            numOutCPs, outCPs, boardName);
    }
    
    // ----------------------------------------------------------------------------	
    else if (strcmp(argv[1],"MTSCsi") == 0)  {
        if (argc < 9)  {
            opserr << "WARNING invalid number of arguments\n";
            printCommand(argc,argv);
            opserr << "Want: expControl MTSCsi tag configFileName rampTime -trialCP cpTags -outCP cpTags "
                << "<-ctrlFilters (5 filterTag)> <-daqFilters (5 filterTag)>\n";
            return TCL_ERROR;
        }
        
        char *cfgFile;
        double rampTime;
        int i, cpTag;
        int numTrialCPs = 0, numOutCPs = 0;
        
        argi = 2;
        if (Tcl_GetInt(interp, argv[argi], &tag) != TCL_OK)  {
            opserr << "WARNING invalid expControl MTSCsi tag\n";
            return TCL_ERROR;
        }
        argi++;
        cfgFile = new char [strlen(argv[argi])+1];
        strcpy(cfgFile,argv[argi]);
        argi++;
        if (Tcl_GetDouble(interp, argv[argi], &rampTime) != TCL_OK)  {
            opserr << "WARNING invalid rampTime\n";
            opserr << "expControl MTSCsi " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        if (strcmp(argv[argi],"-trialCP") != 0)  {
            opserr << "WARNING expecting -trialCP cpTags\n";
            opserr << "expControl MTSCsi " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        while (argi+numTrialCPs < argc &&
            strcmp(argv[argi+numTrialCPs],"-outCP") != 0)  {
                numTrialCPs++;
        }
        if (numTrialCPs == 0)  {
            opserr << "WARNING no trialCPTags specified\n";
            opserr << "expControl MTSCsi " << tag << endln;
            return TCL_ERROR;
        }
        // create the array to hold the trial control points
        ExperimentalCP **trialCPs = new ExperimentalCP* [numTrialCPs];
        if (trialCPs == 0)  {
            opserr << "WARNING out of memory\n";
            opserr << "expControl MTSCsi " << tag << endln;
            return TCL_ERROR;
        }
        for (i=0; i<numTrialCPs; i++)  {
            trialCPs[i] = 0;
            if (Tcl_GetInt(interp, argv[argi], &cpTag) != TCL_OK)  {
                opserr << "WARNING invalid cpTag\n";
                opserr << "expControl MTSCsi " << tag << endln;
                return TCL_ERROR;
            }
            trialCPs[i] = getExperimentalCP(cpTag);
            if (trialCPs[i] == 0)  {
                opserr << "WARNING experimental control point not found\n";
                opserr << "expControlPoint " << cpTag << endln;
                opserr << "expControl MTSCsi " << tag << endln;
                return TCL_ERROR;
            }
            argi++;
        }
        if (strcmp(argv[argi],"-outCP") != 0)  {
            opserr << "WARNING expecting -outCP cpTags\n";
            opserr << "expControl MTSCsi " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        while (argi+numOutCPs < argc &&
            strcmp(argv[argi+numOutCPs],"-ctrlFilters") != 0 &&
            strcmp(argv[argi+numOutCPs],"-daqFilters") != 0)  {
                numOutCPs++;
        }
        if (numOutCPs == 0)  {
            opserr << "WARNING no outCPTags specified\n";
            opserr << "expControl MTSCsi " << tag << endln;
            return TCL_ERROR;
        }
        // create the array to hold the output control points
        ExperimentalCP **outCPs = new ExperimentalCP* [numOutCPs];
        if (outCPs == 0)  {
            opserr << "WARNING out of memory\n";
            opserr << "expControl MTSCsi " << tag << endln;
            return TCL_ERROR;
        }
        for (i=0; i<numOutCPs; i++)  {
            outCPs[i] = 0;
            if (Tcl_GetInt(interp, argv[argi], &cpTag) != TCL_OK)  {
                opserr << "WARNING invalid cpTag\n";
                opserr << "expControl MTSCsi " << tag << endln;
                return TCL_ERROR;
            }
            outCPs[i] = getExperimentalCP(cpTag);
            if (outCPs[i] == 0)  {
                opserr << "WARNING experimental control point not found\n";
                opserr << "expControlPoint " << cpTag << endln;
                opserr << "expControl MTSCsi " << tag << endln;
                return TCL_ERROR;
            }
            argi++;
        }
        
        // parsing was successful, allocate the control
        theControl = new ECMtsCsi(tag, numTrialCPs, trialCPs,
            numOutCPs, outCPs, cfgFile, rampTime);
    }

    /* ----------------------------------------------------------------------------	
    else if (strcmp(argv[1],"NIEseries") == 0)  {
        if (argc < 4)  {
            opserr << "WARNING invalid number of arguments\n";
            printCommand(argc,argv);
            opserr << "Want: expControl NIEseries tag device "
                << "<-ctrlFilters (5 filterTag)> <-daqFilters (5 filterTag)>\n";
            return TCL_ERROR;
        }
        
        int device;
        
        argi = 2;
        if (Tcl_GetInt(interp, argv[argi], &tag) != TCL_OK)  {
            opserr << "WARNING invalid expControl NIEseries tag\n";
            return TCL_ERROR;
        }
        argi++;
        if (Tcl_GetInt(interp, argv[argi], &device) != TCL_OK)  {
            opserr << "WARNING invalid device\n";
            opserr << "expControl NIEseries " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        
        // parsing was successful, allocate the control
        theControl = new ECNIEseries(tag, device);
    }*/
#endif

#if defined _WIN32 || defined _WIN64
    // ----------------------------------------------------------------------------	
    else if (strcmp(argv[1],"xPCtarget") == 0)  {
        if (argc < 10)  {
            opserr << "WARNING invalid number of arguments\n";
            printCommand(argc,argv);
            opserr << "Want: expControl xPCtarget tag ipAddr ipPort appFile -trialCP cpTags -outCP cpTags "
                << "<-timeOut t> <-ctrlFilters (5 filterTag)> <-daqFilters (5 filterTag)>\n";
            return TCL_ERROR;
        }
        
        char *ipAddr, *ipPort, *appFile;
        int i, cpTag, timeOut = 10;
        int numTrialCPs = 0, numOutCPs = 0;
        
        argi = 2;
        if (Tcl_GetInt(interp, argv[argi], &tag) != TCL_OK)  {
            opserr << "WARNING invalid expControl xPCtarget tag\n";
            return TCL_ERROR;
        }
        argi++;
        ipAddr = new char [strlen(argv[argi])+1];
        strcpy(ipAddr,argv[argi]);
        argi++;
        ipPort = new char [strlen(argv[argi])+1];
        strcpy(ipPort,argv[argi]);
        argi++;
        appFile = new char [strlen(argv[argi])+1];
        strcpy(appFile,argv[argi]);
        argi++;
        if (strcmp(argv[argi],"-trialCP") != 0)  {
            opserr << "WARNING expecting -trialCP cpTags\n";
            opserr << "expControl xPCtarget " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        while (argi+numTrialCPs < argc &&
            strcmp(argv[argi+numTrialCPs],"-outCP") != 0)  {
                numTrialCPs++;
        }
        if (numTrialCPs == 0)  {
            opserr << "WARNING no trialCPTags specified\n";
            opserr << "expControl xPCtarget " << tag << endln;
            return TCL_ERROR;
        }
        // create the array to hold the trial control points
        ExperimentalCP **trialCPs = new ExperimentalCP* [numTrialCPs];
        if (trialCPs == 0)  {
            opserr << "WARNING out of memory\n";
            opserr << "expControl xPCtarget " << tag << endln;
            return TCL_ERROR;
        }
        for (i=0; i<numTrialCPs; i++)  {
            trialCPs[i] = 0;
            if (Tcl_GetInt(interp, argv[argi], &cpTag) != TCL_OK)  {
                opserr << "WARNING invalid cpTag\n";
                opserr << "expControl xPCtarget " << tag << endln;
                return TCL_ERROR;
            }
            trialCPs[i] = getExperimentalCP(cpTag);
            if (trialCPs[i] == 0)  {
                opserr << "WARNING experimental control point not found\n";
                opserr << "expControlPoint " << cpTag << endln;
                opserr << "expControl xPCtarget " << tag << endln;
                return TCL_ERROR;
            }
            argi++;
        }
        if (strcmp(argv[argi],"-outCP") != 0)  {
            opserr << "WARNING expecting -outCP cpTags\n";
            opserr << "expControl xPCtarget " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        while (argi+numOutCPs < argc &&
            strcmp(argv[argi+numOutCPs],"-ctrlFilters") != 0 &&
            strcmp(argv[argi+numOutCPs],"-daqFilters") != 0)  {
                numOutCPs++;
        }
        if (numOutCPs == 0)  {
            opserr << "WARNING no outCPTags specified\n";
            opserr << "expControl xPCtarget " << tag << endln;
            return TCL_ERROR;
        }
        // create the array to hold the output control points
        ExperimentalCP **outCPs = new ExperimentalCP* [numOutCPs];
        if (outCPs == 0)  {
            opserr << "WARNING out of memory\n";
            opserr << "expControl xPCtarget " << tag << endln;
            return TCL_ERROR;
        }
        for (i=0; i<numOutCPs; i++)  {
            outCPs[i] = 0;
            if (Tcl_GetInt(interp, argv[argi], &cpTag) != TCL_OK)  {
                opserr << "WARNING invalid cpTag\n";
                opserr << "expControl xPCtarget " << tag << endln;
                return TCL_ERROR;
            }
            outCPs[i] = getExperimentalCP(cpTag);
            if (outCPs[i] == 0)  {
                opserr << "WARNING experimental control point not found\n";
                opserr << "expControlPoint " << cpTag << endln;
                opserr << "expControl xPCtarget " << tag << endln;
                return TCL_ERROR;
            }
            argi++;
        }
        for (i=argi; i<argc; i++)  {
            if (i+1 < argc && strcmp(argv[i], "-timeOut") == 0)  {
                if (Tcl_GetInt(interp, argv[i+1], &timeOut) != TCL_OK)  {
                    opserr << "WARNING invalid timeOut value\n";
                    opserr << "expControl xPCtarget " << tag << endln;
                    return TCL_ERROR;
                }
            }
        }
        
        // parsing was successful, allocate the control
        theControl = new ECxPCtarget(tag, numTrialCPs, trialCPs,
            numOutCPs, outCPs, ipAddr, ipPort, appFile, timeOut);
    }
    
    // ----------------------------------------------------------------------------	
    else if (strcmp(argv[1],"LabVIEW") == 0)  {
        if (argc < 8)  {
            opserr << "WARNING invalid number of arguments\n";
            printCommand(argc,argv);
            opserr << "Want: expControl LabVIEW tag ipAddr <ipPort> -trialCP cpTags -outCP cpTags "
                << "<-ctrlFilters (5 filterTag)> <-daqFilters (5 filterTag)>\n";
            return TCL_ERROR;
        }
        
        char *ipAddr;
        int i, cpTag, ipPort = 44000;
        int numTrialCPs = 0, numOutCPs = 0;
        
        argi = 2;
        if (Tcl_GetInt(interp, argv[argi], &tag) != TCL_OK)  {
            opserr << "WARNING invalid expControl LabVIEW tag\n";
            return TCL_ERROR;
        }
        argi++;
        ipAddr = new char [strlen(argv[argi])+1];
        strcpy(ipAddr,argv[argi]);
        argi++;
        if (strcmp(argv[argi],"-trialCP") != 0)  {
            if (Tcl_GetInt(interp, argv[argi], &ipPort) != TCL_OK)  {
                opserr << "WARNING invalid ipPort\n";
                opserr << "expControl LabVIEW " << tag << endln;
                return TCL_ERROR;
            }
            argi++;
        }
        if (strcmp(argv[argi],"-trialCP") != 0)  {
            opserr << "WARNING expecting -trialCP cpTags\n";
            opserr << "expControl LabVIEW " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        while (argi+numTrialCPs < argc &&
            strcmp(argv[argi+numTrialCPs],"-outCP") != 0 &&
            strcmp(argv[argi+numTrialCPs],"-ctrlFilters") != 0 &&
            strcmp(argv[argi+numTrialCPs],"-daqFilters") != 0)  {
                numTrialCPs++;
        }
        if (numTrialCPs == 0)  {
            opserr << "WARNING no trialCPTags specified\n";
            opserr << "expControl LabVIEW " << tag << endln;
            return TCL_ERROR;
        }
        // create the array to hold the trial control points
        ExperimentalCP **trialCPs = new ExperimentalCP* [numTrialCPs];
        if (trialCPs == 0)  {
            opserr << "WARNING out of memory\n";
            opserr << "expControl LabVIEW " << tag << endln;
            return TCL_ERROR;
        }
        for (i=0; i<numTrialCPs; i++)  {
            trialCPs[i] = 0;
            if (Tcl_GetInt(interp, argv[argi], &cpTag) != TCL_OK)  {
                opserr << "WARNING invalid cpTag\n";
                opserr << "expControl LabVIEW " << tag << endln;
                return TCL_ERROR;
            }
            trialCPs[i] = getExperimentalCP(cpTag);
            if (trialCPs[i] == 0)  {
                opserr << "WARNING experimental control point not found\n";
                opserr << "expControlPoint " << cpTag << endln;
                opserr << "expControl LabVIEW " << tag << endln;
                return TCL_ERROR;
            }
            argi++;
        }
        if (strcmp(argv[argi],"-outCP") != 0)  {
            opserr << "WARNING expecting -outCP cpTags\n";
            opserr << "expControl LabVIEW " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        while (argi+numOutCPs < argc &&
            strcmp(argv[argi+numOutCPs],"-ctrlFilters") != 0 &&
            strcmp(argv[argi+numOutCPs],"-daqFilters") != 0)  {
                numOutCPs++;
        }
        if (numOutCPs == 0)  {
            opserr << "WARNING no outCPTags specified\n";
            opserr << "expControl LabVIEW " << tag << endln;
            return TCL_ERROR;
        }
        // create the array to hold the output control points
        ExperimentalCP **outCPs = new ExperimentalCP* [numOutCPs];
        if (outCPs == 0)  {
            opserr << "WARNING out of memory\n";
            opserr << "expControl LabVIEW " << tag << endln;
            return TCL_ERROR;
        }
        for (i=0; i<numOutCPs; i++)  {
            outCPs[i] = 0;
            if (Tcl_GetInt(interp, argv[argi], &cpTag) != TCL_OK)  {
                opserr << "WARNING invalid cpTag\n";
                opserr << "expControl LabVIEW " << tag << endln;
                return TCL_ERROR;
            }
            outCPs[i] = getExperimentalCP(cpTag);
            if (outCPs[i] == 0)  {
                opserr << "WARNING experimental control point not found\n";
                opserr << "expControlPoint " << cpTag << endln;
                opserr << "expControl LabVIEW " << tag << endln;
                return TCL_ERROR;
            }
            argi++;
        }
        
        // parsing was successful, allocate the control
        theControl = new ECLabVIEW(tag, numTrialCPs, trialCPs,
            numOutCPs, outCPs, ipAddr, ipPort);
    }
    
    // ----------------------------------------------------------------------------	
    else if (strcmp(argv[1],"SCRAMNet") == 0)  {
        if (argc < 5)  {
            opserr << "WARNING invalid number of arguments\n";
            printCommand(argc,argv);
            opserr << "Want: expControl SCRAMNet tag memOffset numActCh "
                << "<-ctrlFilters (5 filterTag)> <-daqFilters (5 filterTag)>\n";
            return TCL_ERROR;
        }
        
        int memOffset, numActCh;
        
        argi = 2;
        if (Tcl_GetInt(interp, argv[argi], &tag) != TCL_OK)  {
            opserr << "WARNING invalid expControl SCRAMNet tag\n";
            return TCL_ERROR;
        }
        argi++;
        if (Tcl_GetInt(interp, argv[argi], &memOffset) != TCL_OK)  {
            opserr << "WARNING invalid memOffset\n";
            opserr << "expControl SCRAMNet " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        if (Tcl_GetInt(interp, argv[argi], &numActCh) != TCL_OK)  {
            opserr << "WARNING invalid numActCh\n";
            opserr << "expControl SCRAMNet " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        
        // parsing was successful, allocate the control
        theControl = new ECSCRAMNet(tag, memOffset, numActCh);
    }
    
    // ----------------------------------------------------------------------------	
    else if (strcmp(argv[1],"SCRAMNetGT") == 0)  {
        if (argc < 5)  {
            opserr << "WARNING invalid number of arguments\n";
            printCommand(argc,argv);
            opserr << "Want: expControl SCRAMNetGT tag memOffset numActCh "
                << "<-ctrlFilters (5 filterTag)> <-daqFilters (5 filterTag)>\n";
            return TCL_ERROR;
        }
        
        int memOffset, numActCh;
        
        argi = 2;
        if (Tcl_GetInt(interp, argv[argi], &tag) != TCL_OK)  {
            opserr << "WARNING invalid expControl SCRAMNetGT tag\n";
            return TCL_ERROR;
        }
        argi++;
        if (Tcl_GetInt(interp, argv[argi], &memOffset) != TCL_OK)  {
            opserr << "WARNING invalid memOffset\n";
            opserr << "expControl SCRAMNetGT " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        if (Tcl_GetInt(interp, argv[argi], &numActCh) != TCL_OK)  {
            opserr << "WARNING invalid numActCh\n";
            opserr << "expControl SCRAMNetGT " << tag << endln;
            return TCL_ERROR;
        }
        argi++;
        
        // parsing was successful, allocate the control
        theControl = new ECSCRAMNetGT(tag, memOffset, numActCh);
    }
#endif
    
    // ----------------------------------------------------------------------------	
    else  {
        // experimental control type not recognized
        opserr << "WARNING unknown experimental control type: "
            <<  argv[1] << ": check the manual\n";
        return TCL_ERROR;
    }
    
    if (theControl == 0)  {
        opserr << "WARNING could not create experimental control " << argv[1] << endln;
        return TCL_ERROR;
    }
    
    // finally check for filters
    int i;
    for (i=argi; i<argc; i++)  {
        if (i+5 < argc && strcmp(argv[i], "-ctrlFilters") == 0)  {
            int filterTag;
            ExperimentalSignalFilter *theFilter = 0;
            for (int j=0; j<5; j++)  {
                if (Tcl_GetInt(interp, argv[i+1+j], &filterTag) != TCL_OK)  {
                    opserr << "WARNING invalid ctrlFilter tag\n";
                    opserr << "expControl: " << tag << endln;
                    return TCL_ERROR;
                }
                if (filterTag > 0)  {
                    theFilter = getExperimentalSignalFilter(filterTag);
                    if (theFilter == 0)  {
                        opserr << "WARNING experimental signal filter not found\n";
                        opserr << "expSignalFilter: " << filterTag << endln;
                        opserr << "expControl: " << tag << endln;
                        return TCL_ERROR;
                    }
                    theControl->setCtrlFilter(theFilter,j);
                }
            }
        }
    }
    for (i=argi; i<argc; i++)  {
        if (i+5 < argc && strcmp(argv[i], "-daqFilters") == 0)  {
            int filterTag;
            ExperimentalSignalFilter *theFilter = 0;
            for (int j=0; j<5; j++)  {
                if (Tcl_GetInt(interp, argv[i+1+j], &filterTag) != TCL_OK)  {
                    opserr << "WARNING invalid daqFilter tag\n";
                    opserr << "expControl: " << tag << endln;
                    return TCL_ERROR;
                }
                if (filterTag > 0)  {
                    theFilter = getExperimentalSignalFilter(filterTag);
                    if (theFilter == 0)  {
                        opserr << "WARNING experimental signal filter not found\n";
                        opserr << "expSignalFilter: " << filterTag << endln;
                        opserr << "expControl: " << tag << endln;
                        return TCL_ERROR;
                    }
                    theControl->setDaqFilter(theFilter,j);
                }
            }
        }
    }
    
    // now add the control to the modelBuilder
    if (addExperimentalControl(*theControl) < 0)  {
        delete theControl; // invoke the destructor, otherwise mem leak
        return TCL_ERROR;
    }
    
    return TCL_OK;
}
Exemplo n.º 11
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;
}