当前位置: 首页>>代码示例>>C++>>正文


C++ UniaxialMaterial::getCopy方法代码示例

本文整理汇总了C++中UniaxialMaterial::getCopy方法的典型用法代码示例。如果您正苦于以下问题:C++ UniaxialMaterial::getCopy方法的具体用法?C++ UniaxialMaterial::getCopy怎么用?C++ UniaxialMaterial::getCopy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UniaxialMaterial的用法示例。


在下文中一共展示了UniaxialMaterial::getCopy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: theMaterial

// constructor:
//  responsible for allocating the necessary space needed by each object
//  and storing the tags of the CorotTruss end nodes.
CorotTruss::CorotTruss(int tag, int dim,
			   int Nd1, int Nd2, 
			   UniaxialMaterial &theMat,
			   double a, double r)
  :Element(tag,ELE_TAG_CorotTruss),     
  theMaterial(0), connectedExternalNodes(2),
  numDOF(0), numDIM(dim),
  Lo(0.0), Ln(0.0), 
  A(a), rho(r), R(3,3),
  theMatrix(0), theVector(0)
{
  // get a copy of the material and check we obtained a valid copy
  theMaterial = theMat.getCopy();
  if (theMaterial == 0) {
    opserr << "FATAL CorotTruss::CorotTruss - " <<  tag <<
      "failed to get a copy of material with tag " << theMat.getTag() << endln;
    exit(-1);
  }
  
  // ensure the connectedExternalNode ID is of correct size & set values
  if (connectedExternalNodes.Size() != 2) {
    opserr << "FATAL CorotTruss::CorotTruss - " <<  tag <<
      "failed to create an ID of size 2\n";
    exit(-1);
  }
  
  connectedExternalNodes(0) = Nd1;
  connectedExternalNodes(1) = Nd2;        

  // set node pointers to NULL
  theNodes[0] = 0;
  theNodes[1] = 0;
}
开发者ID:lge88,项目名称:OpenSees,代码行数:36,代码来源:CorotTruss.cpp

示例2: fprintf

matObj *OPS_GetMaterial(int *matTag, int *matType)
{

  if (*matType == OPS_UNIAXIAL_MATERIAL_TYPE) {
    UniaxialMaterial *theUniaxialMaterial = OPS_getUniaxialMaterial(*matTag);
    
    if (theUniaxialMaterial != 0) {
      
      UniaxialMaterial *theCopy = theUniaxialMaterial->getCopy();
      //  uniaxialMaterialObjectCount++;
      // theUniaxialMaterials[uniaxialMaterialObjectCount] = theCopy;
      
      matObject *theMatObject = new matObject;
      theMatObject->tag = *matTag;
      theMatObject->nParam = 1;
      theMatObject->nState = 0;
      
      theMatObject->theParam = new double[1];
      //  theMatObject->theParam[0] = uniaxialMaterialObjectCount;
      theMatObject->theParam[0] = 1; // code for uniaxial material
      
      theMatObject->tState = 0;
      theMatObject->cState = 0;
      theMatObject->matFunctPtr = OPS_InvokeMaterialObject;

      theMatObject->matObjectPtr = theCopy;
      
      return theMatObject;
    }
    
    fprintf(stderr,"getMaterial - no uniaxial material exists with tag %d\n", *matTag);    
    return 0;

  } else if (*matType == OPS_SECTION_TYPE) {
    fprintf(stderr,"getMaterial - not yet implemented for Section\n");    
    return 0;
  } else {

    //    NDMaterial *theNDMaterial = theModelBuilder->getNDMaterial(*matTag);

    //    if (theNDMaterial != 0) 
      //      theNDMaterial = theNDMaterial->getCopy(matType);
      //    else {
      //      fprintf(stderr,"getMaterial - no nd material exists with tag %d\n", *matTag);          
      //      return 0;
      //    }

      //    if (theNDMaterial == 0) {
    //      fprintf(stderr,"getMaterial - material with tag %d cannot deal with %d\n", *matTag, matType);          
    //      return 0;
    //    }

    fprintf(stderr,"getMaterial - not yet implemented for nDMaterial\n");    
    return 0;
  }

  fprintf(stderr,"getMaterial - unknown material type\n");    
  return 0;

}
开发者ID:aceskpark,项目名称:osfeo,代码行数:60,代码来源:elementAPI_Dummy.cpp

