本文整理汇总了C++中AnalysisModel::updateDomain方法的典型用法代码示例。如果您正苦于以下问题:C++ AnalysisModel::updateDomain方法的具体用法?C++ AnalysisModel::updateDomain怎么用?C++ AnalysisModel::updateDomain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnalysisModel
的用法示例。
在下文中一共展示了AnalysisModel::updateDomain方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: newStep
int HHT::newStep(double _deltaT)
{
deltaT = _deltaT;
if (beta == 0 || gamma == 0 ) {
opserr << "HHT::newStep() - error in variable\n";
opserr << "gamma = " << gamma << " beta = " << beta << endln;
return -1;
}
if (deltaT <= 0.0) {
opserr << "HHT::newStep() - error in variable\n";
opserr << "dT = " << deltaT << endln;
return -2;
}
// get a pointer to the AnalysisModel
AnalysisModel *theModel = this->getAnalysisModel();
// set the constants
c1 = 1.0;
c2 = gamma/(beta*deltaT);
c3 = 1.0/(beta*deltaT*deltaT);
if (U == 0) {
opserr << "HHT::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;
// determine new velocities and accelerations at t+deltaT
double a1 = (1.0 - gamma/beta);
double a2 = deltaT*(1.0 - 0.5*gamma/beta);
Udot->addVector(a1, *Utdotdot, a2);
double a3 = -1.0/(beta*deltaT);
double a4 = 1.0 - 0.5/beta;
Udotdot->addVector(a4, *Utdot, a3);
// determine the velocities at t+alpha*deltaT
(*Ualphadot) = *Utdot;
Ualphadot->addVector((1.0-alpha), *Udot, alpha);
// set the trial response quantities
theModel->setVel(*Ualphadot);
theModel->setAccel(*Udotdot);
// increment the time to t+alpha*deltaT and apply the load
double time = theModel->getCurrentDomainTime();
time += alpha*deltaT;
if (theModel->updateDomain(time, deltaT) < 0) {
opserr << "HHT::newStep() - failed to update the domain\n";
return -4;
}
return 0;
}
示例3:
int
DisplacementControl::update(const Vector &dU)
{
if (theDofID == -1) {
opserr << "DisplacementControl::newStep() - domainChanged has not been called\n";
return -1;
}
AnalysisModel *theModel = this->getAnalysisModel();
LinearSOE *theLinSOE = this->getLinearSOE();
if (theModel == 0 || theLinSOE == 0) {
opserr << "WARNING DisplacementControl::update() ";
opserr << "No AnalysisModel or LinearSOE has been set\n";
return -1;
}
(*deltaUbar) = dU; // have to do this as the SOE is gonna change
double dUabar = (*deltaUbar)(theDofID);
// determine dUhat
theLinSOE->setB(*phat);
theLinSOE->solve();
(*deltaUhat) = theLinSOE->getX();
double dUahat = (*deltaUhat)(theDofID);
if (dUahat == 0.0) {
opserr << "WARNING DisplacementControl::update() ";
opserr << "dUahat is zero -- zero reference displacement at control node DOF\n";
return -1;
}
// determine delta lambda(1) == dlambda
double dLambda = -dUabar/dUahat;
// determine delta U(i)
(*deltaU) = (*deltaUbar);
deltaU->addVector(1.0, *deltaUhat,dLambda);
// update dU and dlambda
(*deltaUstep) += *deltaU;
deltaLambdaStep += dLambda;
currentLambda += dLambda;
// update the model
theModel->incrDisp(*deltaU);
theModel->applyLoadDomain(currentLambda);
if (theModel->updateDomain() < 0) {
opserr << "DisplacementControl::update - model failed to update for new dU\n";
return -1;
}
// set the X soln in linearSOE to be deltaU for convergence Test
theLinSOE->setX(*deltaU);
numIncrLastStep++;
return 0;
}
示例4: update
int NewmarkHSFixedNumIter::update(const Vector &deltaU)
{
AnalysisModel *theModel = this->getAnalysisModel();
if (theModel == 0) {
opserr << "WARNING NewmarkHSFixedNumIter::update() - no AnalysisModel set\n";
return -1;
}
ConvergenceTest *theTest = this->getConvergenceTest();
if (theTest == 0) {
opserr << "WARNING NewmarkHSFixedNumIter::update() - no ConvergenceTest set\n";
return -2;
}
// check domainChanged() has been called, i.e. Ut will not be zero
if (Ut == 0) {
opserr << "WARNING NewmarkHSFixedNumIter::update() - domainChange() failed or not called\n";
return -3;
}
// check deltaU is of correct size
if (deltaU.Size() != U->Size()) {
opserr << "WARNING NewmarkHSFixedNumIter::update() - Vectors of incompatible size";
opserr << " expecting " << U->Size() << " obtained " << deltaU.Size() << endln;
return -4;
}
// get interpolation location and scale displacement increment
x = (double) theTest->getNumTests()/theTest->getMaxNumTests();
if (polyOrder == 1) {
(*scaledDeltaU) = x*((*U)+deltaU) - (x-1.0)*(*Ut) - (*U);
}
else if (polyOrder == 2) {
(*scaledDeltaU) = x*(x+1.0)/2.0*((*U)+deltaU) - (x-1.0)*(x+1.0)*(*Ut)
+ (x-1.0)*x/2.0*(*Utm1) - (*U);
}
else if (polyOrder == 3) {
(*scaledDeltaU) = x*(x+1.0)*(x+2.0)/6.0*((*U)+deltaU) - (x-1.0)*(x+1.0)*(x+2.0)/2.0*(*Ut)
+ (x-1.0)*x*(x+2.0)/2.0*(*Utm1) - (x-1.0)*x*(x+1.0)/6.0*(*Utm2) - (*U);
}
else {
opserr << "WARNING NewmarkHSFixedNumIter::update() - polyOrder > 3 not supported\n";
}
// determine the response at t+deltaT
U->addVector(1.0, *scaledDeltaU, c1);
Udot->addVector(1.0, *scaledDeltaU, c2);
Udotdot->addVector(1.0, *scaledDeltaU, c3);
// update the response at the DOFs
theModel->setResponse(*U,*Udot,*Udotdot);
if (theModel->updateDomain() < 0) {
opserr << "NewmarkHSFixedNumIter::update() - failed to update the domain\n";
return -5;
}
return 0;
}
示例5: newStep
int NewmarkExplicit::newStep(double deltaT)
{
updateCount = 0;
if (gamma == 0) {
opserr << "NewmarkExplicit::newStep() - error in variable\n";
opserr << "gamma = " << gamma << endln;
return -1;
}
if (deltaT <= 0.0) {
opserr << "NewmarkExplicit::newStep() - error in variable\n";
opserr << "dT = " << deltaT << endln;
return -2;
}
// get a pointer to the AnalysisModel
AnalysisModel *theModel = this->getAnalysisModel();
// set the constants
c2 = gamma*deltaT;
c3 = 1.0;
if (U == 0) {
opserr << "NewmarkExplicit::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;
// determine new response at time t+deltaT
U->addVector(1.0, *Utdot, deltaT);
double a1 = 0.5*deltaT*deltaT;
U->addVector(1.0, *Utdotdot, a1);
double a2 = deltaT*(1.0 - gamma);
Udot->addVector(1.0, *Utdotdot, a2);
Udotdot->Zero();
// set the trial response quantities
theModel->setResponse(*U, *Udot, *Udotdot);
// increment the time to t+deltaT and apply the load
double time = theModel->getCurrentDomainTime();
time += deltaT;
if (theModel->updateDomain(time, deltaT) < 0) {
opserr << "NewmarkExplicit::newStep() - failed to update the domain\n";
return -4;
}
return 0;
}
示例6: update
int CentralDifference::update(const Vector &U)
{
updateCount++;
if (updateCount > 1) {
opserr << "WARNING CentralDifference::update() - called more than once -";
opserr << " CentralDifference integration scheme requires a LINEAR solution algorithm\n";
return -1;
}
AnalysisModel *theModel = this->getAnalysisModel();
if (theModel == 0) {
opserr << "WARNING CentralDifference::update() - no AnalysisModel set\n";
return -1;
}
// check domainChanged() has been called, i.e. Ut will not be zero
if (Ut == 0) {
opserr << "WARNING CentralDifference::update() - domainChange() failed or not called\n";
return -2;
}
// check U is of correct size
if (U.Size() != Ut->Size()) {
opserr << "WARNING CentralDifference::update() - Vectors of incompatible size ";
opserr << " expecting " << Ut->Size() << " obtained " << U.Size() << endln;
return -3;
}
// determine the response at t+deltaT
Udot->addVector(0.0, U, 3.0);
Udot->addVector(1.0, *Ut, -4.0);
Udot->addVector(1.0, *Utm1, 1.0);
(*Udot) *= c2;
Udotdot->addVector(0.0, *Udot, 1.0);
Udotdot->addVector(1.0, *Utdot, -1.0);
(*Udotdot) /= deltaT;
// update the response at the DOFs
theModel->setResponse(U, *Udot, *Udotdot);
if (theModel->updateDomain() < 0) {
opserr << "CentralDifference::update() - failed to update the domain\n";
return -4;
}
// set response at t to be that at t+deltaT of previous step
(*Utm1) = *Ut;
(*Ut) = U;
return 0;
}
示例7: sqrt
int
ArcLength::newStep(void)
{
// get pointers to AnalysisModel and LinearSOE
AnalysisModel *theModel = this->getAnalysisModel();
LinearSOE *theLinSOE = this->getLinearSOE();
if (theModel == 0 || theLinSOE == 0) {
opserr << "WARNING ArcLength::newStep() ";
opserr << "No AnalysisModel or LinearSOE has been set\n";
return -1;
}
// get the current load factor
currentLambda = theModel->getCurrentDomainTime();
if (deltaLambdaStep < 0)
signLastDeltaLambdaStep = -1;
else
signLastDeltaLambdaStep = +1;
// determine dUhat
this->formTangent();
theLinSOE->setB(*phat);
if (theLinSOE->solve() < 0) {
opserr << "ArcLength::newStep(void) - failed in solver\n";
return -1;
}
(*deltaUhat) = theLinSOE->getX();
Vector &dUhat = *deltaUhat;
// determine delta lambda(1) == dlambda
double dLambda = sqrt(arcLength2/((dUhat^dUhat)+alpha2));
dLambda *= signLastDeltaLambdaStep; // base sign of load change
// on what was happening last step
deltaLambdaStep = dLambda;
currentLambda += dLambda;
// determine delta U(1) == dU
(*deltaU) = dUhat;
(*deltaU) *= dLambda;
(*deltaUstep) = (*deltaU);
// update model with delta lambda and delta U
theModel->incrDisp(*deltaU);
theModel->applyLoadDomain(currentLambda);
theModel->updateDomain();
return 0;
}
示例8: update
int AlphaOS::update(const Vector &deltaU)
{
updateCount++;
if (updateCount > 1) {
opserr << "WARNING AlphaOS::update() - called more than once -";
opserr << " AlphaOS integration scheme requires a LINEAR solution algorithm\n";
return -1;
}
AnalysisModel *theModel = this->getAnalysisModel();
if (theModel == 0) {
opserr << "WARNING AlphaOS::update() - no AnalysisModel set\n";
return -2;
}
// check domainChanged() has been called, i.e. Ut will not be zero
if (Ut == 0) {
opserr << "WARNING AlphaOS::update() - domainChange() failed or not called\n";
return -3;
}
// check deltaU is of correct size
if (deltaU.Size() != U->Size()) {
opserr << "WARNING AlphaOS::update() - Vectors of incompatible size ";
opserr << " expecting " << U->Size() << " obtained " << deltaU.Size() << "\n";
return -4;
}
// save the predictor displacements
(*Upt) = *U;
// determine the response at t+deltaT
U->addVector(1.0, deltaU, c1);
Udot->addVector(1.0, deltaU, c2);
Udotdot->addVector(0.0, deltaU, c3);
// update the response at the DOFs
theModel->setVel(*Udot);
theModel->setAccel(*Udotdot);
if (theModel->updateDomain() < 0) {
opserr << "AlphaOS::update() - failed to update the domain\n";
return -5;
}
// do not update displacements in elements only at nodes
theModel->setDisp(*U);
return 0;
}
示例9:
int
HHT1::commit(void)
{
AnalysisModel *theModel = this->getAnalysisModel();
if (theModel == 0) {
opserr << "WARNING HHT1::commit() - no AnalysisModel set\n";
return -1;
}
// update the responses at the DOFs
theModel->setResponse(*U,*Udot,*Udotdot);
theModel->updateDomain();
return theModel->commitDomain();
}
示例10: domainChange
int
CentralDifferenceAlternative::update(const Vector &X)
{
updateCount++;
if (updateCount > 1) {
opserr << "ERROR CentralDifferenceAlternative::update() - called more than once -";
opserr << " Central Difference integraion schemes require a LINEAR solution algorithm\n";
return -1;
}
AnalysisModel *theModel = this->getAnalysisModel();
if (theModel == 0) {
opserr << "ERROR CentralDifferenceAlternative::update() - no AnalysisModel set\n";
return -2;
}
// check domainChanged() has been called, i.e. Ut will not be zero
if (Ut == 0) {
opserr << "WARNING CentralDifferenceAlternative::update() - domainChange() failed or not called\n";
return -2;
}
// check deltaU is of correct size
if (X.Size() != Ut->Size()) {
opserr << "WARNING CentralDifferenceAlternative::update() - Vectors of incompatible size ";
opserr << " expecting " << Ut->Size() << " obtained " << X.Size() << endln;
return -3;
}
// determine the displacement at t+delta t
Utp1->addVector(0.0, X, deltaT * deltaT);
(*Utp1) += *Ut;
Utp1->addVector(1.0, *Udot, deltaT);
// determine the vel at t+ 0.5 * delta t
(*Udot) = *Utp1;
(*Udot) -= *Ut;
(*Udot) *= (1.0/deltaT);
// update the disp & responses at the DOFs
theModel->setDisp(*Utp1);
theModel->setVel(*Udot);
theModel->updateDomain();
return 0;
}
示例11: update
int GeneralizedAlpha::update(const Vector &deltaU)
{
AnalysisModel *theModel = this->getAnalysisModel();
if (theModel == 0) {
opserr << "WARNING GeneralizedAlpha::update() - no AnalysisModel set\n";
return -1;
}
// check domainChanged() has been called, i.e. Ut will not be zero
if (Ut == 0) {
opserr << "WARNING GeneralizedAlpha::update() - domainChange() failed or not called\n";
return -2;
}
// check deltaU is of correct size
if (deltaU.Size() != U->Size()) {
opserr << "WARNING GeneralizedAlpha::update() - Vectors of incompatible size ";
opserr << " expecting " << U->Size() << " obtained " << deltaU.Size() << endln;
return -3;
}
// determine the response at t+deltaT
(*U) += deltaU;
Udot->addVector(1.0, deltaU, c2);
Udotdot->addVector(1.0, deltaU, c3);
// determine displacement and velocity at t+alphaF*deltaT
(*Ualpha) = *Ut;
Ualpha->addVector((1.0-alphaF), *U, alphaF);
(*Ualphadot) = *Utdot;
Ualphadot->addVector((1.0-alphaF), *Udot, alphaF);
// determine the velocities at t+alphaM*deltaT
(*Ualphadotdot) = *Utdotdot;
Ualphadotdot->addVector((1.0-alphaM), *Udotdot, alphaM);
// update the response at the DOFs
theModel->setResponse(*Ualpha,*Ualphadot,*Udotdot);
if (theModel->updateDomain() < 0) {
opserr << "GeneralizedAlpha::update() - failed to update the domain\n";
return -4;
}
return 0;
}
示例12:
int
ArcLength1::update(const Vector &dU)
{
AnalysisModel *theModel = this->getAnalysisModel();
LinearSOE *theLinSOE = this->getLinearSOE();
if (theModel == 0 || theLinSOE == 0) {
opserr << "WARNING ArcLength1::update() ";
opserr << "No AnalysisModel or LinearSOE has been set\n";
return -1;
}
(*deltaUbar) = dU; // have to do this as the SOE is gonna change
// determine dUhat
theLinSOE->setB(*phat);
theLinSOE->solve();
(*deltaUhat) = theLinSOE->getX();
// determine delta lambda(i)
double a = (*deltaUstep)^(*deltaUbar);
double b = (*deltaUstep)^(*deltaUhat) + alpha2*deltaLambdaStep;
if (b == 0) {
opserr << "ArcLength1::update() - zero denominator,";
opserr << " alpha was set to 0.0 and zero reference load\n";
return -1;
}
double dLambda = -a/b;
// determine delta U(i)
(*deltaU) = (*deltaUbar);
deltaU->addVector(1.0, *deltaUhat,dLambda);
// update dU and dlambda
(*deltaUstep) += *deltaU;
deltaLambdaStep += dLambda;
currentLambda += dLambda;
// update the model
theModel->incrDisp(*deltaU);
theModel->applyLoadDomain(currentLambda);
theModel->updateDomain();
// set the X soln in linearSOE to be deltaU for convergence Test
theLinSOE->setX(*deltaU);
return 0;
}
示例13: newStep
int CentralDifference::newStep(double _deltaT)
{
updateCount = 0;
deltaT = _deltaT;
if (deltaT <= 0.0) {
opserr << "CentralDifference::newStep() - error in variable\n";
opserr << "dT = " << deltaT << endln;
return -2;
}
// get a pointer to the AnalysisModel
AnalysisModel *theModel = this->getAnalysisModel();
// set the constants
c2 = 0.5/deltaT;
c3 = 1.0/(deltaT*deltaT);
if (Ut == 0) {
opserr << "CentralDifference::newStep() - domainChange() failed or hasn't been called\n";
return -3;
}
// determine the garbage velocities and accelerations at t
Utdot->addVector(0.0, *Utm1, -c2);
Utdotdot->addVector(0.0, *Ut, -2.0*c3);
Utdotdot->addVector(1.0, *Utm1, c3);
// set the garbage response quantities for the nodes
theModel->setVel(*Utdot);
theModel->setAccel(*Utdotdot);
// increment the time to t and apply the load
double time = theModel->getCurrentDomainTime();
if (theModel->updateDomain(time, deltaT) < 0) {
opserr << "CentralDifference::newStep() - failed to update the domain\n";
return -4;
}
// set response at t to be that at t+deltaT of previous step
(*Utdot) = *Udot;
(*Utdotdot) = *Udotdot;
return 0;
}
示例14: update
int KRAlphaExplicit::update(const Vector &aiPlusOne)
{
updateCount++;
if (updateCount > 1) {
opserr << "WARNING KRAlphaExplicit::update() - called more than once -";
opserr << " KRAlphaExplicit integration scheme requires a LINEAR solution algorithm\n";
return -1;
}
AnalysisModel *theModel = this->getAnalysisModel();
if (theModel == 0) {
opserr << "WARNING KRAlphaExplicit::update() - no AnalysisModel set\n";
return -1;
}
// check domainChanged() has been called, i.e. Ut will not be zero
if (Ut == 0) {
opserr << "WARNING KRAlphaExplicit::update() - domainChange() failed or not called\n";
return -2;
}
// check aiPlusOne is of correct size
if (aiPlusOne.Size() != U->Size()) {
opserr << "WARNING KRAlphaExplicit::update() - Vectors of incompatible size ";
opserr << " expecting " << U->Size() << " obtained " << aiPlusOne.Size() << endln;
return -3;
}
// determine the response at t+deltaT
//U->addVector(1.0, aiPlusOne, c1); // c1 = 0.0
//Udot->addVector(1.0, aiPlusOne, c2); // c2 = 0.0
Udotdot->addVector(0.0, aiPlusOne, 1.0);
// update the response at the DOFs
theModel->setResponse(*U, *Udot, *Udotdot);
if (updDomFlag == true) {
if (theModel->updateDomain() < 0) {
opserr << "WARNING KRAlphaExplicit::update() - failed to update the domain\n";
return -4;
}
}
return 0;
}
示例15:
int
ArcLengthw::update(const Vector &dU)
{
ofstream factor;
factor.open("FS.dat",ios::app);
factor<<"insideupdate"<<endln;
//factor>>dU;
factor<<"insideupdate1"<<endln;
AnalysisModel *theModel = this->getAnalysisModel();
LinearSOE *theLinSOE = this->getLinearSOE();
if (theModel == 0 || theLinSOE == 0) {
opserr << "WARNING ArcLengthw::update() ";
opserr << "No AnalysisModel or LinearSOE has been set\n";
return -1;
}
(*deltaUbar) = dU; // have to do this as the SOE is gonna change
// determine dUhat
theLinSOE->setB(*phat);
theLinSOE->solve();
(*deltaUhat) = theLinSOE->getX();
double dLambda = -((*phat)^(*deltaUbar))/((*phat)^(*deltaUhat));
(*deltaU) = (*deltaUbar);
deltaU->addVector(1.0, *deltaUhat,dLambda);
// update dU and dlambda
(*deltaUstep) += *deltaU;
deltaLambdaStep += dLambda;
currentLambda += dLambda;
// update the model
theModel->incrDisp(*deltaU);
theModel->applyLoadDomain(currentLambda);
theModel->updateDomain();
// set the X soln in linearSOE to be deltaU for convergence Test
theLinSOE->setX(*deltaU);
return 0;
}