本文整理汇总了C++中AnalysisModel::getDomainPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ AnalysisModel::getDomainPtr方法的具体用法?C++ AnalysisModel::getDomainPtr怎么用?C++ AnalysisModel::getDomainPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnalysisModel
的用法示例。
在下文中一共展示了AnalysisModel::getDomainPtr方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newStep
int PFEMIntegrator::newStep(double deltaT)
{
if (deltaT <= 0.0) {
opserr << "PFEMIntegrator::newStep() - error in variable\n";
opserr << "dT = " << deltaT << endln;
return -2;
}
// get a pointer to the AnalysisModel and Domain
AnalysisModel *theModel = this->getAnalysisModel();
if(theModel == 0) {
opserr << "Analysis model has not been linked - PFEMIntegrator::newStep()\n";
return -1;
}
Domain* theDomain = theModel->getDomainPtr();
if(theDomain == 0) {
opserr<<"WARNING: no domain is set for the model";
opserr<<" -- PFEMIntegrator::newStep()\n";
return -1;
}
// set the constants
c1 = deltaT;
c2 = 1.0;
c3 = 1.0/deltaT;
c4 = deltaT*deltaT;
c5 = deltaT;
c6 = 1.0;
// check if domainchange() is called
if (U == 0) {
opserr << "PFEMIntegrator::newStep() - domainChange() failed or hasn't been called\n";
return -3;
}
// set response at t to be that at t+deltaT of previous step
(*Ut) = *U;
(*Utdot) = *Udot;
(*Utdotdot) = *Udotdot;
// determinte new disps and accels
U->addVector(1.0, *Utdot, deltaT);
Udotdot->Zero();
// set states
theModel->setDisp(*U);
theModel->setAccel(*Udotdot);
// increment the time to t+deltaT and apply the load
double time = theModel->getCurrentDomainTime();
time += deltaT;
if (theModel->updateDomain(time, deltaT) < 0) {
opserr << "PFEMIntegrator::newStep() - failed to update the domain\n";
return -4;
}
return 0;
}
示例2: cp
int XC::ParallelNumberer::numberDOF(int lastDOF)
{
int result = 0;
// get a pointer to the model & check its not null
AnalysisModel *theModel = this->getAnalysisModelPtr();
Domain *theDomain = 0;
if(theModel) theDomain = theModel->getDomainPtr();
if(theModel == 0 || theDomain == 0)
{
std::cerr << "WARNING XC::ParallelNumberer::numberDOF(int) -";
std::cerr << " - no AnalysisModel.\n";
return -1;
}
if(lastDOF != -1)
{
std::cerr << "WARNING XC::ParallelNumberer::numberDOF(int lastDOF):";
std::cerr << " does not use the lastDOF as requested\n";
}
Graph &theGraph= theModel->getDOFGroupGraph();
// if subdomain, collect graph, send it off, get
// ID back containing dof tags & start id numbers.
if(processID != 0)
{
CommParameters cp(0,*theChannels[0]);
const int numVertex = theGraph.getNumVertex();
/*
static XC::ID test(2); test(0) = processID; test(1) = 25;
theChannel->recvID(0, 0, test);
*/
cp.sendMovable(theGraph,DistributedObj::getDbTagData(),CommMetaData(1));
// recv iD
ID theID(2*numVertex);
cp.receiveID(theID,DistributedObj::getDbTagData(),CommMetaData(2));
// set vertex numbering based on ID received
for(int i=0; i<numVertex; i ++)
{
const int vertexTag= theID(i);
int startID= theID(i+numVertex);
//Vertex *vertexPtr = theGraph.getVertexPtr(vertexTag);
const int dofTag= vertexTag;
DOF_Group *dofPtr= theModel->getDOF_GroupPtr(dofTag);
if(!dofPtr)
{
std::cerr << "WARNING ParallelNumberer::numberDOF - ";
std::cerr << "DOF_Group " << dofTag << "not in XC::AnalysisModel!\n";
result= -4;
}
else
{
const ID &theDOFID= dofPtr->getID();
//std::cerr << "P: " << processID << " dofTag: " << dofTag << " " << "start: " << startID << " " << theDOFID;
const int idSize= theDOFID.Size();
for(int j=0; j<idSize; j++)
if(theDOFID(j) == -2 || theDOFID(j) == -3) dofPtr->setID(j, startID++);
}
//const ID &theDOFID= dofPtr->getID();
}
cp.sendID(theID,DistributedObj::getDbTagData(),CommMetaData(2));
}
else
{
// if XC::main domain, collect graphs from all subdomains,
// merge into 1, number this one, send to subdomains the
// id containing dof tags & start id's.
// for P0 domain determine original vertex and ref tags
const int numVertex= theGraph.getNumVertex();
const int numVertexP0= numVertex;
ID vertexTags(numVertex);
ID vertexRefs(numVertex);
Vertex *vertexPtr;
int loc= 0;
VertexIter &theVertices= theGraph.getVertices();
while((vertexPtr= theVertices()) != 0)
{
vertexTags[loc]= vertexPtr->getTag();
vertexRefs[loc]= vertexPtr->getRef();
loc++;
}
const int numChannels= theChannels.size();
std::vector<ID> theSubdomainIDs(numChannels);
FEM_ObjectBroker theBroker;
// for each subdomain we receive graph, create an XC::ID (to store
// subdomain graph to merged graph vertex mapping and the final
// subdoain graph vertex to startDOF mapping) and finally merge the
// subdomain graph
for(int j=0; j<numChannels; j++)
//.........这里部分代码省略.........
示例3: setLinks
int
PlainNumberer::numberDOF(int lastDOF)
{
int eqnNumber = 0; // start equation number = 0
// get a pointer to the model & check its not null
AnalysisModel *theModel = this->getAnalysisModelPtr();
Domain *theDomain = 0;
if (theModel != 0) theDomain = theModel->getDomainPtr();
if (theModel == 0 || theDomain == 0) {
opserr << "WARNING PlainNumberer::numberDOF(int) -";
opserr << " - no AnalysisModel - has setLinks() been invoked?\n";
return -1;
}
if (lastDOF != -1) {
opserr << "WARNING PlainNumberer::numberDOF(int lastDOF):";
opserr << " does not use the lastDOF as requested\n";
}
// iterate throgh the DOFs first time setting -2 values
DOF_GrpIter &theDOFs = theModel->getDOFs();
DOF_Group *dofPtr;
while ((dofPtr = theDOFs()) != 0) {
const ID &theID = dofPtr->getID();
for (int i=0; i<theID.Size(); i++)
if (theID(i) == -2)
dofPtr->setID(i,eqnNumber++);
}
// iterate throgh the DOFs second time setting -3 values
DOF_GrpIter &moreDOFs = theModel->getDOFs();
while ((dofPtr = moreDOFs()) != 0) {
const ID &theID = dofPtr->getID();
for (int i=0; i<theID.Size(); i++)
if (theID(i) == -3) dofPtr->setID(i,eqnNumber++);
}
// iterate through the DOFs one last time setting any -4 values
DOF_GrpIter &tDOFs = theModel->getDOFs();
while ((dofPtr = tDOFs()) != 0) {
const ID &theID = dofPtr->getID();
int have4s = 0;
for (int i=0; i<theID.Size(); i++)
if (theID(i) == -4) have4s = 1;
if (have4s == 1) {
int nodeID = dofPtr->getNodeTag();
// loop through the MP_Constraints to see if any of the
// DOFs are constrained, note constraint matrix must be diagonal
// with 1's on the diagonal
MP_ConstraintIter &theMPs = theDomain->getMPs();
MP_Constraint *mpPtr;
while ((mpPtr = theMPs()) != 0 ) {
// note keep looping over all in case multiple constraints
// are used to constrain a node -- can't assume intelli user
if (mpPtr->getNodeConstrained() == nodeID) {
int nodeRetained = mpPtr->getNodeRetained();
Node *nodeRetainedPtr = theDomain->getNode(nodeRetained);
DOF_Group *retainedDOF = nodeRetainedPtr->getDOF_GroupPtr();
const ID&retainedDOFIDs = retainedDOF->getID();
const ID&constrainedDOFs = mpPtr->getConstrainedDOFs();
const ID&retainedDOFs = mpPtr->getRetainedDOFs();
for (int i=0; i<constrainedDOFs.Size(); i++) {
int dofC = constrainedDOFs(i);
int dofR = retainedDOFs(i);
int dofID = retainedDOFIDs(dofR);
dofPtr->setID(dofC, dofID);
}
}
}
}
}
eqnNumber--;
int numEqn = eqnNumber - START_EQN_NUMBER +1;
// iterate through the FE_Element getting them to set their IDs
FE_EleIter &theEle = theModel->getFEs();
FE_Element *elePtr;
while ((elePtr = theEle()) != 0)
elePtr->setID();
// set the numOfEquation in the Model
theModel->setNumEqn(numEqn);
return numEqn;
}
示例4: while
int
PFEMIntegrator::formSensitivityRHS(int passedGradNumber)
{
sensitivityFlag = 1;
// Set a couple of data members
gradNumber = passedGradNumber;
// Get pointer to the SOE
LinearSOE *theSOE = this->getLinearSOE();
// Get the analysis model
AnalysisModel *theModel = this->getAnalysisModel();
// Randomness in external load (including randomness in time series)
// Get domain
Domain *theDomain = theModel->getDomainPtr();
// Loop through nodes to zero the unbalaced load
Node *nodePtr;
NodeIter &theNodeIter = theDomain->getNodes();
while ((nodePtr = theNodeIter()) != 0)
nodePtr->zeroUnbalancedLoad();
// Loop through load patterns to add external load sensitivity
LoadPattern *loadPatternPtr;
LoadPatternIter &thePatterns = theDomain->getLoadPatterns();
double time;
while((loadPatternPtr = thePatterns()) != 0) {
time = theDomain->getCurrentTime();
loadPatternPtr->applyLoadSensitivity(time);
}
// Randomness in element/material contributions
// Loop through FE elements
FE_Element *elePtr;
FE_EleIter &theEles = theModel->getFEs();
while((elePtr = theEles()) != 0) {
theSOE->addB( elePtr->getResidual(this), elePtr->getID() );
}
// Loop through DOF groups (IT IS IMPORTANT THAT THIS IS DONE LAST!)
DOF_Group *dofPtr;
DOF_GrpIter &theDOFs = theModel->getDOFs();
while((dofPtr = theDOFs()) != 0) {
theSOE->addB( dofPtr->getUnbalance(this), dofPtr->getID() );
}
// Reset the sensitivity flag
sensitivityFlag = 0;
return 0;
}