示例3: SectionForceDeformation

// constructors:
FiberSection3d::FiberSection3d(int tag, int num, Fiber **fibers): 
  SectionForceDeformation(tag, SEC_TAG_FiberSection3d),
  numFibers(num), sizeFibers(num), theMaterials(0), matData(0),
  QzBar(0.0), QyBar(0.0), Abar(0.0), yBar(0.0), zBar(0.0), sectionIntegr(0), e(3), s(0), ks(0)
{
  if (numFibers != 0) {
    theMaterials = new UniaxialMaterial *[numFibers];

    if (theMaterials == 0) {
      opserr << "FiberSection3d::FiberSection3d -- failed to allocate Material pointers\n";
      exit(-1);
    }

    matData = new double [numFibers*3];

    if (matData == 0) {
      opserr << "FiberSection3d::FiberSection3d -- failed to allocate double array for material data\n";
      exit(-1);
    }

    for (int i = 0; i < numFibers; i++) {
      Fiber *theFiber = fibers[i];
      double yLoc, zLoc, Area;
      theFiber->getFiberLocation(yLoc, zLoc);
      Area = theFiber->getArea();

      QzBar += yLoc*Area;
      QyBar += zLoc*Area;
      Abar  += Area;

      matData[i*3] = yLoc;
      matData[i*3+1] = zLoc;
      matData[i*3+2] = Area;
      UniaxialMaterial *theMat = theFiber->getMaterial();
      theMaterials[i] = theMat->getCopy();

      if (theMaterials[i] == 0) {
	opserr << "FiberSection3d::FiberSection3d -- failed to get copy of a Material\n";
	exit(-1);
      }
    }

    yBar = QzBar/Abar;
    zBar = QyBar/Abar;
  }

  s = new Vector(sData, 3);
  ks = new Matrix(kData, 3, 3);

  sData[0] = 0.0;
  sData[1] = 0.0;
  sData[2] = 0.0;

  for (int i=0; i<9; i++)
    kData[i] = 0.0;

  code(0) = SECTION_RESPONSE_P;
  code(1) = SECTION_RESPONSE_MZ;
  code(2) = SECTION_RESPONSE_MY;
}
开发者ID:DBorello,项目名称:OpenSeesDev,代码行数:61,代码来源:FiberSection3d.cpp

示例4:

int
FiberSection2d::addFiber(Fiber &newFiber)
{
  // need to create larger arrays
  int newSize = numFibers+1;
  UniaxialMaterial **newArray = new UniaxialMaterial *[newSize]; 
  double *newMatData = new double [2 * newSize];
  if (newArray == 0 || newMatData == 0) {
    opserr <<"FiberSection2d::addFiber -- failed to allocate Fiber pointers\n";
    return -1;
  }

  // copy the old pointers and data
  int i;
  for (i = 0; i < numFibers; i++) {
    newArray[i] = theMaterials[i];
    newMatData[2*i] = matData[2*i];
    newMatData[2*i+1] = matData[2*i+1];
  }

  // set the new pointers and data
  double yLoc, zLoc, Area;
  newFiber.getFiberLocation(yLoc, zLoc);
  Area = newFiber.getArea();
  newMatData[numFibers*2] = yLoc;
  newMatData[numFibers*2+1] = Area;
  UniaxialMaterial *theMat = newFiber.getMaterial();
  newArray[numFibers] = theMat->getCopy();

  if (newArray[numFibers] == 0) {
    opserr <<"FiberSection2d::addFiber -- failed to get copy of a Material\n";
    delete [] newMatData;
    return -1;
  }

  numFibers++;

  if (theMaterials != 0) {
    delete [] theMaterials;
    delete [] matData;
  }

  theMaterials = newArray;
  matData = newMatData;

  double Qz = 0.0;
  double A  = 0.0;

  // Recompute centroid
  for (i = 0; i < numFibers; i++) {
    yLoc = -matData[2*i];
    Area = matData[2*i+1];
    A  += Area;
    Qz += yLoc*Area;
  }

  yBar = Qz/A;

  return 0;
}
开发者ID:lge88,项目名称:OpenSees,代码行数:60,代码来源:FiberSection2d.cpp

