keepHistory for integration to automatically remove the fields related to integration. The default is no save on the disk

This commit is contained in:
Hamidreza 2025-04-17 02:41:36 +03:30
parent 077f25842a
commit 98a30bc98c
16 changed files with 69 additions and 33 deletions

View File

@ -97,10 +97,11 @@ pFlow::AdamsBashforth2::AdamsBashforth2
const word& baseName,
pointStructure& pStruct,
const word& method,
const realx3Field_D& initialValField
const realx3Field_D& initialValField,
bool keepHistory
)
:
integration(baseName, pStruct, method, initialValField),
integration(baseName, pStruct, method, initialValField, keepHistory),
realx3PointField_D
(
objectFile
@ -108,7 +109,7 @@ pFlow::AdamsBashforth2::AdamsBashforth2
groupNames(baseName,"dy1"),
pStruct.time().integrationFolder(),
objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS
keepHistory?objectFile::WRITE_ALWAYS:objectFile::WRITE_NEVER
),
pStruct,
zero3,

View File

@ -81,7 +81,8 @@ public:
const word& baseName,
pointStructure& pStruct,
const word& method,
const realx3Field_D& initialValField);
const realx3Field_D& initialValField,
bool keepHistory);
/// Destructor
~AdamsBashforth2()override = default;

View File

@ -109,10 +109,11 @@ pFlow::AdamsBashforth3::AdamsBashforth3
const word& baseName,
pointStructure& pStruct,
const word& method,
const realx3Field_D& initialValField
const realx3Field_D& initialValField,
bool keepHistory
)
:
AdamsBashforth2(baseName, pStruct, method, initialValField),
AdamsBashforth2(baseName, pStruct, method, initialValField, keepHistory),
dy2_
(
objectFile
@ -120,7 +121,7 @@ pFlow::AdamsBashforth3::AdamsBashforth3
groupNames(baseName,"dy2"),
pStruct.time().integrationFolder(),
objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS
keepHistory ? objectFile::WRITE_ALWAYS : objectFile::WRITE_NEVER
),
pStruct,
zero3,

View File

@ -71,7 +71,8 @@ public:
const word& baseName,
pointStructure& pStruct,
const word& method,
const realx3Field_D& initialValField);
const realx3Field_D& initialValField,
bool keepHistory);
/// Destructor

View File

@ -115,10 +115,11 @@ pFlow::AdamsBashforth4::AdamsBashforth4
const word& baseName,
pointStructure& pStruct,
const word& method,
const realx3Field_D& initialValField
const realx3Field_D& initialValField,
bool keepHistory
)
:
AdamsBashforth3(baseName, pStruct, method, initialValField),
AdamsBashforth3(baseName, pStruct, method, initialValField, keepHistory),
dy3_
(
objectFile
@ -126,7 +127,7 @@ pFlow::AdamsBashforth4::AdamsBashforth4
groupNames(baseName,"dy3"),
pStruct.time().integrationFolder(),
objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS
keepHistory?objectFile::WRITE_ALWAYS:objectFile::WRITE_NEVER
),
pStruct,
zero3,

View File

@ -69,7 +69,8 @@ public:
const word& baseName,
pointStructure& pStruct,
const word& method,
const realx3Field_D& initialValField);
const realx3Field_D& initialValField,
bool keepHistory);

View File

@ -123,10 +123,11 @@ pFlow::AdamsBashforth5::AdamsBashforth5
const word &baseName,
pointStructure &pStruct,
const word &method,
const realx3Field_D &initialValField
const realx3Field_D &initialValField,
bool keepHistory
)
:
AdamsBashforth4(baseName, pStruct, method, initialValField),
AdamsBashforth4(baseName, pStruct, method, initialValField, keepHistory),
dy4_
(
objectFile
@ -134,7 +135,7 @@ pFlow::AdamsBashforth5::AdamsBashforth5
groupNames(baseName,"dy4"),
pStruct.time().integrationFolder(),
objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS
keepHistory?objectFile::WRITE_ALWAYS:objectFile::WRITE_NEVER
),
pStruct,
zero3,

View File

@ -68,7 +68,8 @@ public:
const word& baseName,
pointStructure& pStruct,
const word& method,
const realx3Field_D& initialValField);
const realx3Field_D& initialValField,
bool keepHistory);

View File

