示例#1
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;
}
示例#2
0
void *
OPS_FourNodeQuad3d()
{

  Element *theEle = 0;

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

  if (numRemainingArgs != 8 && numRemainingArgs != 12) {
    opserr << "ERROR - FourNodeQuad3d not enough args provided, want: element FourNodeQuad3d tag? iNode? jNode? kNode? lNode? thickness? type? matID? <p? rho? b1? b2?>\n";
  }

  // get the id and end nodes 
  int iData[6];
  double dData[5];
  dData[1] = 0.0;
  dData[2] = 0.0;
  dData[3] = 0.0;
  dData[4] = 0.0;

  int numData;
  int matTag = 0;
  int eleTag = 0;
  char *pType;

  numData = 5;
  if (OPS_GetIntInput(&numData, iData) != 0) {
    opserr << "WARNING element FourNodeQuad3d : invalid element data\n";
    return 0;
  }
  eleTag = iData[0];

  numData = 1;
  if (OPS_GetDoubleInput(&numData, dData) != 0) {
    opserr << "WARNING element FourNodeQuad3d : invalid thickness for element: " << eleTag << "\n";
    return 0;
  }

  if (OPS_GetStringCopy(&pType) != 0) {
    opserr << "WARNING element FourNodeQuad3d : invalid pType for element: " << eleTag << "\n";
  }

  numData = 1;
  if (OPS_GetIntInput(&numData, &matTag) != 0) {
    opserr << "WARNING element FourNodeQuad3d : invalid matTag for element: " << eleTag << "\n";
    delete [] pType;
    return 0;
  }


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

  if (numRemainingArgs == 12) {
    numData = 4;
    if (OPS_GetDoubleInput(&numData, &dData[1]) != 0) {
      opserr << "WARNING element FourNodeQuad3d : invalid optional args for element: " << eleTag << "\n";
      delete [] pType;
      return 0;
    }
  }

  // now create the truss and add it to the Domain
  theEle = new FourNodeQuad3d(eleTag, iData[1], iData[2], iData[3], iData[4],
			      *theMaterial, pType,
			      dData[0], dData[1], dData[2], dData[3], dData[4]);

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

  delete [] pType;
  return theEle;
}
示例#3
0
OPS_Export void *
OPS_SSPquad(void)
{
    if (num_SSPquad == 0) {
        num_SSPquad++;
        //OPS_Error("SSPquad element - Written: C.McGann, P.Arduino, P.Mackenzie-Helnwein, U.Washington\n", 1);
    }

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

    int numRemainingInputArgs = OPS_GetNumRemainingInputArgs();

    if (numRemainingInputArgs < 8) {
        opserr << "Invalid #args, want: element SSPquad eleTag? iNode? jNode? kNode? lNode? matTag? type? thickness? <b1? b2?>?\n";
        return 0;
    }

    int iData[6];
    char *theType;
    double dData[3];
    dData[1] = 0.0;
    dData[2] = 0.0;

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

    if (OPS_GetStringCopy(&theType) != 0) {
        opserr << "WARNING invalid type, want: ""PlaneStress"" or ""PlaneStrain""  element SSPquad " << iData[0] << endln;
        return 0;
    }

    numData = 1;
    if (OPS_GetDoubleInput(&numData, dData) != 0) {
        opserr << "WARNING invalid thickness data: element SSPquad " << iData[0] << endln;
        return 0;
    }

    int matID = iData[5];
    NDMaterial *theMaterial = OPS_GetNDMaterial(matID);
    if (theMaterial == 0) {
        opserr << "WARNING element SSPquad " << iData[0] << endln;
        opserr << " Material: " << matID << "not found\n";
        return 0;
    }

    if (numRemainingInputArgs == 10) {
        numData = 2;
        if (OPS_GetDoubleInput(&numData, &dData[1]) != 0) {
            opserr << "WARNING invalid optional data: element SSPquad " << iData[0] << endln;
            return 0;
        }
    }

    // parsing was successful, allocate the element
    theElement = new SSPquad(iData[0], iData[1], iData[2], iData[3], iData[4],
                             *theMaterial, theType, dData[0], dData[1], dData[2]);

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

    return theElement;
}