Skip to content

Commit 9c7470c

Browse files
committed
Changed: char as type on the prinDir argument.
Added: Store evaluation time for secondary solution. Fixed: Reinitialize the max value buffer when nP is zero.
1 parent f329592 commit 9c7470c

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

Elasticity.C

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,11 @@ void Elasticity::initIntegration (size_t, size_t nBp)
313313
}
314314

315315

316-
void Elasticity::initResultPoints (double, bool prinDir)
316+
void Elasticity::initResultPoints (double time, char prinDir)
317317
{
318-
if (wantPrincipalStress && prinDir)
318+
myTime = time;
319+
320+
if (wantPrincipalStress && prinDir > 0)
319321
{
320322
if (!pDirBuf) pDirBuf = new Vec3Vec();
321323
pDirBuf->clear();
@@ -1014,7 +1016,7 @@ void Elasticity::printMaxVals (std::streamsize precision, size_t comp) const
10141016
continue; // no value
10151017

10161018
std::string name = this->getField2Name(i,nullptr);
1017-
os <<" Max "<< name <<":";
1019+
os <<" Max "<< name.substr(0,16) <<":";
10181020
if (name.size() < 16)
10191021
os << std::string(16-name.size(),' ');
10201022
for (size_t p = 0; p < maxVal[i].size(); p++)

Elasticity.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ class Elasticity : public ElasticBase
9090
virtual void initIntegration(size_t nGp, size_t nBp);
9191

9292
//! \brief Initializes the integrand for a new result point loop.
93-
//! \param[in] lambda Load parameter
94-
//! \param[in] prinDirs If \e true, compute/store principal directions
95-
virtual void initResultPoints(double lambda, bool prinDirs);
93+
//! \param[in] time Current time
94+
//! \param[in] prinDirs If &gt; 0, compute/store principal directions
95+
virtual void initResultPoints(double time, char prinDirs);
9696

9797
using ElasticBase::getLocalIntegral;
9898
//! \brief Returns a local integral container for the given element.
@@ -223,8 +223,9 @@ class Elasticity : public ElasticBase
223223
//! to calculate the maximum stress values in the model. If the argument \a nP
224224
//! is equal to 1, only the global maxima over all patches in the model are
225225
//! determined. Otherwise, if it equals the number of patches in the model,
226-
//! the maximum values are computed for each patch separately.
227-
void initMaxVals(size_t nP = 1);
226+
//! the maximum values are computed for each patch separately. If \a nP is 0,
227+
//! the max-values buffer is initialized to zero without touching its size.
228+
void initMaxVals(size_t nP = 0);
228229

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

NonlinearDriver.C

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ int NonlinearDriver::solveProblem (DataExporter* writer, HDF5Restart* restart,
241241
getMaxVals = printMax = false;
242242
else if (doProject)
243243
getMaxVals = true;
244+
if (getMaxVals && !printMax)
245+
const_cast<Elasticity*>(elp)->initMaxVals(1);
244246

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

0 commit comments

Comments
 (0)