Skip to content

Commit fbfd041

Browse files
committed
Added: New tag <print_max/> in <postprocessing> scope.
Added: bool return value for Elasticity::initMaxVals().
1 parent aae1e9f commit fbfd041

8 files changed

Lines changed: 19 additions & 5 deletions

File tree

Elasticity/Elasticity.C

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,16 +1008,19 @@ std::string Elasticity::getEFieldName (size_t i) const
10081008
}
10091009

10101010

1011-
void Elasticity::initMaxVals (size_t nP)
1011+
bool Elasticity::initMaxVals (size_t nP)
10121012
{
10131013
#ifdef INT_DEBUG
10141014
std::cout <<"Elasticity::initMaxVals: "<< maxVal.size()
10151015
<<" --> "<< nP << std::endl;
10161016
#endif
1017+
if (!maxVal.empty() && nP == 1)
1018+
return true; // already allocated
10171019
if (maxVal.empty() && nP > 0)
10181020
maxVal.resize(this->getNoFields(2),PointValues(nP,PointValue(Vec3(),0.0)));
10191021
else for (PointValues& pval : maxVal)
10201022
std::fill(pval.begin(),pval.end(),PointValue(Vec3(),0.0));
1023+
return false;
10211024
}
10221025

10231026

Elasticity/Elasticity.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ class Elasticity : public ElasticBase
249249
//! determined. Otherwise, if it equals the number of patches in the model,
250250
//! the maximum values are computed for each patch separately. If \a nP is 0,
251251
//! the max-values buffer is initialized to zero without touching its size.
252-
void initMaxVals(size_t nP = 0);
252+
bool initMaxVals(size_t nP = 0);
253253

254254
//! \brief Returns a pointer to the max values for external update.
255255
std::vector<PointValues>* getMaxVals() const { return &maxVal; }

Elasticity/NonlinearDriver.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ int NonlinearDriver::solveProblem (DataExporter* writer, HDF5Restart* restart,
246246
else if (doProject)
247247
getMaxVals = true;
248248
if (getMaxVals && !printMax)
249-
const_cast<Elasticity*>(elp)->initMaxVals(1);
249+
printMax = const_cast<Elasticity*>(elp)->initMaxVals(1);
250250

251251
int iStep = aStep = 0; // Save initial state to VTF
252252
if (save0 && opt.format >= 0 && params.multiSteps() && params.time.dt > 0.0)

Elasticity/SIMElasticity.C

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,12 +662,21 @@ bool SIMElasticity<Dim>::parse (const tinyxml2::XMLElement* elem)
662662
plotRgd = true;
663663
else if (!strcasecmp(child->Value(),"strain"))
664664
Elasticity::wantStrain = true;
665+
else if (!strcasecmp(child->Value(),"print_max"))
666+
if (ElasticBase* elInt = this->getIntegrand(); elInt)
667+
{
668+
size_t nP = 1;
669+
if (bool pch; utl::getAttribute(child,"patch",pch) && pch)
670+
nP = Dim::myModel.size();
671+
static_cast<Elasticity*>(elInt)->initMaxVals(nP);
672+
}
665673
}
666674
else if (!strcasecmp(elem->Value(),"localsystem"))
667675
{
668676
if (ElasticBase* elInt = this->getIntegrand(); elInt)
669677
static_cast<Elasticity*>(elInt)->parseLocalSystem(elem);
670678
}
679+
671680
return true;
672681
}
673682

Test/Nonlinear/Necking-AxS-Fbar2.reg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Necking-AxS-Fbar2.xinp -outPrec 6 -printMax
1+
Necking-AxS-Fbar2.xinp -outPrec 6
22

33
Input file: Necking-AxS-Fbar2.xinp
44
Equation solver: 2

Test/Nonlinear/Necking-AxS-Fbar2.xinp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
<point patch="1" u="0.0" v="1.0"/>
5959
<point patch="1" u="1.0" v="1.0"/>
6060
</resultpoints>
61+
<print_max/>
6162
</postprocessing>
6263

6364
</simulation>

Test/Nonlinear/PrintConcrete2D-p2.reg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PrintConcrete2D-p2.xinp -printMax -ztol 0.001
1+
PrintConcrete2D-p2.xinp -ztol 0.001
22

33
Input file: PrintConcrete2D-p2.xinp
44
Equation solver: 2

Test/Nonlinear/PrintConcrete2D-p2.xinp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<postprocessing>
5252
<vtfformat>BINARY</vtfformat>
5353
<direct2nd/>
54+
<print_max/>
5455
</postprocessing>
5556

5657
</simulation>

0 commit comments

Comments
 (0)