From bf0197f64326fd88f9940df6cb1e655013313caa Mon Sep 17 00:00:00 2001 From: Hamidreza Date: Thu, 15 May 2025 12:00:13 +0330 Subject: [PATCH] change in the type name of timeValue and sample dictionaries for settingsDict and domain --- DEMSystems/DEMSystem/DEMSystem.hpp | 2 +- .../sphereInteraction/sphereInteraction.cpp | 2 +- .../fieldsDataBase/fieldsDataBase.cpp | 6 +- .../fieldsDataBase/fieldsDataBase.hpp | 16 ++--- .../simulationFieldsDataBase.cpp | 2 +- .../simulationFieldsDataBase.hpp | 2 +- .../operation/includeMask/IncludeMask.hpp | 8 +-- .../postprocessOperationFunctions.hpp | 2 +- .../particleProbePostprocessComponent.cpp | 2 +- .../postprocessData/postprocessData.cpp | 2 +- .../postprocessData/postprocessData.hpp | 2 +- src/phasicFlow/containers/span/span.hpp | 8 +-- .../repository/Time/baseTimeControl.cpp | 46 ++++++------- .../repository/Time/baseTimeControl.hpp | 30 ++++----- .../repository/Time/timeControl.cpp | 16 ++--- .../repository/Time/timeControl.hpp | 34 +++++----- src/phasicFlow/repository/Time/timeInfo.hpp | 22 +++---- .../sampleDictionary/settingsDict | 55 ++++++++++++++++ .../repository/systemControl/timeFolder.hpp | 20 +++--- .../domain/sampleDictionary/domainDict | 64 +++++++++++++++++++ .../pointSorting/pointSorting.cpp | 18 ++++-- .../pointSorting/pointSorting.hpp | 4 +- .../pointStructure/pointStructure.cpp | 2 +- src/phasicFlow/types/basicTypes/Logical.cpp | 23 +++++-- src/phasicFlow/types/basicTypes/Logical.hpp | 34 ++++++---- .../types/basicTypes/bTypesFunctions.hpp | 1 - .../types/basicTypes/builtinTypes.hpp | 11 ++-- .../postSimulationFieldsDataBase.cpp | 12 ++-- .../postSimulationFieldsDataBase.hpp | 8 +-- .../postprocessPhasicFlow.cpp | 4 +- 30 files changed, 300 insertions(+), 158 deletions(-) create mode 100644 src/phasicFlow/repository/systemControl/sampleDictionary/settingsDict create mode 100755 src/phasicFlow/structuredData/domain/sampleDictionary/domainDict diff --git a/DEMSystems/DEMSystem/DEMSystem.hpp b/DEMSystems/DEMSystem/DEMSystem.hpp index 424af8ae..677aa847 100644 --- a/DEMSystems/DEMSystem/DEMSystem.hpp +++ b/DEMSystems/DEMSystem/DEMSystem.hpp @@ -96,7 +96,7 @@ public: return Control_(); } - auto inline constexpr usingDoulle()const + auto inline constexpr usingDouble()const { return pFlow::usingDouble__; } diff --git a/src/Interaction/sphereInteraction/sphereInteraction/sphereInteraction.cpp b/src/Interaction/sphereInteraction/sphereInteraction/sphereInteraction.cpp index fe907354..c757c03b 100644 --- a/src/Interaction/sphereInteraction/sphereInteraction/sphereInteraction.cpp +++ b/src/Interaction/sphereInteraction/sphereInteraction/sphereInteraction.cpp @@ -359,7 +359,7 @@ bool pFlow::sphereInteraction::hearChanges if(msg.equivalentTo(message::ITEMS_REARRANGE)) { notImplementedFunction; - return false; + return true; } fatalErrorInFunction<<"Event "<< msg.eventNames()<< diff --git a/src/PostprocessData/fieldsDataBase/fieldsDataBase.cpp b/src/PostprocessData/fieldsDataBase/fieldsDataBase.cpp index 731e0881..c64bb970 100644 --- a/src/PostprocessData/fieldsDataBase/fieldsDataBase.cpp +++ b/src/PostprocessData/fieldsDataBase/fieldsDataBase.cpp @@ -467,7 +467,7 @@ pFlow::postprocessData::fieldsDataBase::fieldsDataBase systemControl& control, const dictionary& postDict, bool inSimulation, - timeValue startTime + TimeValueType startTime ) : time_(control.time()), @@ -492,7 +492,7 @@ pFlow::postprocessData::fieldsDataBase::fieldsDataBase } } -pFlow::timeValue pFlow::postprocessData::fieldsDataBase::currentTime() const +pFlow::TimeValueType pFlow::postprocessData::fieldsDataBase::currentTime() const { return time_.currentTime(); } @@ -914,7 +914,7 @@ pFlow::uniquePtr systemControl& control, const dictionary& postDict, bool inSimulation, - timeValue startTime + TimeValueType startTime ) { word dbType; diff --git a/src/PostprocessData/fieldsDataBase/fieldsDataBase.hpp b/src/PostprocessData/fieldsDataBase/fieldsDataBase.hpp index fb707b1e..b231428f 100644 --- a/src/PostprocessData/fieldsDataBase/fieldsDataBase.hpp +++ b/src/PostprocessData/fieldsDataBase/fieldsDataBase.hpp @@ -78,7 +78,7 @@ private: anyList allFields_; /// Map to store the last capture time of each field - wordMap captureTime_; + wordMap captureTime_; /// Reference to the Time object Time& time_; @@ -178,7 +178,7 @@ public: systemControl& control, const dictionary& postDict, bool inSimulation, - timeValue startTime); + TimeValueType startTime); /// no copy constructor fieldsDataBase(const fieldsDataBase&) = delete; @@ -203,7 +203,7 @@ public: systemControl& control, const dictionary& postDict, bool inSimulation, - timeValue startTime + TimeValueType startTime ), (control, postDict, inSimulation, startTime) ); @@ -211,7 +211,7 @@ public: // - Public Access Functions /// returns the current time - timeValue currentTime()const; + TimeValueType currentTime()const; /// const ref to object Time const Time& time()const @@ -282,7 +282,7 @@ public: /// Get the next avaiable time folder after the current time folder /// This is only used for post-simulation processing virtual - timeValue getNextTimeFolder()const + TimeValueType getNextTimeFolder()const { return -1.0; } @@ -291,7 +291,7 @@ public: /// This is used only for post-simulation processing /// @returns the time value of the next folder. virtual - timeValue setToNextTimeFolder() + TimeValueType setToNextTimeFolder() { return -1.0; } @@ -300,7 +300,7 @@ public: /// This is used only for post-simulation processing /// @returns the time value of the skipped folder virtual - timeValue skipNextTimeFolder() + TimeValueType skipNextTimeFolder() { return -1.0; } @@ -316,7 +316,7 @@ public: systemControl& control, const dictionary& postDict, bool inSimulation, - timeValue startTime); + TimeValueType startTime); }; } // namespace pFlow::postprocessData diff --git a/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.cpp b/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.cpp index b4e19f6a..302facdd 100644 --- a/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.cpp +++ b/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.cpp @@ -49,7 +49,7 @@ pFlow::postprocessData::simulationFieldsDataBase::simulationFieldsDataBase systemControl &control, const dictionary& postDict, bool inSimulation, - timeValue startTime + TimeValueType startTime ) : fieldsDataBase(control, postDict, inSimulation, startTime), diff --git a/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.hpp b/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.hpp index 298a4957..48ee6795 100644 --- a/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.hpp +++ b/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.hpp @@ -60,7 +60,7 @@ public: systemControl& control, const dictionary& postDict, bool inSimulation, - timeValue startTime); + TimeValueType startTime); ~simulationFieldsDataBase() override = default; diff --git a/src/PostprocessData/operation/includeMask/IncludeMask.hpp b/src/PostprocessData/operation/includeMask/IncludeMask.hpp index 3689f22c..c888b152 100644 --- a/src/PostprocessData/operation/includeMask/IncludeMask.hpp +++ b/src/PostprocessData/operation/includeMask/IncludeMask.hpp @@ -86,12 +86,12 @@ private: word fieldName_; /// Timestamp when mask was last updated (-1 indicates never updated) - timeValue lastUpdated_ = -1; + TimeValueType lastUpdated_ = -1; /// Updates the mask based on current field values if needed, returns true if successful bool updateMask() { - timeValue t = database().currentTime(); + TimeValueType t = database().currentTime(); if( equal( t, lastUpdated_)) return true; @@ -206,11 +206,11 @@ private: std::vector mask_; - timeValue lastUpdated_ = -1; + TimeValueType lastUpdated_ = -1; bool updateMask() { - timeValue t = database().currentTime(); + TimeValueType t = database().currentTime(); if( equal( t, lastUpdated_)) return true; diff --git a/src/PostprocessData/operation/postprocessOperation/postprocessOperationFunctions.hpp b/src/PostprocessData/operation/postprocessOperation/postprocessOperationFunctions.hpp index 5356cf84..32e7be92 100644 --- a/src/PostprocessData/operation/postprocessOperation/postprocessOperationFunctions.hpp +++ b/src/PostprocessData/operation/postprocessOperation/postprocessOperationFunctions.hpp @@ -46,7 +46,7 @@ inline bool writeField ( iOstream& os, - timeValue t, + TimeValueType t, const regionField field, uint32 threshold, const T& defValue=T{} diff --git a/src/PostprocessData/postprocessComponent/particleProbePostprocessComponent/particleProbePostprocessComponent.cpp b/src/PostprocessData/postprocessComponent/particleProbePostprocessComponent/particleProbePostprocessComponent.cpp index 3c390cc9..179f43a0 100644 --- a/src/PostprocessData/postprocessComponent/particleProbePostprocessComponent/particleProbePostprocessComponent.cpp +++ b/src/PostprocessData/postprocessComponent/particleProbePostprocessComponent/particleProbePostprocessComponent.cpp @@ -52,7 +52,7 @@ template inline bool writeField ( iOstream& os, - timeValue t, + TimeValueType t, const regionField& field, const regionPoints& regPoints, const T& invalidVal = T{} diff --git a/src/PostprocessData/postprocessData/postprocessData.cpp b/src/PostprocessData/postprocessData/postprocessData.cpp index 967bcfda..cbe5ac69 100644 --- a/src/PostprocessData/postprocessData/postprocessData.cpp +++ b/src/PostprocessData/postprocessData/postprocessData.cpp @@ -27,7 +27,7 @@ Licence: pFlow::postprocessData::postprocessData::postprocessData ( const systemControl &control, - timeValue startTime + TimeValueType startTime ) : auxFunctions(control), diff --git a/src/PostprocessData/postprocessData/postprocessData.hpp b/src/PostprocessData/postprocessData/postprocessData.hpp index 553c3d22..795ce5e0 100644 --- a/src/PostprocessData/postprocessData/postprocessData.hpp +++ b/src/PostprocessData/postprocessData/postprocessData.hpp @@ -85,7 +85,7 @@ public: /// this constructor is used when postprocesing is active /// during simulation. /// @param control const reference to systemControl - postprocessData(const systemControl& control, timeValue startTime = -1.0); + postprocessData(const systemControl& control, TimeValueType startTime = -1.0); ~postprocessData()override = default; diff --git a/src/phasicFlow/containers/span/span.hpp b/src/phasicFlow/containers/span/span.hpp index a09c1bda..addee8e0 100644 --- a/src/phasicFlow/containers/span/span.hpp +++ b/src/phasicFlow/containers/span/span.hpp @@ -55,7 +55,7 @@ private: mutable T* data_ = nullptr; - index size_ = 0; + IndexType size_ = 0; public: @@ -104,7 +104,7 @@ public: /// Returns the number of elements in the span INLINE_FUNCTION_HD - index size() const + IndexType size() const { return size_; } @@ -139,14 +139,14 @@ public: /// Returns a reference to the element at the specified index INLINE_FUNCTION_HD - T& operator[](index i) + T& operator[](IndexType i) { return data_[i]; } /// Returns a const reference to the element at the specified index INLINE_FUNCTION_HD - T& operator[](index i)const + T& operator[](IndexType i)const { return data_[i]; } diff --git a/src/phasicFlow/repository/Time/baseTimeControl.cpp b/src/phasicFlow/repository/Time/baseTimeControl.cpp index c4a83327..c6052dec 100644 --- a/src/phasicFlow/repository/Time/baseTimeControl.cpp +++ b/src/phasicFlow/repository/Time/baseTimeControl.cpp @@ -23,21 +23,21 @@ Licence: void pFlow::baseTimeControl::setTimeControl ( - timeValue startTime, - timeValue endTime, - timeValue interval, + TimeValueType startTime, + TimeValueType endTime, + TimeValueType interval, const word &intervalPrefix ) { isTimeStep_ = false; intervalPrefix_ = intervalPrefix; - rRange_ = stridedRange(startTime, endTime, interval); + rRange_ = stridedRange(startTime, endTime, interval); } pFlow::baseTimeControl::baseTimeControl( const dictionary &dict, const word &intervalPrefix, - timeValue defStartTime) + TimeValueType defStartTime) : intervalPrefix_(intervalPrefix) { auto tControl = dict.getVal("timeControl"); @@ -59,10 +59,10 @@ pFlow::baseTimeControl::baseTimeControl( if(!isTimeStep_) { - auto startTime = (dict.getValOrSet("startTime", defStartTime)); - auto endTime = (dict.getValOrSet("endTime", largeValue)); - auto interval = dict.getVal(intervalWord); - rRange_ = stridedRange(startTime, endTime, interval); + auto startTime = (dict.getValOrSet("startTime", defStartTime)); + auto endTime = (dict.getValOrSet("endTime", largeValue)); + auto interval = dict.getVal(intervalWord); + rRange_ = stridedRange(startTime, endTime, interval); } else @@ -78,9 +78,9 @@ pFlow::baseTimeControl::baseTimeControl( pFlow::baseTimeControl::baseTimeControl ( const dictionary& dict, - const timeValue defInterval, + const TimeValueType defInterval, const word& intervalPrefix, - const timeValue defStartTime + const TimeValueType defStartTime ) : intervalPrefix_(intervalPrefix) @@ -104,10 +104,10 @@ pFlow::baseTimeControl::baseTimeControl if(!isTimeStep_) { - auto startTime = (dict.getValOrSet("startTime", defStartTime)); - auto endTime = (dict.getValOrSet("endTime", largeValue)); - auto interval = dict.getValOrSet(intervalWord, defInterval); - rRange_ = stridedRange(startTime, endTime, interval); + auto startTime = (dict.getValOrSet("startTime", defStartTime)); + auto endTime = (dict.getValOrSet("endTime", largeValue)); + auto interval = dict.getValOrSet(intervalWord, defInterval); + rRange_ = stridedRange(startTime, endTime, interval); } else @@ -131,9 +131,9 @@ pFlow::baseTimeControl::baseTimeControl(int32 start, int32 end, int32 stride, co pFlow::baseTimeControl::baseTimeControl ( - timeValue start, - timeValue end, - timeValue stride, + TimeValueType start, + TimeValueType end, + TimeValueType stride, const word &intervalPrefix ) : @@ -147,7 +147,7 @@ pFlow::baseTimeControl::baseTimeControl { } -bool pFlow::baseTimeControl::eventTime(uint32 iter, timeValue t, timeValue dt) const +bool pFlow::baseTimeControl::eventTime(uint32 iter, TimeValueType t, TimeValueType dt) const { if(isTimeStep_) { @@ -166,7 +166,7 @@ bool pFlow::baseTimeControl::eventTime(const timeInfo &ti) const } bool -pFlow::baseTimeControl::isInRange(uint32 iter, timeValue t, timeValue dt) const +pFlow::baseTimeControl::isInRange(uint32 iter, TimeValueType t, TimeValueType dt) const { if(isTimeStep_) { @@ -178,7 +178,7 @@ pFlow::baseTimeControl::isInRange(uint32 iter, timeValue t, timeValue dt) const } } -pFlow::timeValue +pFlow::TimeValueType pFlow::baseTimeControl::startTime() const { if(!isTimeStep_) @@ -191,7 +191,7 @@ pFlow::baseTimeControl::startTime() const return 0; } -pFlow::timeValue +pFlow::TimeValueType pFlow::baseTimeControl::endTime() const { if(!isTimeStep_) @@ -204,7 +204,7 @@ pFlow::baseTimeControl::endTime() const return 0; } -pFlow::timeValue +pFlow::TimeValueType pFlow::baseTimeControl::rInterval() const { if(!isTimeStep_) diff --git a/src/phasicFlow/repository/Time/baseTimeControl.hpp b/src/phasicFlow/repository/Time/baseTimeControl.hpp index 8e9dd62f..06f69bb5 100644 --- a/src/phasicFlow/repository/Time/baseTimeControl.hpp +++ b/src/phasicFlow/repository/Time/baseTimeControl.hpp @@ -36,16 +36,16 @@ private: int32StridedRagne iRange_; - stridedRange rRange_; + stridedRange rRange_; word intervalPrefix_; protected: void setTimeControl( - timeValue startTime, - timeValue endTime, - timeValue interval, + TimeValueType startTime, + TimeValueType endTime, + TimeValueType interval, const word& intervalPrefix); public: @@ -53,14 +53,14 @@ public: baseTimeControl( const dictionary& dict, const word& intervalPrefix = "", - timeValue defStartTime = 0.0 + TimeValueType defStartTime = 0.0 ); baseTimeControl( const dictionary& dict, - const timeValue defInterval, + const TimeValueType defInterval, const word& intervalPrefix="", - const timeValue defStartTime=0.0); + const TimeValueType defStartTime=0.0); baseTimeControl( int32 start, @@ -70,9 +70,9 @@ public: ); baseTimeControl( - timeValue start, - timeValue end, - timeValue stride, + TimeValueType start, + TimeValueType end, + TimeValueType stride, const word& intervalPrefix = "" ); @@ -99,17 +99,17 @@ public: return isTimeStep_; } - bool eventTime(uint32 iter, timeValue t, timeValue dt) const; + bool eventTime(uint32 iter, TimeValueType t, TimeValueType dt) const; bool eventTime(const timeInfo& ti)const; - bool isInRange(uint32 iter, timeValue t, timeValue dt) const; + bool isInRange(uint32 iter, TimeValueType t, TimeValueType dt) const; - timeValue startTime() const; + TimeValueType startTime() const; - timeValue endTime() const; + TimeValueType endTime() const; - timeValue rInterval() const; + TimeValueType rInterval() const; int32 startIter() const; diff --git a/src/phasicFlow/repository/Time/timeControl.cpp b/src/phasicFlow/repository/Time/timeControl.cpp index 2990b768..7552deca 100644 --- a/src/phasicFlow/repository/Time/timeControl.cpp +++ b/src/phasicFlow/repository/Time/timeControl.cpp @@ -36,16 +36,16 @@ pFlow::timeControl::timeControl ti_(dict), startTime_ ( - dict.getVal("startTime") + dict.getVal("startTime") ), endTime_ ( - dict.getVal("endTime") + dict.getVal("endTime") ), stopAt_(endTime_), saveInterval_ ( - dict.getVal("saveInterval") + dict.getVal("saveInterval") ), lastSaved_(startTime_), performSorting_ @@ -65,9 +65,9 @@ pFlow::timeControl::timeControl pFlow::timeControl::timeControl( dictionary& dict, - timeValue startTime, - timeValue endTime, - timeValue saveInterval, + TimeValueType startTime, + TimeValueType endTime, + TimeValueType saveInterval, word startTimeName) : ti_(startTime, dict), @@ -95,9 +95,9 @@ pFlow::timeControl::timeControl( checkForOutputToFile(); } -pFlow::timeValue pFlow::timeControl::setTime(timeValue t) +pFlow::TimeValueType pFlow::timeControl::setTime(TimeValueType t) { - timeValue tmp = ti_.currentTime(); + TimeValueType tmp = ti_.currentTime(); ti_.currentTime_ = t; lastSaved_ = t; checkForOutputToFile(); diff --git a/src/phasicFlow/repository/Time/timeControl.hpp b/src/phasicFlow/repository/Time/timeControl.hpp index dc2bb80b..3d33ccb9 100644 --- a/src/phasicFlow/repository/Time/timeControl.hpp +++ b/src/phasicFlow/repository/Time/timeControl.hpp @@ -37,7 +37,7 @@ class dictionary; class timeControl { public: - using timeStridedRange = stridedRange; + using timeStridedRange = stridedRange; private: @@ -47,19 +47,19 @@ private: timeInfo ti_; // - start time of simulation - timeValue startTime_; + TimeValueType startTime_; // - end time of simulation - timeValue endTime_; + TimeValueType endTime_; // - stopAt - timeValue stopAt_; + TimeValueType stopAt_; // - time interval for time folder output - timeValue saveInterval_; + TimeValueType saveInterval_; // - the last time folder that was saved - timeValue lastSaved_; + TimeValueType lastSaved_; bool managedExternaly_ = false; @@ -80,7 +80,7 @@ private: inline word timeName_ = "wrongSettings"; // for managedExternamly static - inline timeValue writeTime_ = 0; // for managedExternamly + inline TimeValueType writeTime_ = 0; // for managedExternamly void checkForOutputToFile(); @@ -92,22 +92,22 @@ public: timeControl( dictionary& dict, - timeValue startTime, - timeValue endTime, - timeValue saveInterval, + TimeValueType startTime, + TimeValueType endTime, + TimeValueType saveInterval, word startTimeName); virtual ~timeControl() = default; - timeValue dt()const + TimeValueType dt()const { return ti_.dt(); } - timeValue setTime(timeValue t); + TimeValueType setTime(TimeValueType t); - void setStopAt(timeValue sT) + void setStopAt(TimeValueType sT) { if(managedExternaly_) { @@ -115,24 +115,24 @@ public: } } - timeValue startTime()const + TimeValueType startTime()const { return startTime_; } - timeValue endTime()const + TimeValueType endTime()const { return endTime_; } - timeValue saveInterval()const + TimeValueType saveInterval()const { return saveInterval_; } word timeName()const; - timeValue currentTime() const + TimeValueType currentTime() const { return ti_.currentTime(); } diff --git a/src/phasicFlow/repository/Time/timeInfo.hpp b/src/phasicFlow/repository/Time/timeInfo.hpp index ee0cff61..8ef0c7e4 100644 --- a/src/phasicFlow/repository/Time/timeInfo.hpp +++ b/src/phasicFlow/repository/Time/timeInfo.hpp @@ -36,16 +36,16 @@ private: uint32 currentIter_; // - current time of simulation - timeValue currentTime_; + TimeValueType currentTime_; // - integration time step - timeValue dt_; + TimeValueType dt_; inline static uint32 presicion_ = 5; public: - timeInfo(uint32 cIter, timeValue cTime, timeValue dt) + timeInfo(uint32 cIter, TimeValueType cTime, TimeValueType dt) : currentIter_(cIter), currentTime_(cTime), dt_(dt) @@ -55,31 +55,31 @@ public: timeInfo(const dictionary& dict) : currentIter_(0), - currentTime_(dict.getVal("startTime")), - dt_( dict.getVal("dt")) + currentTime_(dict.getVal("startTime")), + dt_( dict.getVal("dt")) { presicion_ = dict.getValOrSet("timePrecision",5); } - timeInfo(timeValue currentTime, const dictionary& dict) + timeInfo(TimeValueType currentTime, const dictionary& dict) : currentIter_(0), currentTime_(currentTime), - dt_( dict.getVal("dt")) + dt_( dict.getVal("dt")) { presicion_ = dict.getValOrSet("timePrecision",5); } - inline const timeValue& currentTime()const + inline const TimeValueType& currentTime()const { return currentTime_; } - inline const timeValue& t() const + inline const TimeValueType& t() const { return currentTime_; } - inline const timeValue& dt() const + inline const TimeValueType& dt() const { return dt_; } @@ -109,7 +109,7 @@ public: inline word prevTimeName()const { - return real2FixedStripZeros( max(currentTime_-dt_, timeValue(0)), presicion_); + return real2FixedStripZeros( max(currentTime_-dt_, TimeValueType(0)), presicion_); } static diff --git a/src/phasicFlow/repository/systemControl/sampleDictionary/settingsDict b/src/phasicFlow/repository/systemControl/sampleDictionary/settingsDict new file mode 100644 index 00000000..60415955 --- /dev/null +++ b/src/phasicFlow/repository/systemControl/sampleDictionary/settingsDict @@ -0,0 +1,55 @@ +/* -------------------------------*- C++ -*--------------------------------- *\ +| phasicFlow File | +| copyright: www.cemf.ir | +\* ------------------------------------------------------------------------- */ +objectName settingsDict; +objectType dictionary; +fileFormat ASCII; +/*---------------------------------------------------------------------------*/ + +// list of libraries that should be loaded during runtime; +// for example, "libPostprocessData.so" (optional) +libs (); + +// Auxiliary function to be run during simulation (optional) +auxFunctions postprocessData; + +// time step for integration in seconds, (mandatory) +dt 0.00001; + +// start time for simulation, can be any valid value. Simulation starts from +// time folder with the same name +startTime 0; + +// end time for simulation (mandatory) +endTime 10; + +// time interval between each data save on disk, (mandatory) +saveInterval 0.01; + +// maximum number of digits for time folder, (opetional, default is 5) +timePrecision 5; + +// gravitational acceleration vector (m/s2), (mandatory) +g (0 -9.8 0); // gravity vector (m/s2) + +// include a list of objects that are not normally in the save list on disk, (optional) +includeObjects (diameter); + +// exculde a list of objects from saving on the disk, (optional) +excludeObjects (); + +// integration method for position and velocity, (mandatory) +integrationMethod AdamsBashforth2; + +// if keep the integeration history under timeFolder/integeration or not, (optional, default is no) +integrationHistory Yes; + +// data writting format (ascii or binary), (mandatory) +writeFormat ascii; + +// report timers (Yes or No)?, (optional, default is Yes) +timersReport Yes; + +// time interval between each timer report, (optional, default is 0.04) +timersReportInterval 0.01; // time interval for reporting timers diff --git a/src/phasicFlow/repository/systemControl/timeFolder.hpp b/src/phasicFlow/repository/systemControl/timeFolder.hpp index bad231af..579329c9 100644 --- a/src/phasicFlow/repository/systemControl/timeFolder.hpp +++ b/src/phasicFlow/repository/systemControl/timeFolder.hpp @@ -27,11 +27,11 @@ Licence: namespace pFlow { -Map getTimeFolders(const fileSystem& path); +Map getTimeFolders(const fileSystem& path); class timeFolder { - using timeList = Map; + using timeList = Map; protected: @@ -61,14 +61,14 @@ public: } inline - timeValue currentTime()const + TimeValueType currentTime()const { if(folders_.empty()) return -1; return currentFolder_->first; } inline - timeValue nextTime()const + TimeValueType nextTime()const { auto next = currentFolder_; next++; @@ -98,7 +98,7 @@ public: return !finished(); } - bool setTime(timeValue upto) + bool setTime(TimeValueType upto) { timeList::iterator orgFolder = currentFolder_; @@ -140,14 +140,14 @@ public: return false; } - timeValue startTime()const + TimeValueType startTime()const { if(folders_.empty()) return -1; auto [t,f] = *folders_.begin(); return t; } - timeValue endTime()const + TimeValueType endTime()const { if(folders_.empty()) return -1; auto [t,f] = *(--folders_.end()); @@ -162,16 +162,16 @@ public: }; inline -Map getTimeFolders(const fileSystem& path) +Map getTimeFolders(const fileSystem& path) { - Map tFolders; + Map tFolders; auto subDirs = subDirectories(path); for(auto& subD: subDirs) { auto timeName = tailName(subD.wordPath(), '/'); - timeValue TIME; + TimeValueType TIME; if( auto success = readReal(timeName, TIME); success) { if(!tFolders.insertIf(TIME, subD)) diff --git a/src/phasicFlow/structuredData/domain/sampleDictionary/domainDict b/src/phasicFlow/structuredData/domain/sampleDictionary/domainDict new file mode 100755 index 00000000..9e262f86 --- /dev/null +++ b/src/phasicFlow/structuredData/domain/sampleDictionary/domainDict @@ -0,0 +1,64 @@ +/* -------------------------------*- C++ -*--------------------------------- *\ +| phasicFlow File | +| copyright: www.cemf.ir | +\* ------------------------------------------------------------------------- */ +objectName domainDict; +objectType dictionary; +fileFormat ASCII; +/*---------------------------------------------------------------------------*/ + +// Simulation domain: every particles that goes outside this domain will be deleted +globalBox +{ + min (-0.12 -0.12 0.00); + max (0.12 0.12 0.11); +} + + +pointSorting +{ + active Yes; // optional (default: No) + + dx 0.01; // optional (default: 0.01) + + timeControl simulationTime; // runTime, or timeStep + + startTime 0.0; + + endTime 100; // optional (default: very large number) + + sortingInterval 0.1; // in seconds +} + +boundaries +{ + left + { + type exit; // other options: periodict, reflective + } + + right + { + type exit; // other options: periodict, reflective + } + + bottom + { + type exit; // other options: periodict, reflective + } + + top + { + type exit; // other options: periodict, reflective + } + + rear + { + type exit; // other options: periodict, reflective + } + + front + { + type exit; // other options: periodict, reflective + } +} diff --git a/src/phasicFlow/structuredData/pointStructure/pointStructure/pointSorting/pointSorting.cpp b/src/phasicFlow/structuredData/pointStructure/pointStructure/pointSorting/pointSorting.cpp index e318551d..a5081cde 100644 --- a/src/phasicFlow/structuredData/pointStructure/pointStructure/pointSorting/pointSorting.cpp +++ b/src/phasicFlow/structuredData/pointStructure/pointStructure/pointSorting/pointSorting.cpp @@ -32,15 +32,23 @@ pFlow::pointSorting::pointSorting(const dictionary & dict) dx_( performSorting_()? dict.getVal("dx"): - 1.0 + 0.01 ) { if( performSorting_() ) - REPORT(2)<<"Point sorting is "< 0) { - os << YesNo__[yesNoSet_][0]; + os << YesNo__[s_][0]; } else { - os << YesNo__[yesNoSet_][1]; + os << YesNo__[-s_][1]; } return os.check(FUNCTION_NAME); } diff --git a/src/phasicFlow/types/basicTypes/Logical.hpp b/src/phasicFlow/types/basicTypes/Logical.hpp index 9b6a01d6..479271a2 100755 --- a/src/phasicFlow/types/basicTypes/Logical.hpp +++ b/src/phasicFlow/types/basicTypes/Logical.hpp @@ -41,24 +41,30 @@ class Logical private: /// bool value - bool s_ = false; - - /// Set numbe of of Yes or No - int yesNoSet_ = 0; + /// negative value means false + /// positive value means true + /// 0 means not set, but still valid as true + int8_t s_ = -1; + /// Set of Yes or Nos - inline static const word YesNo__[4][2] = { { "Yes", "No" }, + inline static const word YesNo__[5][2] = { { "Y", "Y" }, + { "Yes", "No" }, { "on", "off" }, { "true", "false" }, { "Ok", "No" } }; /// Construct from bool and set number - inline explicit Logical(bool s, int yns) - : s_(s), - yesNoSet_(yns) + inline Logical(bool s, int yns) { + yns = std::max(1, std::min(4, yns)); + s_ = s ? static_cast(yns) : static_cast(-yns); } + inline explicit Logical(int8_t s) + { + s_ = s; + } public: /// Type info @@ -79,7 +85,8 @@ public: /// Construct from bool inline explicit Logical(bool s) - : s_(s) + : + Logical(s, 1) { } @@ -104,8 +111,7 @@ public: /// Assignment with bool inline Logical& operator=(const bool& b) { - s_ = b; - yesNoSet_ = 0; + *this = Logical(b); return *this; } @@ -114,19 +120,19 @@ public: /// () operator, return bool value inline bool operator()() const { - return s_; + return s_ > 0; } /// Return bool value inline explicit operator bool() const { - return s_; + return s_ > 0; } /// Not operator inline Logical operator!() const { - return Logical(!s_, yesNoSet_); + return Logical(static_cast(-s_)); } //// IO operations diff --git a/src/phasicFlow/types/basicTypes/bTypesFunctions.hpp b/src/phasicFlow/types/basicTypes/bTypesFunctions.hpp index 87f0408a..7dd49ee4 100755 --- a/src/phasicFlow/types/basicTypes/bTypesFunctions.hpp +++ b/src/phasicFlow/types/basicTypes/bTypesFunctions.hpp @@ -21,7 +21,6 @@ Licence: \brief Helper functions for built-in types. */ - #ifndef __bTypesFunctions_hpp__ #define __bTypesFunctions_hpp__ diff --git a/src/phasicFlow/types/basicTypes/builtinTypes.hpp b/src/phasicFlow/types/basicTypes/builtinTypes.hpp index be3d5647..6379c1f3 100755 --- a/src/phasicFlow/types/basicTypes/builtinTypes.hpp +++ b/src/phasicFlow/types/basicTypes/builtinTypes.hpp @@ -61,25 +61,26 @@ using uint64 = unsigned long long int; using word = std::string; -using timeValue = double; +/// type for time values +using TimeValueType = double; +/// type for indexing arrays and vectors #ifdef pFlow_Build_Index64 #define Index64 1 - using index = std::size_t; + using IndexType = std::size_t; inline const char* IndexType__ = "std::size_t"; #else #define Index64 0 - using index = uint32; + using IndexType = uint32; inline const char* IndexType__ = "uint32"; #endif - inline word floatingPointDescription() { return word("In this build, ") + word(floatingPointType__) + word(" is used for floating point operations and ") + - IndexType__ + "for indexing."; + IndexType__ + " for indexing."; } } // end of pFlow diff --git a/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.cpp b/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.cpp index 624a3444..307024e1 100644 --- a/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.cpp +++ b/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.cpp @@ -192,7 +192,7 @@ postSimulationFieldsDataBase::postSimulationFieldsDataBase systemControl &control, const dictionary& postDict, bool inSimulation, - timeValue startTime + TimeValueType startTime ) : fieldsDataBase(control, postDict, inSimulation, startTime), @@ -231,14 +231,14 @@ const pointStructure& postSimulationFieldsDataBase::pStruct()const return pStructPtr_(); } -timeValue postSimulationFieldsDataBase::getNextTimeFolder() const +TimeValueType postSimulationFieldsDataBase::getNextTimeFolder() const { return allValidFolders_.nextTime(); } -timeValue postSimulationFieldsDataBase::setToNextTimeFolder() +TimeValueType postSimulationFieldsDataBase::setToNextTimeFolder() { - timeValue nextTime = allValidFolders_.nextTime(); + TimeValueType nextTime = allValidFolders_.nextTime(); if(nextTime < 0.0) return nextTime; allValidFolders_++; @@ -254,9 +254,9 @@ timeValue postSimulationFieldsDataBase::setToNextTimeFolder() return nextTime; } -timeValue postSimulationFieldsDataBase::skipNextTimeFolder() +TimeValueType postSimulationFieldsDataBase::skipNextTimeFolder() { - timeValue nextTime = allValidFolders_.nextTime(); + TimeValueType nextTime = allValidFolders_.nextTime(); if(nextTime < 0.0) return nextTime; allValidFolders_++; diff --git a/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.hpp b/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.hpp index e0afd59c..72ef4a62 100644 --- a/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.hpp +++ b/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.hpp @@ -71,7 +71,7 @@ public: systemControl& control, const dictionary& postDict, bool inSimulation, - timeValue startTime); + TimeValueType startTime); ~postSimulationFieldsDataBase() override = default; @@ -84,11 +84,11 @@ public: const pointStructure& pStruct()const override; - timeValue getNextTimeFolder()const override; + TimeValueType getNextTimeFolder()const override; - timeValue setToNextTimeFolder() override; + TimeValueType setToNextTimeFolder() override; - timeValue skipNextTimeFolder() override; + TimeValueType skipNextTimeFolder() override; }; diff --git a/utilities/postprocessPhasicFlow/postprocessPhasicFlow.cpp b/utilities/postprocessPhasicFlow/postprocessPhasicFlow.cpp index aeaace52..d7d3f235 100644 --- a/utilities/postprocessPhasicFlow/postprocessPhasicFlow.cpp +++ b/utilities/postprocessPhasicFlow/postprocessPhasicFlow.cpp @@ -67,7 +67,7 @@ int main(int argc, char** argv ) #include "initialize_Control.hpp" // time in command line - pFlow::combinedRange validRange; + pFlow::combinedRange validRange; if( cmds.count("--time") ) { @@ -86,7 +86,7 @@ int main(int argc, char** argv ) validRange.addIntervalRange(1.0e-7, 1.0e+15); } - pFlow::timeValue nextTime = validRange.minVal(); + pFlow::TimeValueType nextTime = validRange.minVal(); if(nextTime <0.0) {