示例5: connectedExternalNodes

//  Construct element with one unidirectional material (numMaterials1d=1)
CoupledZeroLength::CoupledZeroLength(int tag,
			 int Nd1, int Nd2, 
			 UniaxialMaterial &theMat,
			 int direction1, int direction2,
			 int doRayleigh)
  :Element(tag,ELE_TAG_CoupledZeroLength),     
   connectedExternalNodes(2),
   dimension(0), numDOF(0), transformation(3,3), useRayleighDamping(doRayleigh),
   theMatrix(0), theVector(0),
   theMaterial(0), dirn1(direction1), dirn2(direction2), d0(0), v0(0)
{
  // allocate memory for numMaterials1d uniaxial material models
  theMaterial = theMat.getCopy();
  if ( theMaterial == 0) {
    opserr << "FATAL CoupledZeroLength::CoupledZeroLength - failed to create a 1d  material\n";
    exit(-1);
  }

  // initialize uniaxial materials and directions and check for valid values
  if (direction1 < 0 || direction1 > 5 || direction2 < 0 || direction2 > 5) {
    opserr << "FATAL: CoupledZeroLength::CoupledZeroLength - invalid diection\n";
    exit(-1);
  }

  connectedExternalNodes(0) = Nd1;
  connectedExternalNodes(1) = Nd2;
  dX = 0.0;
  dY = 0.0;
  fX = 0.0;
  fY = 0.0;
}
开发者ID:DBorello,项目名称:OpenSees,代码行数:32,代码来源:CoupledZeroLength.cpp

示例6: SectionForceDeformation

// constructors:
FiberSection2d::FiberSection2d(int tag, int num, Fiber **fibers): 
  SectionForceDeformation(tag, SEC_TAG_FiberSection2d),
  numFibers(num), theMaterials(0), matData(0),
  yBar(0.0), sectionIntegr(0), e(2), eCommit(2), s(0), ks(0), dedh(2)
{
  if (numFibers != 0) {
    theMaterials = new UniaxialMaterial *[numFibers];

    if (theMaterials == 0) {
      opserr << "FiberSection2d::FiberSection2d -- failed to allocate Material pointers";
      exit(-1);
    }

    matData = new double [numFibers*2];

    if (matData == 0) {
      opserr << "FiberSection2d::FiberSection2d -- failed to allocate double array for material data\n";
      exit(-1);
    }


    double Qz = 0.0;
    double A  = 0.0;
    
    for (int i = 0; i < numFibers; i++) {
      Fiber *theFiber = fibers[i];
      double yLoc, zLoc, Area;
      theFiber->getFiberLocation(yLoc, zLoc);
      Area = theFiber->getArea();
      A  += Area;
      Qz += yLoc*Area;
      matData[i*2] = yLoc;
      matData[i*2+1] = Area;
      UniaxialMaterial *theMat = theFiber->getMaterial();
      theMaterials[i] = theMat->getCopy();

      if (theMaterials[i] == 0) {
	opserr << "FiberSection2d::FiberSection2d -- failed to get copy of a Material\n";
	exit(-1);
      }
    }    

    yBar = Qz/A;  
  }

  s = new Vector(sData, 2);
  ks = new Matrix(kData, 2, 2);

  sData[0] = 0.0;
  sData[1] = 0.0;

  kData[0] = 0.0;
  kData[1] = 0.0;
  kData[2] = 0.0;
  kData[3] = 0.0;

  code(0) = SECTION_RESPONSE_P;
  code(1) = SECTION_RESPONSE_MZ;
}
开发者ID:lge88,项目名称:OpenSees,代码行数:60,代码来源:FiberSection2d.cpp

