Push after adding PostptocessData lib

This commit is contained in:
Hamidreza 2025-04-10 21:22:35 +03:30
parent c78ab398f6
commit 8e87333973
15 changed files with 377 additions and 13 deletions

View File

@ -13,3 +13,5 @@ add_subdirectory(Interaction)
add_subdirectory(MotionModel)
add_subdirectory(PostprocessData)

View File

@ -47,6 +47,7 @@ repository/Time/Time.cpp
repository/Time/timeControl.cpp
repository/Time/baseTimeControl.cpp
repository/systemControl/systemControl.cpp
repository/systemControl/auxFunctions/auxFunctions.cpp
repository/systemControl/dynamicLinkLibs.cpp
commandLine/commandLine.cpp

View File

@ -79,6 +79,27 @@ public:
/// List of varibales names
const wordList& names()const;
template<typename T, typename... Args>
void emplaceBackOrReplace(const word& name, Args&&... args)
{
if( contains(name))
{
int32 i = names_.findi(name);
types_[i] = getTypeName<T>();
anyList_.pos(i)->reset();
anyList_.pos(i)-> emplace<T>(std::forward<Args>(args)...);
}
else
{
names_.push_back(name);
types_.push_back(getTypeName<T>());
anyList_.emplace_back(
std::in_place_type<T>,
std::forward<Args>(args)...);
}
}
/// Create variable using constructor in-place
template<typename T, typename... Args>
reference emplaceBack(const word& name, Args&&... args)

View File

@ -0,0 +1,114 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __dictionaryList_hpp__
#define __dictionaryList_hpp__
#include "List.hpp"
#include "dictionary.hpp"
namespace pFlow
{
class dictionaryList
:
public List<dictionary>
{
private:
const dictionary& parrent_;
word name_;
public:
TypeInfoNV("dictionaryList");
dictionaryList(const word& name, const dictionary& parrent)
:
List<dictionary>(),
parrent_(parrent),
name_(name)
{}
dictionaryList(const dictionaryList&) = default;
dictionaryList(dictionaryList&&) = default;
dictionaryList& operator = (const dictionaryList&) = default;
dictionaryList& operator = (dictionaryList&&) = default;
~dictionaryList() = default;
const word& name()const
{
return name_;
}
const word globalName()const
{
return parrent_.globalName();
}
List<dictionary>& dicts()
{
return *this;
}
const List<dictionary>& dicts()const
{
return *this;
}
const dictionary& parrent()const
{
return parrent_;
}
};
inline
dictionaryList readDictList(const word& name, const dictionary& dict)
{
if(!dict.containsDataEntry(name))
{
fatalErrorInFunction
<<"data entry: "<< name
<<" does not exist in dictionary "<< dict.globalName()<<endl;
}
dictionaryList allDicts(name, dict);
auto dicts = dict.getVal<List<dictionary>>(name);
for(auto& d:dicts)
{
allDicts.emplace_back(d.name(), dict, d);
}
return allDicts;
}
}
#endif

View File

@ -47,6 +47,7 @@ const inline char* const contactSearchFile__ = "contactSearch";
const inline char* const propertyFile__ = "interaction";
const inline char* const interactionFile__ = "interaction";
const inline char* const postprocessFile__ = "postprocessDict";
const inline char* const postprocessDataFiel__ = "postprocessDataDict";
const inline char* const uniform__ = "uniform";
const inline char* const nonUniform__ = "nonUniform";

View File