@ -51,10 +51,12 @@ pFlow::integration::integration(
const word &baseName,
pointStructure &pStruct,
const word &,
const realx3Field_D &)
const realx3Field_D &,
bool keepHistory)
: owner_(*pStruct.owner()),
pStruct_(pStruct),
baseName_(baseName)
baseName_(baseName),
keepHistory_(keepHistory)
{}
@ -64,12 +66,13 @@ pFlow::uniquePtr<pFlow::integration>
const word& baseName,
pointStructure& pStruct,
const word& method,
const realx3Field_D& initialValField
const realx3Field_D& initialValField,
bool keepHistory
)
{
if( wordvCtorSelector_.search(method) )
{
return wordvCtorSelector_[method] (baseName, pStruct, method, initialValField);
return wordvCtorSelector_[method] (baseName, pStruct, method, initialValField, keepHistory);
}
else
{

View File

@ -24,6 +24,7 @@ Licence:
#include "virtualConstructor.hpp"
#include "pointFields.hpp"
#include "Logical.hpp"
namespace pFlow
@ -63,6 +64,8 @@ private:
/// The base name for integration
const word baseName_;
bool keepHistory_;
protected:
bool insertValues(
@ -83,7 +86,8 @@ public:
const word& baseName,
pointStructure& pStruct,
const word& method,
const realx3Field_D& initialValField);
const realx3Field_D& initialValField,
bool keepHistory);
/// Copy constructor
integration(const integration&) = default;
@ -109,9 +113,10 @@ public:
const word& baseName,
pointStructure& pStruct,
const word& method,
const realx3Field_D& initialValField
const realx3Field_D& initialValField,
bool keepHistory
),
(baseName, pStruct, method, initialValField)
(baseName, pStruct, method, initialValField, keepHistory)
);
@ -138,6 +143,11 @@ public:
return owner_;
}
bool keepHistory()const
{
return keepHistory_;
}
virtual
void updateBoundariesSlaveToMasterIfRequested() = 0;
/// return integration method
@ -164,7 +174,8 @@ public:
const word& baseName,
pointStructure& pStruct,
const word& method,
const realx3Field_D& initialValField);
const realx3Field_D& initialValField,
bool keepHistory);
}; // integration

View File

@ -248,7 +248,8 @@ pFlow::grainParticles::grainParticles(
"rVelocity",
dynPointStruct(),
intMethod,
rAcceleration_.field()
rAcceleration_.field(),
control.keepIntegrationHistory()
);
if( !rVelIntegration_ )

View File

@ -229,7 +229,8 @@ pFlow::sphereParticles::sphereParticles(
"rVelocity",
dynPointStruct(),
intMethod,
rAcceleration_.field()
rAcceleration_.field(),
control.keepIntegrationHistory()
);
if( !rVelIntegration_ )

View File

@ -58,13 +58,14 @@ pFlow::dynamicPointStructure::dynamicPointStructure
{
REPORT(1)<< "Creating integration method "<<
Green_Text(integrationMethod_)<<" for dynamicPointStructure."<<END_REPORT;
integrationPos_ = integration::create
(
"pStructPosition",
*this,
integrationMethod_,
velocity_.field()
velocity_.field(),
control.keepIntegrationHistory()
);
if( !integrationPos_ )
@ -79,7 +80,8 @@ pFlow::dynamicPointStructure::dynamicPointStructure
"pStructVelocity",
*this,
integrationMethod_,
acceleration_.field()
acceleration_.field(),
control.keepIntegrationHistory()
);
if( !integrationVel_ )

View File

@ -24,6 +24,8 @@ Licence:
#include "iOstream.hpp"
#include "types.hpp"
#include "vocabs.hpp"
#include "Logical.hpp"
inline static bool axuFunctionsInitialized__ = false;
@ -187,8 +189,7 @@ pFlow::systemControl::systemControl(
bool pFlow::systemControl::operator++(int)
{
auto toContinue = time()++;
if(!axuFunctionsInitialized__)
{
auxFunctions_ = auxFunctions::create(*this);
@ -201,6 +202,8 @@ bool pFlow::systemControl::operator++(int)
auxFunctions_().write();
}
auto toContinue = time()++;
if (toContinue)
{
writeToFileTimer_.start();
@ -236,4 +239,10 @@ bool pFlow::systemControl::operator++(int)
return toContinue;
}
bool pFlow::systemControl::keepIntegrationHistory()const
{
auto keepHistory = settingsDict_().getValOrSet(
"integrationHistory",
Logical{false});
return keepHistory();
}

View File

@ -193,6 +193,7 @@ public:
return outFilePrecision_;
}
bool keepIntegrationHistory()const;
bool isIncluded(const word& objName)const final
{

View File

@ -278,6 +278,6 @@ struct quadruple
} // pFlow
#include "quadrupleI.hpp"
// #include "quadrupleMath.hpp"
#include "quadrupleMath.hpp"
#endif