示例7: theMaterial

PathIndependentMaterial::PathIndependentMaterial(int tag, UniaxialMaterial &material)
:UniaxialMaterial(tag,MAT_TAG_PathIndependent), theMaterial(0)
{
  theMaterial = material.getCopy();

  if (theMaterial == 0) {
    opserr <<  "PathIndependentMaterial::PathIndependentMaterial -- failed to get copy of material\n";
    exit(-1);
  }
}
开发者ID:DBorello,项目名称:OpenSees,代码行数:10,代码来源:PathIndependentMaterial.cpp

示例8: NDMaterial

//full constructor
PlateRebarMaterial::PlateRebarMaterial(int tag,
                                       UniaxialMaterial &uniMat,
                                       double ang) :
    NDMaterial( tag, ND_TAG_PlateRebarMaterial ),
    strain(5),angle(ang)
{
    theMat = uniMat.getCopy() ;
    double rang = ang * 0.0174532925;
    c = cos(rang);
    s = sin(rang);
}
开发者ID:aceskpark,项目名称:osfeo,代码行数:12,代码来源:PlateRebarMaterial.cpp

示例9: A

//first constructor ////////////////////////////////////////////////////////////////////////////
Quad4FiberOverlay::Quad4FiberOverlay(int tag, int nd1, int nd2, int nd3, int nd4,
UniaxialMaterial &m, double AreaFiber,double B1, double B2)
:Element(tag, ELE_TAG_Quad4FiberOverlay)
 ,theMaterial(0)
 ,externalNodes(SL_NUM_NODE)
 ,g1(SL_NUM_NDF)
 ,dualg1(SL_NUM_NDF)
 ,g2(SL_NUM_NDF)
 ,dualg2(SL_NUM_NDF)
 ,beta1(B1)
 ,beta2(B2)
 ,dNidxAlphai(SL_NUM_NODE,SL_NUM_NDF)
 ,Q1(SL_NUM_NDF) ,Q2(SL_NUM_NDF),Q3(SL_NUM_NDF),Q4(SL_NUM_NDF)
 ,Qfi(SL_NUM_NDF)
 ,Qfj(SL_NUM_NDF)
 ,Vf(SL_NUM_NDF)
 ,A(3)
 ,AA(3)
 ,Bb(SL_NUM_DOF)
 ,Af(AreaFiber)
 ,u(SL_NUM_DOF)
{	
	//determine int pts location based on fiber orientation
	nFi.Zero();
	nFj.Zero();
	A.Zero();	
	AA.Zero();
	nFi[0] = -1.0;
	nFi[1] = (beta1 - 0.5) * 2.0;
	nFj[0] = 1.0;
	nFj[1] = (beta2 - 0.5) * 2.0;
	A = nFj - nFi; 
	A.Normalize();
	AA[0] = A(0)*A(0);
	AA[1] = A(1)*A(1);
	AA[2] = A(1)*A(0);  // this must be 1* A1 A2 since strain uses gamma = 2 eps12
	//set up integration paramaters (2 intgr pts)
	pts[0][0] = nFi(0)+A(0)*(1-0.5773502691896258);   
	pts[0][1] = nFi(1)+A(1)*(1-0.5773502691896258);					    
	pts[1][0] = nFj(0)-A(0)*(1-0.5773502691896258);    
	pts[1][1] = nFj(1)-A(1)*(1-0.5773502691896258);					   

	wts[0] = 1.0;
	wts[1] = 1.0;
	externalNodes(0) = nd1;
	externalNodes(1) = nd2;
	externalNodes(2) = nd3;
	externalNodes(3) = nd4;
	theMaterial = m.getCopy();
	for(int i = 0; i<4;i++){ 
	theNodes[i] = 0;
	}

}
开发者ID:lge88,项目名称:OpenSees,代码行数:55,代码来源:Quad4FiberOverlay.cpp

示例10: theMaterial