@ -21,14 +21,24 @@ Licence:
#include "baseTimeControl.hpp"
#include "timeInfo.hpp"
pFlow::baseTimeControl::baseTimeControl
void pFlow::baseTimeControl::setTimeControl
(
timeValue startTime,
timeValue endTime,
timeValue interval,
const word &intervalPrefix
)
{
isTimeStep_ = false;
intervalPrefix_ = intervalPrefix;
rRange_ = stridedRange<timeValue>(startTime, endTime, interval);
}
pFlow::baseTimeControl::baseTimeControl(
const dictionary &dict,
const word &intervalPrefix,
timeValue defStartTime
)
:
intervalPrefix_(intervalPrefix)
timeValue defStartTime)
: intervalPrefix_(intervalPrefix)
{
auto tControl = dict.getVal<word>("timeControl");
if(tControl == "timeStep")
@ -119,6 +129,24 @@ pFlow::baseTimeControl::baseTimeControl(int32 start, int32 end, int32 stride, co
{
}
pFlow::baseTimeControl::baseTimeControl
(
timeValue start,
timeValue end,
timeValue stride,
const word &intervalPrefix
)
:
isTimeStep_(false),
rRange_(
start, end, stride
),
intervalPrefix_(
intervalPrefix.size()==0uL? word("interval"): intervalPrefix+"Interval"
)
{
}
bool pFlow::baseTimeControl::eventTime(uint32 iter, timeValue t, timeValue dt) const
{
if(isTimeStep_)

View File

@ -38,7 +38,15 @@ private:
stridedRange<timeValue> rRange_;
const word intervalPrefix_;
word intervalPrefix_;
protected:
void setTimeControl(
timeValue startTime,
timeValue endTime,
timeValue interval,
const word& intervalPrefix);
public:
@ -61,6 +69,31 @@ public:
const word& intervalPrefix = ""
);
baseTimeControl(
timeValue start,
timeValue end,
timeValue stride,
const word& intervalPrefix = ""
);
baseTimeControl(
const baseTimeControl& other
) = default;
baseTimeControl(
baseTimeControl&& other
) = default;
baseTimeControl& operator=(
const baseTimeControl& other
) = default;
baseTimeControl& operator=(
baseTimeControl&& other
) = default;
~baseTimeControl() = default;
inline bool isTimeStep() const
{
return isTimeStep_;

View File

@ -120,6 +120,16 @@ public:
return startTime_;
}
timeValue endTime()const
{
return endTime_;
}
timeValue saveInterval()const
{
return saveInterval_;
}
word timeName()const;
timeValue currentTime() const

View File

@ -106,6 +106,12 @@ public:
return real2FixedStripZeros(currentTime_, presicion_);
}
inline
word prevTimeName()const
{
return real2FixedStripZeros( max(currentTime_-dt_, timeValue(0)), presicion_);
}
static
uint32 precision()
{

View File

@ -0,0 +1,56 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "auxFunctions.hpp"
#include "systemControl.hpp"
pFlow::uniquePtr<pFlow::auxFunctions>
pFlow::auxFunctions::create(const systemControl& control)
{
const auto& setDict = control.settingsDict();
if( !setDict.containsDataEntry("auxFunctions"))
{
return nullptr;
}
word func = setDict.getVal<word>("auxFunctions");
if( systemControlvCtorSelector_.search(func) )
{
REPORT(1)<<"Creating auxiliary function "<< Green_Text(func)<< " ..."<<END_REPORT;
return systemControlvCtorSelector_[func](control);
}
else
{
printKeys
(
fatalError
<< "Ctor Selector "<< Yellow_Text(func) << " dose not exist "
<< "for axuFunctions.\n"
<<"Avaiable ones are: \n"
,
systemControlvCtorSelector_
);
fatalExit;
return nullptr;
}
}

View File

@ -0,0 +1,65 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __auxFunctions_hpp__
#define __auxFunctions_hpp__
#include "timeInfo.hpp"
#include "uniquePtr.hpp"
#include "virtualConstructor.hpp"
namespace pFlow
{
class systemControl;
class auxFunctions
{
public:
TypeInfo("auxFunctions");
auxFunctions(const systemControl& control){};
virtual ~auxFunctions()=default;
create_vCtor
(
auxFunctions,
systemControl,
(const systemControl& control),
(control)
);
virtual
bool execute() = 0;
virtual
bool write()const = 0 ;
static
uniquePtr<auxFunctions> create(const systemControl& control);
};
} // namespace pFlow
#endif

View File

@ -25,6 +25,8 @@ Licence:
#include "types.hpp"
#include "vocabs.hpp"
inline static bool axuFunctionsInitialized__ = false;
bool pFlow::systemControl::readIncludeExclue(const dictionary& dict)
{
if (dict.containsDataEntry("includeObjects"))
@ -187,6 +189,18 @@ bool pFlow::systemControl::operator++(int)
{
auto toContinue = time()++;
if(!axuFunctionsInitialized__)
{
auxFunctions_ = auxFunctions::create(*this);
axuFunctionsInitialized__ = true;
}
if(auxFunctions_)
{
auxFunctions_().execute();
auxFunctions_().write();
}
if (toContinue)
{
writeToFileTimer_.start();
@ -221,3 +235,5 @@ bool pFlow::systemControl::operator++(int)
return toContinue;
}

View File

@ -34,10 +34,13 @@ Licence:
#include "Timers.hpp"
#include "dynamicLinkLibs.hpp"
#include "Set.hpp"
#include "auxFunctions.hpp"
namespace pFlow
{
class systemControl
:
public repository
@ -83,6 +86,7 @@ protected:
wordSet excludeList_;
uniquePtr<auxFunctions> auxFunctions_ = nullptr;
bool readIncludeExclue(const dictionary& dict);

View File

@ -38,15 +38,16 @@ namespace pFlow
template<
typename T
typename T,
typename Deleter = std::default_delete<T>
>
class uniquePtr
:
public std::unique_ptr<T>
public std::unique_ptr<T, Deleter>
{
public:
using uniquePtrType = std::unique_ptr<T>;
using uniquePtrType = std::unique_ptr<T, Deleter>;
// using base constructors
using uniquePtrType::unique_ptr;

View File

@ -105,6 +105,12 @@ public:
return sqrt(radius2_);
}
INLINE_FUNCTION_HD
real volume()const
{
return 4.0/3.0* Pi * pow(radius(),3.0);
}
//// - IO operation
FUNCTION_H
bool read(iIstream & is);