Two questions about the ZeroLength.cpp :
1) There is a "dispDiff(i)" function used in the "computeCurrentStrain1d" method. Where is "dispDiff(i)" defined?
2) What is the difference between (a) "diff" and (b) "dispDiff", where :
(a) the "diff" in the "upDate" function is given as:
const Vector& disp1 = theNodes[0]->getTrialDisp();
const Vector& disp2 = theNodes[1]->getTrialDisp();
Vector diff = disp2-disp1;
AND
(b) "dispDiff" is used as :
double MyElement::computeCurrentStrain1d( int mat, const Vector& dispDiff ) const
{
double strain = 0.0;
for (int i=0; i<numDOF/2; i++)
{
strain += -dispDiff(i) * (*t1d)(mat,i);
}
return strain;
}
Thanks
Strains in zerolength
Moderators: silvia, selimgunay, Moderators
Let's take these one at a time. You're actually asking a general C++ question.
dispDiff is what's called a formal parameter. It's part of a method declaration:
double computeCurrentStrain1d( int mat, const Vector& dispDiff ) const;
diff is a local paramater, declared inside the method named update:
int ZeroLength::update(void)
{
Vector diff = disp2-disp1;
//diff can be used as an actual parameter and we can
// pass it in and call the method, as below
this->computeCurrentStrain1d(mat,diff ); // here diff gets used as if
//it was dispDiff
}
Hope this helps.
alisa
<<
Two questions about the ZeroLength.cpp :
1) There is a "dispDiff(i)" function used in the "computeCurrentStrain1d" method. Where is "dispDiff(i)" defined?
2) What is the difference between (a) "diff" and (b) "dispDiff", where :
(a) the "diff" in the "upDate" function is given as:
const Vector& disp1 = theNodes[0]->getTrialDisp();
const Vector& disp2 = theNodes[1]->getTrialDisp();
Vector diff = disp2-disp1;
>>
dispDiff is what's called a formal parameter. It's part of a method declaration:
double computeCurrentStrain1d( int mat, const Vector& dispDiff ) const;
diff is a local paramater, declared inside the method named update:
int ZeroLength::update(void)
{
Vector diff = disp2-disp1;
//diff can be used as an actual parameter and we can
// pass it in and call the method, as below
this->computeCurrentStrain1d(mat,diff ); // here diff gets used as if
//it was dispDiff
}
Hope this helps.
alisa
<<
Two questions about the ZeroLength.cpp :
1) There is a "dispDiff(i)" function used in the "computeCurrentStrain1d" method. Where is "dispDiff(i)" defined?
2) What is the difference between (a) "diff" and (b) "dispDiff", where :
(a) the "diff" in the "upDate" function is given as:
const Vector& disp1 = theNodes[0]->getTrialDisp();
const Vector& disp2 = theNodes[1]->getTrialDisp();
Vector diff = disp2-disp1;
>>