MinMaxMaterial::MinMaxMaterial(int tag, UniaxialMaterial &material,
			       double min, double max)
  :UniaxialMaterial(tag,MAT_TAG_MinMax), theMaterial(0),
   minStrain(min), maxStrain(max), Tfailed(false), Cfailed(false)
{
  theMaterial = material.getCopy();

  if (theMaterial == 0) {
    opserr <<  "MinMaxMaterial::MinMaxMaterial -- failed to get copy of material\n";
    exit(-1);
  }
}
开发者ID:lge88,项目名称:OpenSees,代码行数:12,代码来源:MinMaxMaterial.cpp

示例11: code

//! @brief Constructor.
//!
//! Constructs a GenericSection1D whose unique integer tag among
//! SectionForceDeformation objects in the domain is given by \p tag. Obtains
//! a copy of the UniaxialMaterial \p m via a call to getCopy().
//! The section code is set to be \p code.
XC::GenericSection1d::GenericSection1d(int tag, UniaxialMaterial &m, int type)
  :PrismaticBarCrossSection(tag,SEC_TAG_Generic1d), code(type)
  {
    theModel = m.getCopy();

    if(!theModel)
      {
        std::cerr << getClassName() << "::" << __FUNCTION__
		  << "; failed to get copy of material model.\n";
        exit(-1);
      }
  }
开发者ID:lcpt,项目名称:xc,代码行数:18,代码来源:GenericSection1d.cpp

示例12: theMaterial

// constructor:
//  responsible for allocating the necessary space needed by each object
//  and storing the tags of the CorotTruss end nodes.
XC::CorotTruss::CorotTruss(int tag, int dim,int Nd1, int Nd2, UniaxialMaterial &theMat,double a)
  :CorotTrussBase(tag,ELE_TAG_CorotTruss,dim,Nd1,Nd2), theMaterial(nullptr), A(a)
  {
    // get a copy of the material and check we obtained a valid copy
    theMaterial = theMat.getCopy();
    if(theMaterial == 0)
      {
        std::cerr << getClassName() << "::" << __FUNCTION__
		  << "; FATAL error in element: " <<  tag
		  << "failed to get a copy of material with tag "
		  << theMat.getTag() << std::endl;
        exit(-1);
      }
  }
开发者ID:lcpt,项目名称:xc,代码行数:17,代码来源:CorotTruss.cpp

示例13: theBetaMaterial

Truss2::Truss2(int tag, 
	int dim,
	int Nd1, int Nd2, int oNd1, int oNd2, 
	UniaxialMaterial &theMat,
	double a, double r, int damp)
	:Element(tag,ELE_TAG_Truss2),     
	theMaterial(0), theBetaMaterial(0), connectedExternalNodes(2), connectedExternalOtherNodes(2),
	dimension(dim), numDOF(0), theLoad(0),
	theMatrix(0), theVector(0),
	L(0.0), A(a), rho(r), doRayleighDamping(damp)
{
	// get a copy of the material and check we obtained a valid copy
	theMaterial = theMat.getCopy();
	if (theMaterial == 0) {
	  opserr << "FATAL Truss2::Truss2 - " << tag <<
	    "failed to get a copy of material with tag " << theMat.getTag() << endln;
	  exit(-1);
	} else if (theMaterial->getClassTag() == MAT_TAG_ConcretewBeta) {
	  theBetaMaterial = (ConcretewBeta *) theMaterial;
	}

	// ensure the connectedExternalNode ID is of correct size & set values
	if (connectedExternalNodes.Size() != 2 || connectedExternalOtherNodes.Size() != 2) {
		opserr << "FATAL Truss2::Truss2 - " <<  tag << "failed to create an ID of size 2\n";
		exit(-1);
	}

	connectedExternalNodes(0) = Nd1;
	connectedExternalNodes(1) = Nd2; 

	/// some work to save the other nodes:
	connectedExternalOtherNodes(0) = oNd1;
	connectedExternalOtherNodes(1) = oNd2;

	// set node pointers to NULL
	for (int i=0; i<2; i++) {
		theNodes[i] = 0;
		theOtherNodes[i] = 0;
	}

	cosX[0] = 0.0;
	cosX[1] = 0.0;
	cosX[2] = 0.0;

	// AddingSensitivity:BEGIN /////////////////////////////////////
	parameterID = 0;
	theLoadSens = 0;
	// AddingSensitivity:END //////////////////////////////////////
}
开发者ID:DBorello,项目名称:OpenSees,代码行数:49,代码来源:Truss2.cpp

示例14: numDOF

N4BiaxialTruss::N4BiaxialTruss(int tag, 
int dim,
int Nd1, int Nd2, 
int GNd1, int GNd2, 
UniaxialMaterial &theMat,
double a, double r, int damp)
:Element(tag,ELE_TAG_N4BiaxialTruss),     
theMaterial_1(0), theBetaMaterial_1(0), 
theMaterial_2(0), theBetaMaterial_2(0), 
connectedExternalNodes(4),
dimension(dim), numDOF(0), theLoad(0),
theMatrix(0), theVector(0), theVector2(0),
L(0.0), A(a), rho(r), doRayleighDamping(damp)
{
	// get a copy of the material and check we obtained a valid copy
	theMaterial_1 = theMat.getCopy();
	theMaterial_2 = theMat.getCopy();
	if ((theMaterial_1 == 0) || (theMaterial_2 == 0)) {
		opserr << "FATAL N4BiaxialTruss::N4BiaxialTruss - " << tag <<
		"failed to get a copy of material with tag " << theMat.getTag() << endln;
		exit(-1);
	} else if (theMat.getClassTag() == MAT_TAG_ConcretewBeta) {
	  theBetaMaterial_1 = (ConcretewBeta *) theMaterial_1;
	  theBetaMaterial_2 = (ConcretewBeta *) theMaterial_2;
	}
	
	// ensure the connectedExternalNode ID is of correct size & set values
	if (connectedExternalNodes.Size() != 4) {
		opserr << "FATAL N4BiaxialTruss::N4BiaxialTruss - " <<  tag << "failed to create an node ID array of size 4\n";
		exit(-1);
	}

	connectedExternalNodes(0) = Nd1;
	connectedExternalNodes(1) = Nd2;
	connectedExternalNodes(2) = GNd1;
	connectedExternalNodes(3) = GNd2;

	// set node pointers to NULL
	for (int i=0; i<4; i++)
	theNodes[i] = 0;

	cosX[0] = 0.0;
	cosX[1] = 0.0;
	cosX[2] = 0.0;
}
开发者ID:aceskpark,项目名称:osfeo,代码行数:45,代码来源:N4BiaxialTruss.cpp

示例15: theMaterial

InitStressMaterial::InitStressMaterial(int tag, 
				       UniaxialMaterial &material,
				       double sigini)
  :UniaxialMaterial(tag,MAT_TAG_InitStress), theMaterial(0),
   epsInit(0.0), sigInit(sigini)
{
  theMaterial = material.getCopy();

  if (theMaterial == 0) {
    opserr <<  "InitStressMaterial::InitStressMaterial -- failed to get copy of material\n";
    exit(-1);
  }

  // determine the initial strain
  double tol=1e-12;
  double dSig = sigInit;
  double tStrain = 0.0, tStress = 0.0;
  int count = 0;

  do {
    count++;
    double K = theMaterial->getTangent();
    double dStrain = dSig/K;
    tStrain += dStrain;
    theMaterial->setTrialStrain(tStrain);
    tStress = theMaterial->getStress();
    dSig = sigInit-tStress;
  } while ((fabs(tStress-sigInit) > tol) && (count <= 100));

  epsInit = tStrain;

  if ((fabs(tStress-sigInit) < tol)) 
    theMaterial->setTrialStrain(epsInit);
  else {
    opserr << "WARNING: InitStressMaterial - could not find initStrain to within tol for material: " << tag;
    opserr << " wanted sigInit: " << sigInit << " using tStress: " << theMaterial->getStress() << endln;
  }

  theMaterial->commitState();
}
开发者ID:DBorello,项目名称:OpenSees,代码行数:40,代码来源:InitStressMaterial.cpp


注:本文中的UniaxialMaterial::getCopy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。