mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-12 16:26:23 +00:00
refactor up to particles.hpp
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -38,7 +38,6 @@ bin/**
|
|||||||
lib/**
|
lib/**
|
||||||
test*/**
|
test*/**
|
||||||
**/**notnow
|
**/**notnow
|
||||||
**/MPIParallel*/**
|
|
||||||
doc/code-documentation/
|
doc/code-documentation/
|
||||||
doc/DTAGS
|
doc/DTAGS
|
||||||
# all possible time folders
|
# all possible time folders
|
||||||
|
@ -73,7 +73,7 @@ add_subdirectory(src)
|
|||||||
|
|
||||||
#add_subdirectory(solvers)
|
#add_subdirectory(solvers)
|
||||||
|
|
||||||
#add_subdirectory(utilities)
|
add_subdirectory(utilities)
|
||||||
|
|
||||||
#add_subdirectory(DEMSystems)
|
#add_subdirectory(DEMSystems)
|
||||||
add_subdirectory(testIO)
|
add_subdirectory(testIO)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
add_subdirectory(phasicFlow)
|
add_subdirectory(phasicFlow)
|
||||||
|
|
||||||
#add_subdirectory(Integration)
|
add_subdirectory(Integration)
|
||||||
|
|
||||||
#add_subdirectory(Property)
|
add_subdirectory(Property)
|
||||||
|
|
||||||
#add_subdirectory(Particles)
|
add_subdirectory(Particles)
|
||||||
|
|
||||||
#add_subdirectory(Interaction)
|
#add_subdirectory(Interaction)
|
||||||
|
|
||||||
|
@ -19,36 +19,107 @@ Licence:
|
|||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "AdamsBashforth2.hpp"
|
#include "AdamsBashforth2.hpp"
|
||||||
|
#include "pointStructure.hpp"
|
||||||
|
#include "Time.hpp"
|
||||||
|
#include "vocabs.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
/// Range policy for integration kernel (alias)
|
||||||
|
using rpIntegration = Kokkos::RangePolicy<
|
||||||
|
DefaultExecutionSpace,
|
||||||
|
Kokkos::Schedule<Kokkos::Static>,
|
||||||
|
Kokkos::IndexType<uint32>
|
||||||
|
>;
|
||||||
|
|
||||||
|
bool intAllActive(
|
||||||
|
real dt,
|
||||||
|
realx3PointField_D& y,
|
||||||
|
realx3PointField_D& dy,
|
||||||
|
realx3PointField_D& dy1)
|
||||||
|
{
|
||||||
|
|
||||||
|
auto d_dy = dy.fieldDevice();
|
||||||
|
auto d_y = y.fieldDevice();
|
||||||
|
auto d_dy1= dy1.fieldDevice();
|
||||||
|
auto activeRng = dy1.activeRange();
|
||||||
|
|
||||||
|
Kokkos::parallel_for(
|
||||||
|
"AdamsBashforth2::correct",
|
||||||
|
rpIntegration (activeRng.start(), activeRng.end()),
|
||||||
|
LAMBDA_HD(int32 i){
|
||||||
|
d_y[i] += dt*(static_cast<real>(1.5) * d_dy[i] - static_cast<real>(0.5) * d_dy1[i]);
|
||||||
|
d_dy1[i] = d_dy[i];
|
||||||
|
});
|
||||||
|
Kokkos::fence();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool intScattered
|
||||||
|
(
|
||||||
|
real dt,
|
||||||
|
realx3PointField_D& y,
|
||||||
|
realx3PointField_D& dy,
|
||||||
|
realx3PointField_D& dy1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
auto d_dy = dy.fieldDevice();
|
||||||
|
auto d_y = y.fieldDevice();
|
||||||
|
auto d_dy1 = dy1.fieldDevice();
|
||||||
|
auto activeRng = dy1.activeRange();
|
||||||
|
const auto& activeP = dy1.activePointsMaskDevice();
|
||||||
|
|
||||||
|
Kokkos::parallel_for(
|
||||||
|
"AdamsBashforth2::correct",
|
||||||
|
rpIntegration (activeRng.start(), activeRng.end()),
|
||||||
|
LAMBDA_HD(int32 i){
|
||||||
|
if( activeP(i))
|
||||||
|
{
|
||||||
|
d_y[i] += dt*(static_cast<real>(1.5) * d_dy[i] - static_cast<real>(0.5) * d_dy1[i]);
|
||||||
|
d_dy1[i] = d_dy[i];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Kokkos::fence();
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//const real AB2_coef[] = { 3.0 / 2.0, 1.0 / 2.0};
|
|
||||||
|
|
||||||
pFlow::AdamsBashforth2::AdamsBashforth2
|
pFlow::AdamsBashforth2::AdamsBashforth2
|
||||||
(
|
(
|
||||||
const word& baseName,
|
const word& baseName,
|
||||||
repository& owner,
|
pointStructure& pStruct,
|
||||||
const pointStructure& pStruct,
|
const word& method,
|
||||||
const word& method
|
const realx3Field_D& initialValField
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
integration(baseName, owner, pStruct, method),
|
integration(baseName, pStruct, method, initialValField),
|
||||||
dy1_(
|
realx3PointField_D
|
||||||
owner.emplaceObject<realx3PointField_D>(
|
(
|
||||||
objectFile(
|
objectFile
|
||||||
groupNames(baseName,"dy1"),
|
(
|
||||||
"",
|
groupNames(baseName,"dy1"),
|
||||||
objectFile::READ_IF_PRESENT,
|
pStruct.time().integrationFolder(),
|
||||||
objectFile::WRITE_ALWAYS),
|
objectFile::READ_IF_PRESENT,
|
||||||
pStruct,
|
objectFile::WRITE_ALWAYS
|
||||||
zero3))
|
),
|
||||||
{
|
pStruct,
|
||||||
|
zero3
|
||||||
}
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
bool pFlow::AdamsBashforth2::predict
|
bool pFlow::AdamsBashforth2::predict
|
||||||
(
|
(
|
||||||
real UNUSED(dt),
|
real UNUSED(dt),
|
||||||
realx3Vector_D& UNUSED(y),
|
realx3PointField_D& UNUSED(y),
|
||||||
realx3Vector_D& UNUSED(dy)
|
realx3PointField_D& UNUSED(dy)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -58,17 +129,19 @@ bool pFlow::AdamsBashforth2::predict
|
|||||||
bool pFlow::AdamsBashforth2::correct
|
bool pFlow::AdamsBashforth2::correct
|
||||||
(
|
(
|
||||||
real dt,
|
real dt,
|
||||||
realx3Vector_D& y,
|
realx3PointField_D& y,
|
||||||
realx3Vector_D& dy
|
realx3PointField_D& dy
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if(this->pStruct().allActive())
|
auto& dy1l = dy1();
|
||||||
|
|
||||||
|
if(dy1l.isAllActive())
|
||||||
{
|
{
|
||||||
return intAll(dt, y, dy, this->pStruct().activeRange());
|
return intAllActive(dt, y, dy, dy1l);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return intRange(dt, y, dy, this->pStruct().activePointsMaskD());
|
return intScattered(dt, y, dy, dy1l);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -81,25 +154,3 @@ bool pFlow::AdamsBashforth2::setInitialVals(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::AdamsBashforth2::intAll(
|
|
||||||
real dt,
|
|
||||||
realx3Vector_D& y,
|
|
||||||
realx3Vector_D& dy,
|
|
||||||
range activeRng)
|
|
||||||
{
|
|
||||||
|
|
||||||
auto d_dy = dy.deviceVectorAll();
|
|
||||||
auto d_y = y.deviceVectorAll();
|
|
||||||
auto d_dy1= dy1_.deviceVectorAll();
|
|
||||||
|
|
||||||
Kokkos::parallel_for(
|
|
||||||
"AdamsBashforth2::correct",
|
|
||||||
rpIntegration (activeRng.first, activeRng.second),
|
|
||||||
LAMBDA_HD(int32 i){
|
|
||||||
d_y[i] += dt*(static_cast<real>(3.0 / 2.0) * d_dy[i] - static_cast<real>(1.0 / 2.0) * d_dy1[i]);
|
|
||||||
d_dy1[i] = d_dy[i];
|
|
||||||
});
|
|
||||||
Kokkos::fence();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
@ -36,20 +36,16 @@ namespace pFlow
|
|||||||
*/
|
*/
|
||||||
class AdamsBashforth2
|
class AdamsBashforth2
|
||||||
:
|
:
|
||||||
public integration
|
public integration,
|
||||||
|
public realx3PointField_D
|
||||||
{
|
{
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
/// dy at t-dt
|
|
||||||
realx3PointField_D& dy1_;
|
|
||||||
|
|
||||||
/// Range policy for integration kernel (alias)
|
|
||||||
using rpIntegration = Kokkos::RangePolicy<
|
|
||||||
DefaultExecutionSpace,
|
|
||||||
Kokkos::Schedule<Kokkos::Static>,
|
|
||||||
Kokkos::IndexType<int32>
|
|
||||||
>;
|
|
||||||
|
|
||||||
|
auto& dy1()
|
||||||
|
{
|
||||||
|
return static_cast<realx3PointField_D&>(*this);
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// Type info
|
/// Type info
|
||||||
@ -60,17 +56,12 @@ public:
|
|||||||
/// Construct from components
|
/// Construct from components
|
||||||
AdamsBashforth2(
|
AdamsBashforth2(
|
||||||
const word& baseName,
|
const word& baseName,
|
||||||
repository& owner,
|
pointStructure& pStruct,
|
||||||
const pointStructure& pStruct,
|
const word& method,
|
||||||
const word& method);
|
const realx3Field_D& initialValField);
|
||||||
|
|
||||||
uniquePtr<integration> clone()const override
|
|
||||||
{
|
|
||||||
return makeUnique<AdamsBashforth2>(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
virtual ~AdamsBashforth2()=default;
|
~AdamsBashforth2()final = default;
|
||||||
|
|
||||||
/// Add this to the virtual constructor table
|
/// Add this to the virtual constructor table
|
||||||
add_vCtor(
|
add_vCtor(
|
||||||
@ -80,71 +71,33 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// - Methods
|
// - Methods
|
||||||
|
/// return integration method
|
||||||
|
word method()const override
|
||||||
|
{
|
||||||
|
return "AdamsBashforth2";
|
||||||
|
}
|
||||||
|
|
||||||
bool predict(
|
bool predict(
|
||||||
real UNUSED(dt),
|
real UNUSED(dt),
|
||||||
realx3Vector_D& UNUSED(y),
|
realx3PointField_D& UNUSED(y),
|
||||||
realx3Vector_D& UNUSED(dy)) override;
|
realx3PointField_D& UNUSED(dy)) final;
|
||||||
|
|
||||||
bool correct(
|
bool correct(
|
||||||
real dt,
|
real dt,
|
||||||
realx3Vector_D& y,
|
realx3PointField_D& y,
|
||||||
realx3Vector_D& dy) override;
|
realx3PointField_D& dy) final;
|
||||||
|
|
||||||
bool setInitialVals(
|
bool setInitialVals(
|
||||||
const int32IndexContainer& newIndices,
|
const int32IndexContainer& newIndices,
|
||||||
const realx3Vector& y) override;
|
const realx3Vector& y) final;
|
||||||
|
|
||||||
bool needSetInitialVals()const override
|
bool needSetInitialVals()const final
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Integrate on all points in the active range
|
|
||||||
bool intAll(
|
|
||||||
real dt,
|
|
||||||
realx3Vector_D& y,
|
|
||||||
realx3Vector_D& dy,
|
|
||||||
range activeRng);
|
|
||||||
|
|
||||||
/// Integrate on active points in the active range
|
|
||||||
template<typename activeFunctor>
|
|
||||||
bool intRange(
|
|
||||||
real dt,
|
|
||||||
realx3Vector_D& y,
|
|
||||||
realx3Vector_D& dy,
|
|
||||||
activeFunctor activeP );
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename activeFunctor>
|
|
||||||
bool pFlow::AdamsBashforth2::intRange(
|
|
||||||
real dt,
|
|
||||||
realx3Vector_D& y,
|
|
||||||
realx3Vector_D& dy,
|
|
||||||
activeFunctor activeP )
|
|
||||||
{
|
|
||||||
|
|
||||||
auto d_dy = dy.deviceVectorAll();
|
|
||||||
auto d_y = y.deviceVectorAll();
|
|
||||||
auto d_dy1= dy1_.deviceVectorAll();
|
|
||||||
auto activeRng = activeP.activeRange();
|
|
||||||
|
|
||||||
Kokkos::parallel_for(
|
|
||||||
"AdamsBashforth2::correct",
|
|
||||||
rpIntegration (activeRng.first, activeRng.second),
|
|
||||||
LAMBDA_HD(int32 i){
|
|
||||||
if( activeP(i))
|
|
||||||
{
|
|
||||||
d_y[i] += dt*(static_cast<real>(3.0 / 2.0) * d_dy[i] - static_cast<real>(1.0 / 2.0) * d_dy1[i]);
|
|
||||||
d_dy1[i] = d_dy[i];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Kokkos::fence();
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // pFlow
|
} // pFlow
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
|
|
||||||
list(APPEND SourceFiles
|
list(APPEND SourceFiles
|
||||||
integration/integration.cpp
|
integration/integration.cpp
|
||||||
AdamsBashforth5/AdamsBashforth5.cpp
|
|
||||||
AdamsBashforth4/AdamsBashforth4.cpp
|
|
||||||
AdamsBashforth3/AdamsBashforth3.cpp
|
|
||||||
AdamsBashforth2/AdamsBashforth2.cpp
|
AdamsBashforth2/AdamsBashforth2.cpp
|
||||||
AdamsMoulton3/AdamsMoulton3.cpp
|
#AdamsBashforth5/AdamsBashforth5.cpp
|
||||||
AdamsMoulton4/AdamsMoulton4.cpp
|
#AdamsBashforth4/AdamsBashforth4.cpp
|
||||||
AdamsMoulton5/AdamsMoulton5.cpp
|
#AdamsBashforth3/AdamsBashforth3.cpp
|
||||||
|
#AdamsMoulton3/AdamsMoulton3.cpp
|
||||||
|
#AdamsMoulton4/AdamsMoulton4.cpp
|
||||||
|
#AdamsMoulton5/AdamsMoulton5.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(link_libs Kokkos::kokkos phasicFlow)
|
set(link_libs Kokkos::kokkos phasicFlow)
|
||||||
|
@ -19,33 +19,35 @@ Licence:
|
|||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "integration.hpp"
|
#include "integration.hpp"
|
||||||
|
#include "pointStructure.hpp"
|
||||||
|
#include "repository.hpp"
|
||||||
|
|
||||||
pFlow::integration::integration
|
pFlow::integration::integration
|
||||||
(
|
(
|
||||||
const word& baseName,
|
const word& baseName,
|
||||||
repository& owner,
|
pointStructure& pStruct,
|
||||||
const pointStructure& pStruct,
|
const word&,
|
||||||
const word& method
|
const realx3Field_D&
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
owner_(owner),
|
owner_(*pStruct.owner()),
|
||||||
baseName_(baseName),
|
pStruct_(pStruct),
|
||||||
pStruct_(pStruct)
|
baseName_(baseName)
|
||||||
{
|
{}
|
||||||
CONSUME_PARAM(method);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pFlow::uniquePtr<pFlow::integration>
|
pFlow::uniquePtr<pFlow::integration>
|
||||||
pFlow::integration::create(
|
pFlow::integration::create
|
||||||
|
(
|
||||||
const word& baseName,
|
const word& baseName,
|
||||||
repository& owner,
|
pointStructure& pStruct,
|
||||||
const pointStructure& pStruct,
|
const word& method,
|
||||||
const word& method)
|
const realx3Field_D& initialValField
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if( wordvCtorSelector_.search(method) )
|
if( wordvCtorSelector_.search(method) )
|
||||||
{
|
{
|
||||||
return wordvCtorSelector_[method] (baseName, owner, pStruct, method);
|
return wordvCtorSelector_[method] (baseName, pStruct, method, initialValField);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -23,14 +23,16 @@ Licence:
|
|||||||
|
|
||||||
|
|
||||||
#include "virtualConstructor.hpp"
|
#include "virtualConstructor.hpp"
|
||||||
#include "Vectors.hpp"
|
#include "pointFields.hpp"
|
||||||
#include "pointStructure.hpp"
|
|
||||||
#include "repository.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// - Forward
|
||||||
|
class repository;
|
||||||
|
class pointStructure;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for integrating the first order ODE (IVP)
|
* Base class for integrating the first order ODE (IVP)
|
||||||
*
|
*
|
||||||
@ -48,19 +50,19 @@ namespace pFlow
|
|||||||
*/
|
*/
|
||||||
class integration
|
class integration
|
||||||
{
|
{
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
// - Protected data members
|
// - Protected data members
|
||||||
|
|
||||||
/// The owner repository that all fields are storred in
|
/// The owner repository that all fields are storred in
|
||||||
repository& owner_;
|
repository& owner_;
|
||||||
|
|
||||||
/// The base name for integration
|
|
||||||
const word baseName_;
|
|
||||||
|
|
||||||
/// A reference to pointStructure
|
/// A reference to pointStructure
|
||||||
const pointStructure& pStruct_;
|
const pointStructure& pStruct_;
|
||||||
|
|
||||||
|
/// The base name for integration
|
||||||
|
const word baseName_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// Type info
|
/// Type info
|
||||||
@ -72,9 +74,9 @@ public:
|
|||||||
/// Construct from components
|
/// Construct from components
|
||||||
integration(
|
integration(
|
||||||
const word& baseName,
|
const word& baseName,
|
||||||
repository& owner,
|
pointStructure& pStruct,
|
||||||
const pointStructure& pStruct,
|
const word& method,
|
||||||
const word& method);
|
const realx3Field_D& initialValField);
|
||||||
|
|
||||||
/// Copy constructor
|
/// Copy constructor
|
||||||
integration(const integration&) = default;
|
integration(const integration&) = default;
|
||||||
@ -88,22 +90,22 @@ public:
|
|||||||
/// Move assignment
|
/// Move assignment
|
||||||
integration& operator = (integration&&) = default;
|
integration& operator = (integration&&) = default;
|
||||||
|
|
||||||
/// Polymorphic copy/cloning
|
|
||||||
virtual
|
|
||||||
uniquePtr<integration> clone()const=0;
|
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
virtual ~integration()=default;
|
virtual ~integration()=default;
|
||||||
|
|
||||||
/// Add a virtual constructor
|
/// Add a virtual constructor
|
||||||
create_vCtor(
|
create_vCtor
|
||||||
|
(
|
||||||
integration,
|
integration,
|
||||||
word,
|
word,
|
||||||
(const word& baseName,
|
(
|
||||||
repository& owner,
|
const word& baseName,
|
||||||
const pointStructure& pStruct,
|
pointStructure& pStruct,
|
||||||
const word& method),
|
const word& method,
|
||||||
(baseName, owner, pStruct, method) );
|
const realx3Field_D& initialValField
|
||||||
|
),
|
||||||
|
(baseName, pStruct, method, initialValField)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// - Methods
|
// - Methods
|
||||||
@ -129,13 +131,17 @@ public:
|
|||||||
return owner_;
|
return owner_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// return integration method
|
||||||
|
virtual
|
||||||
|
word method()const = 0 ;
|
||||||
|
|
||||||
/// Prediction step in integration
|
/// Prediction step in integration
|
||||||
virtual
|
virtual
|
||||||
bool predict(real dt, realx3Vector_D& y, realx3Vector_D& dy) = 0;
|
bool predict(real dt, realx3PointField_D& y, realx3PointField_D& dy) = 0;
|
||||||
|
|
||||||
/// Correction/main integration step
|
/// Correction/main integration step
|
||||||
virtual
|
virtual
|
||||||
bool correct(real dt, realx3Vector_D& y, realx3Vector_D& dy) = 0;
|
bool correct(real dt, realx3PointField_D& y, realx3PointField_D& dy) = 0;
|
||||||
|
|
||||||
/// Set the initial values for new indices
|
/// Set the initial values for new indices
|
||||||
virtual
|
virtual
|
||||||
@ -152,9 +158,9 @@ public:
|
|||||||
static
|
static
|
||||||
uniquePtr<integration> create(
|
uniquePtr<integration> create(
|
||||||
const word& baseName,
|
const word& baseName,
|
||||||
repository& owner,
|
pointStructure& pStruct,
|
||||||
const pointStructure& pStruct,
|
const word& method,
|
||||||
const word& method);
|
const realx3Field_D& initialValField);
|
||||||
|
|
||||||
}; // integration
|
}; // integration
|
||||||
|
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
set(SourceFiles
|
set(SourceFiles
|
||||||
dynamicPointStructure/dynamicPointStructure.cpp
|
dynamicPointStructure/dynamicPointStructure.cpp
|
||||||
particles/particles.cpp
|
particles/particles.cpp
|
||||||
particles/particleIdHandler.cpp
|
#particles/particleIdHandler.cpp
|
||||||
SphereParticles/sphereShape/sphereShape.cpp
|
#SphereParticles/sphereShape/sphereShape.cpp
|
||||||
SphereParticles/sphereParticles/sphereParticles.cpp
|
#SphereParticles/sphereParticles/sphereParticles.cpp
|
||||||
Insertion/shapeMixture/shapeMixture.cpp
|
#Insertion/shapeMixture/shapeMixture.cpp
|
||||||
Insertion/insertion/insertion.cpp
|
#Insertion/insertion/insertion.cpp
|
||||||
Insertion/Insertion/Insertions.cpp
|
#Insertion/Insertion/Insertions.cpp
|
||||||
Insertion/insertionRegion/insertionRegion.cpp
|
#Insertion/insertionRegion/insertionRegion.cpp
|
||||||
Insertion/insertionRegion/timeFlowControl.cpp
|
#Insertion/insertionRegion/timeFlowControl.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(link_libs Kokkos::kokkos phasicFlow Integration Property)
|
set(link_libs Kokkos::kokkos phasicFlow Integration Property)
|
||||||
|
@ -19,57 +19,40 @@ Licence:
|
|||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "dynamicPointStructure.hpp"
|
#include "dynamicPointStructure.hpp"
|
||||||
|
#include "systemControl.hpp"
|
||||||
|
|
||||||
pFlow::dynamicPointStructure::dynamicPointStructure
|
pFlow::dynamicPointStructure::dynamicPointStructure
|
||||||
(
|
(
|
||||||
Time& time,
|
systemControl& control
|
||||||
const word& integrationMethod
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
time_(time),
|
pointStructure(control),
|
||||||
integrationMethod_(integrationMethod),
|
velocity_
|
||||||
pStruct_(
|
(
|
||||||
time_.emplaceObject<pointStructure>(
|
objectFile(
|
||||||
objectFile(
|
"velocity",
|
||||||
pointStructureFile__,
|
"",
|
||||||
"",
|
objectFile::READ_ALWAYS,
|
||||||
objectFile::READ_ALWAYS,
|
objectFile::WRITE_ALWAYS
|
||||||
objectFile::WRITE_ALWAYS
|
),
|
||||||
)
|
*this,
|
||||||
)
|
zero3
|
||||||
),
|
),
|
||||||
velocity_(
|
integrationMethod_
|
||||||
time_.emplaceObject<realx3PointField_D>(
|
(
|
||||||
objectFile(
|
control.settingsDict().getVal<word>("integrationMethod")
|
||||||
"velocity",
|
)
|
||||||
"",
|
|
||||||
objectFile::READ_ALWAYS,
|
|
||||||
objectFile::WRITE_ALWAYS
|
|
||||||
),
|
|
||||||
pStruct(),
|
|
||||||
zero3
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
this->subscribe(pStruct());
|
|
||||||
|
|
||||||
REPORT(1)<< "Creating integration method "<<
|
REPORT(1)<< "Creating integration method "<<
|
||||||
greenText(integrationMethod_)<<" for dynamicPointStructure."<<endREPORT;
|
Green_Text(integrationMethod_)<<" for dynamicPointStructure."<<END_REPORT;
|
||||||
|
|
||||||
integrationPos_ = integration::create(
|
integrationPos_ = integration::create
|
||||||
|
(
|
||||||
"pStructPosition",
|
"pStructPosition",
|
||||||
time_.integration(),
|
*this,
|
||||||
pStruct(),
|
integrationMethod_,
|
||||||
integrationMethod_);
|
pointPosition()
|
||||||
|
);
|
||||||
integrationVel_ = integration::create(
|
|
||||||
"pStructVelocity",
|
|
||||||
time_.integration(),
|
|
||||||
pStruct(),
|
|
||||||
integrationMethod_);
|
|
||||||
|
|
||||||
if( !integrationPos_ )
|
if( !integrationPos_ )
|
||||||
{
|
{
|
||||||
@ -77,6 +60,14 @@ pFlow::dynamicPointStructure::dynamicPointStructure
|
|||||||
" error in creating integration object for dynamicPointStructure (position). \n";
|
" error in creating integration object for dynamicPointStructure (position). \n";
|
||||||
fatalExit;
|
fatalExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
integrationVel_ = integration::create
|
||||||
|
(
|
||||||
|
"pStructVelocity",
|
||||||
|
*this,
|
||||||
|
integrationMethod_,
|
||||||
|
velocity_.field()
|
||||||
|
);
|
||||||
|
|
||||||
if( !integrationVel_ )
|
if( !integrationVel_ )
|
||||||
{
|
{
|
||||||
@ -85,8 +76,10 @@ pFlow::dynamicPointStructure::dynamicPointStructure
|
|||||||
fatalExit;
|
fatalExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WARNING << "Initialization of integrationPos_ and integrationVel_ should be doen!"<<END_WARNING;
|
||||||
|
|
||||||
if(!integrationPos_->needSetInitialVals()) return;
|
/*if(!integrationPos_->needSetInitialVals()) return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -107,14 +100,13 @@ pFlow::dynamicPointStructure::dynamicPointStructure
|
|||||||
vel.push_back( hVel[index(i)]);
|
vel.push_back( hVel[index(i)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//output<< "pos "<< pos<<endl;
|
|
||||||
//output<< "vel "<< vel<<endl;
|
|
||||||
|
|
||||||
REPORT(2)<< "Initializing the required vectors for position integratoin "<<endREPORT;
|
REPORT(2)<< "Initializing the required vectors for position integratoin "<<endREPORT;
|
||||||
integrationPos_->setInitialVals(indexHD, pos);
|
integrationPos_->setInitialVals(indexHD, pos);
|
||||||
|
|
||||||
REPORT(2)<< "Initializing the required vectors for velocity integratoin\n "<<endREPORT;
|
REPORT(2)<< "Initializing the required vectors for velocity integratoin\n "<<endREPORT;
|
||||||
integrationVel_->setInitialVals(indexHD, vel);
|
integrationVel_->setInitialVals(indexHD, vel);*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::dynamicPointStructure::predict
|
bool pFlow::dynamicPointStructure::predict
|
||||||
@ -123,10 +115,10 @@ bool pFlow::dynamicPointStructure::predict
|
|||||||
realx3PointField_D& acceleration
|
realx3PointField_D& acceleration
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto& pos = pStruct().pointPosition();
|
//auto& pos = pStruct().pointPosition();
|
||||||
|
|
||||||
if(!integrationPos_().predict(dt, pos.VectorField(), velocity_.VectorField() ))return false;
|
//if(!integrationPos_().predict(dt, pos.VectorField(), velocity_.VectorField() ))return false;
|
||||||
if(!integrationVel_().predict(dt, velocity_.VectorField(), acceleration.VectorField()))return false;
|
//if(!integrationVel_().predict(dt, velocity_.VectorField(), acceleration.VectorField()))return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -137,11 +129,11 @@ bool pFlow::dynamicPointStructure::correct
|
|||||||
realx3PointField_D& acceleration
|
realx3PointField_D& acceleration
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto& pos = pStruct().pointPosition();
|
//auto& pos = pStruct().pointPosition();
|
||||||
|
|
||||||
if(!integrationPos_().correct(dt, pos.VectorField(), velocity_.VectorField() ))return false;
|
//if(!integrationPos_().correct(dt, pos.VectorField(), velocity_.VectorField() ))return false;
|
||||||
|
|
||||||
if(!integrationVel_().correct(dt, velocity_.VectorField(), acceleration.VectorField()))return false;
|
//if(!integrationVel_().correct(dt, velocity_.VectorField(), acceleration.VectorField()))return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -178,7 +170,7 @@ pFlow::uniquePtr<pFlow::int32IndexContainer> pFlow::dynamicPointStructure::inser
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
bool pFlow::dynamicPointStructure::update(
|
/*bool pFlow::dynamicPointStructure::update(
|
||||||
const eventMessage& msg)
|
const eventMessage& msg)
|
||||||
{
|
{
|
||||||
if( msg.isInsert())
|
if( msg.isInsert())
|
||||||
@ -215,4 +207,4 @@ bool pFlow::dynamicPointStructure::update(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}*/
|
@ -30,98 +30,65 @@ Licence:
|
|||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class systemControl;
|
||||||
|
|
||||||
class dynamicPointStructure
|
class dynamicPointStructure
|
||||||
:
|
:
|
||||||
//public pointStructure
|
public pointStructure
|
||||||
public eventObserver
|
|
||||||
{
|
{
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
Time& time_;
|
realx3PointField_D velocity_;
|
||||||
|
|
||||||
word integrationMethod_;
|
uniquePtr<integration> integrationPos_ = nullptr;
|
||||||
|
|
||||||
pointStructure& pStruct_;
|
uniquePtr<integration> integrationVel_ = nullptr;
|
||||||
|
|
||||||
realx3PointField_D& velocity_;
|
/// @brief integration method for velocity and position
|
||||||
|
word integrationMethod_;
|
||||||
uniquePtr<integration> integrationPos_;
|
|
||||||
|
|
||||||
uniquePtr<integration> integrationVel_;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TypeInfo("dynamicPointStructure");
|
TypeInfo("dynamicPointStructure");
|
||||||
|
|
||||||
dynamicPointStructure(Time& time, const word& integrationMethod);
|
dynamicPointStructure(systemControl& control);
|
||||||
|
|
||||||
dynamicPointStructure(const dynamicPointStructure& ps) = default;
|
|
||||||
|
|
||||||
|
dynamicPointStructure(const dynamicPointStructure& ps) = delete;
|
||||||
|
|
||||||
// - no move construct
|
// - no move construct
|
||||||
dynamicPointStructure(dynamicPointStructure&&) = delete;
|
dynamicPointStructure(dynamicPointStructure&&) = delete;
|
||||||
|
|
||||||
// - copy assignment
|
///
|
||||||
//
|
dynamicPointStructure& operator=(const dynamicPointStructure&) = delete;
|
||||||
// should be changed, may causs undefined behavior
|
|
||||||
//////////////////////////////////////////////////////////////
|
|
||||||
dynamicPointStructure& operator=(const dynamicPointStructure&) = default;
|
|
||||||
|
|
||||||
// - no move assignment
|
// - no move assignment
|
||||||
dynamicPointStructure& operator=(dynamicPointStructure&&) = delete;
|
dynamicPointStructure& operator=(dynamicPointStructure&&) = delete;
|
||||||
|
|
||||||
// - destructor
|
// - destructor
|
||||||
virtual ~dynamicPointStructure() = default;
|
~dynamicPointStructure() override = default;
|
||||||
|
|
||||||
|
|
||||||
inline pointStructure& pStruct()
|
inline
|
||||||
{
|
const realx3PointField_D& velocity()const
|
||||||
return pStruct_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const pointStructure& pStruct() const
|
|
||||||
{
|
|
||||||
return pStruct_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const realx3PointField_D& velocity()const
|
|
||||||
{
|
{
|
||||||
return velocity_;
|
return velocity_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline auto velocityHostAll()
|
inline
|
||||||
|
realx3PointField_D& velocity()
|
||||||
|
{
|
||||||
|
return velocity_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*inline auto velocityHostAll()
|
||||||
{
|
{
|
||||||
return velocity_.hostVectorAll();
|
return velocity_.hostVectorAll();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
inline auto pointPositionHostAll()
|
|
||||||
{
|
|
||||||
return pStruct_.pointPositionHostAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto markDeleteOutOfBox(const box& domain)
|
|
||||||
{
|
|
||||||
return pStruct_.markDeleteOutOfBox(domain);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool predict(real dt, realx3PointField_D& acceleration);
|
bool predict(real dt, realx3PointField_D& acceleration);
|
||||||
|
|
||||||
bool correct(real dt, realx3PointField_D& acceleration);
|
bool correct(real dt, realx3PointField_D& acceleration);
|
||||||
|
|
||||||
|
|
||||||
// - update data structure by inserting/setting new points
|
|
||||||
// Notifies all the fields in the registered list of data structure
|
|
||||||
// and exclude the fields that re in the exclusionList
|
|
||||||
// retrun nullptr if it fails
|
|
||||||
/*FUNCTION_H
|
|
||||||
virtual uniquePtr<int32IndexContainer> insertPoints(
|
|
||||||
const realx3Vector& pos,
|
|
||||||
const List<eventObserver*>& exclusionList={nullptr}
|
|
||||||
)override;*/
|
|
||||||
|
|
||||||
bool update(const eventMessage& msg) override;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,135 +24,107 @@ Licence:
|
|||||||
|
|
||||||
pFlow::particles::particles
|
pFlow::particles::particles
|
||||||
(
|
(
|
||||||
systemControl& control,
|
systemControl& control
|
||||||
const word& integrationMethod
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
demParticles(control),
|
observer(),
|
||||||
time_(control.time()),
|
demComponent("particles", control),
|
||||||
integrationMethod_(integrationMethod),
|
dynPointStruct_(control),
|
||||||
/*dynPointStruct_(
|
id_
|
||||||
time_.emplaceObject<dynamicPointStructure>(
|
(
|
||||||
objectFile(
|
objectFile
|
||||||
pointStructureFile__,
|
(
|
||||||
"",
|
"id",
|
||||||
objectFile::READ_ALWAYS,
|
"",
|
||||||
objectFile::WRITE_ALWAYS
|
objectFile::READ_IF_PRESENT,
|
||||||
),
|
objectFile::WRITE_ALWAYS
|
||||||
control.time(),
|
|
||||||
integrationMethod
|
|
||||||
)
|
|
||||||
),*/
|
|
||||||
dynPointStruct_(
|
|
||||||
control.time(),
|
|
||||||
integrationMethod),
|
|
||||||
shapeName_(
|
|
||||||
control.time().emplaceObject<wordPointField>(
|
|
||||||
objectFile(
|
|
||||||
"shapeName",
|
|
||||||
"",
|
|
||||||
objectFile::READ_ALWAYS,
|
|
||||||
objectFile::WRITE_ALWAYS,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
pStruct(),
|
|
||||||
word("NO_NAME_SHAPE")
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
id_(
|
dynPointStruct_,
|
||||||
control.time().emplaceObject<int32PointField_HD>(
|
static_cast<uint32>(-1)
|
||||||
objectFile(
|
),
|
||||||
"id",
|
propertyId_
|
||||||
"",
|
(
|
||||||
objectFile::READ_IF_PRESENT,
|
objectFile
|
||||||
objectFile::WRITE_ALWAYS
|
(
|
||||||
),
|
"propertyId",
|
||||||
pStruct(),
|
"",
|
||||||
static_cast<int32>(-1)
|
objectFile::READ_NEVER,
|
||||||
)
|
objectFile::WRITE_NEVER
|
||||||
),
|
),
|
||||||
propertyId_(
|
dynPointStruct_,
|
||||||
control.time().emplaceObject<int8PointField_D>(
|
static_cast<int8>(0)
|
||||||
objectFile(
|
),
|
||||||
"propertyId",
|
diameter_
|
||||||
"",
|
(
|
||||||
objectFile::READ_NEVER,
|
objectFile
|
||||||
objectFile::WRITE_NEVER
|
(
|
||||||
),
|
"diameter",
|
||||||
pStruct(),
|
"",
|
||||||
static_cast<int8>(0)
|
objectFile::READ_NEVER,
|
||||||
)
|
objectFile::WRITE_ALWAYS
|
||||||
),
|
),
|
||||||
diameter_(
|
dynPointStruct_,
|
||||||
control.time().emplaceObject<realPointField_D>(
|
0.00000000001
|
||||||
objectFile(
|
),
|
||||||
"diameter",
|
mass_
|
||||||
"",
|
(
|
||||||
objectFile::READ_NEVER,
|
objectFile
|
||||||
objectFile::WRITE_ALWAYS
|
(
|
||||||
),
|
"mass",
|
||||||
pStruct(),
|
"",
|
||||||
static_cast<real>(0.00000000001)
|
objectFile::READ_NEVER,
|
||||||
)
|
objectFile::WRITE_ALWAYS
|
||||||
),
|
),
|
||||||
mass_(
|
dynPointStruct_,
|
||||||
control.time().emplaceObject<realPointField_D>(
|
0.0000000001
|
||||||
objectFile(
|
),
|
||||||
"mass",
|
accelertion_
|
||||||
"",
|
(
|
||||||
objectFile::READ_NEVER,
|
objectFile
|
||||||
objectFile::WRITE_ALWAYS
|
(
|
||||||
),
|
"accelertion",
|
||||||
pStruct(),
|
"",
|
||||||
static_cast<real>(0.0000000001)
|
objectFile::READ_IF_PRESENT,
|
||||||
)
|
objectFile::WRITE_ALWAYS
|
||||||
|
),
|
||||||
|
dynPointStruct_,
|
||||||
|
zero3
|
||||||
|
),
|
||||||
|
contactForce_
|
||||||
|
(
|
||||||
|
objectFile
|
||||||
|
(
|
||||||
|
"contactForce",
|
||||||
|
"",
|
||||||
|
objectFile::READ_IF_PRESENT,
|
||||||
|
objectFile::WRITE_ALWAYS
|
||||||
),
|
),
|
||||||
accelertion_(
|
dynPointStruct_,
|
||||||
control.time().emplaceObject<realx3PointField_D>(
|
zero3
|
||||||
objectFile(
|
),
|
||||||
"accelertion",
|
contactTorque_
|
||||||
"",
|
(
|
||||||
objectFile::READ_IF_PRESENT,
|
|
||||||
objectFile::WRITE_ALWAYS
|
objectFile
|
||||||
),
|
(
|
||||||
pStruct(),
|
"contactTorque",
|
||||||
zero3
|
"",
|
||||||
)
|
objectFile::READ_IF_PRESENT,
|
||||||
|
objectFile::WRITE_ALWAYS
|
||||||
),
|
),
|
||||||
contactForce_(
|
dynPointStruct_,
|
||||||
control.time().emplaceObject<realx3PointField_D>(
|
zero3
|
||||||
objectFile(
|
)
|
||||||
"contactForce",
|
|
||||||
"",
|
|
||||||
objectFile::READ_IF_PRESENT,
|
|
||||||
objectFile::WRITE_ALWAYS
|
|
||||||
),
|
|
||||||
pStruct(),
|
|
||||||
zero3
|
|
||||||
)
|
|
||||||
),
|
|
||||||
contactTorque_(
|
|
||||||
control.time().emplaceObject<realx3PointField_D>(
|
|
||||||
objectFile(
|
|
||||||
"contactTorque",
|
|
||||||
"",
|
|
||||||
objectFile::READ_IF_PRESENT,
|
|
||||||
objectFile::WRITE_ALWAYS
|
|
||||||
),
|
|
||||||
pStruct(),
|
|
||||||
zero3
|
|
||||||
)
|
|
||||||
),
|
|
||||||
idHandler_(id_)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
this->subscribe(pStruct());
|
WARNING<<"Subscribe particles"<<END_WARNING;
|
||||||
|
//this->subscribe(pStruct());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::particles::beforeIteration()
|
bool pFlow::particles::beforeIteration()
|
||||||
{
|
{
|
||||||
auto domain = this->control().domain();
|
/*auto domain = this->control().domain();
|
||||||
|
|
||||||
auto numMarked = dynPointStruct_.markDeleteOutOfBox(domain);
|
auto numMarked = dynPointStruct_.markDeleteOutOfBox(domain);
|
||||||
|
|
||||||
@ -174,12 +146,12 @@ bool pFlow::particles::beforeIteration()
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->zeroForce();
|
this->zeroForce();
|
||||||
this->zeroTorque();
|
this->zeroTorque();*/
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::uniquePtr<pFlow::List<pFlow::eventObserver*>>
|
/*pFlow::uniquePtr<pFlow::List<pFlow::eventObserver*>>
|
||||||
pFlow::particles::getFieldObjectList()const
|
pFlow::particles::getFieldObjectList()const
|
||||||
{
|
{
|
||||||
auto objListPtr = makeUnique<pFlow::List<pFlow::eventObserver*>>();
|
auto objListPtr = makeUnique<pFlow::List<pFlow::eventObserver*>>();
|
||||||
@ -199,4 +171,4 @@ pFlow::particles::getFieldObjectList()const
|
|||||||
static_cast<eventObserver*>(&shapeName_) );
|
static_cast<eventObserver*>(&shapeName_) );
|
||||||
|
|
||||||
return objListPtr;
|
return objListPtr;
|
||||||
}
|
}*/
|
||||||
|
@ -23,66 +23,75 @@ Licence:
|
|||||||
#define __particles_hpp__
|
#define __particles_hpp__
|
||||||
|
|
||||||
#include "dynamicPointStructure.hpp"
|
#include "dynamicPointStructure.hpp"
|
||||||
#include "particleIdHandler.hpp"
|
#include "demComponent.hpp"
|
||||||
#include "demParticles.hpp"
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
class setFieldList;
|
|
||||||
|
|
||||||
class particles
|
class particles
|
||||||
:
|
:
|
||||||
public eventObserver,
|
public observer,
|
||||||
public demParticles
|
public demComponent
|
||||||
{
|
{
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
// owner repository
|
/// dynamic point structure for particles center mass
|
||||||
Time& time_;
|
|
||||||
|
|
||||||
const word integrationMethod_;
|
|
||||||
|
|
||||||
// dynamic point structure for particles
|
|
||||||
dynamicPointStructure dynPointStruct_;
|
dynamicPointStructure dynPointStruct_;
|
||||||
|
|
||||||
// - name of shapes - this is managed by particles
|
// - name of shapes - this is managed by particles
|
||||||
wordPointField& shapeName_;
|
//wordPointField& shapeName_;
|
||||||
|
|
||||||
// id of particles on host
|
// id of particles on host
|
||||||
int32PointField_HD& id_;
|
int32PointField_D id_;
|
||||||
|
|
||||||
// property id on device
|
// property id on device
|
||||||
int8PointField_D& propertyId_;
|
int8PointField_D propertyId_;
|
||||||
|
|
||||||
// diameter / boundig sphere size of particles on device
|
// diameter / boundig sphere size of particles on device
|
||||||
realPointField_D& diameter_;
|
realPointField_D diameter_;
|
||||||
|
|
||||||
// mass on device
|
// mass of particles field
|
||||||
realPointField_D& mass_;
|
realPointField_D mass_;
|
||||||
|
|
||||||
// - acceleration on device
|
// - acceleration on device
|
||||||
realx3PointField_D& accelertion_;
|
realx3PointField_D accelertion_;
|
||||||
|
|
||||||
|
/// contact force field
|
||||||
|
realx3PointField_D contactForce_;
|
||||||
|
|
||||||
realx3PointField_D& contactForce_;
|
/// contact torque field
|
||||||
|
realx3PointField_D contactTorque_;
|
||||||
|
|
||||||
realx3PointField_D& contactTorque_;
|
|
||||||
|
|
||||||
|
|
||||||
// - object handling particle id
|
|
||||||
particleIdHandler idHandler_;
|
|
||||||
|
|
||||||
virtual uniquePtr<List<eventObserver*>> getFieldObjectList()const;
|
|
||||||
|
|
||||||
void zeroForce()
|
void zeroForce()
|
||||||
{
|
{
|
||||||
contactForce_.fill(zero3);
|
WARNING<<"fill contactTorque"<<END_WARNING;
|
||||||
|
//contactForce_.fill(zero3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zeroTorque()
|
void zeroTorque()
|
||||||
{
|
{
|
||||||
contactTorque_.fill(zero3);
|
WARNING<<"fill contactTorque"<<END_WARNING;
|
||||||
|
//contactTorque_.fill(zero3);
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
|
||||||
|
inline auto& dynPointStruct()
|
||||||
|
{
|
||||||
|
return dynPointStruct_;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline auto& pointPosition()
|
||||||
|
{
|
||||||
|
return dynPointStruct_.pointPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
auto& velocity()
|
||||||
|
{
|
||||||
|
return dynPointStruct_.velocity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -90,166 +99,132 @@ public:
|
|||||||
// type info
|
// type info
|
||||||
TypeInfo("particles");
|
TypeInfo("particles");
|
||||||
|
|
||||||
particles(systemControl& control, const word& integrationMethod);
|
explicit particles(systemControl& control);
|
||||||
|
|
||||||
inline const auto& time()const {
|
|
||||||
return time_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline auto& time() {
|
|
||||||
return time_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline auto integrationMethod()const
|
|
||||||
{
|
|
||||||
return integrationMethod_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const auto& dynPointStruct()const
|
inline const auto& dynPointStruct()const
|
||||||
{
|
{
|
||||||
return dynPointStruct_;
|
return dynPointStruct_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline auto& dynPointStruct()
|
|
||||||
{
|
|
||||||
return dynPointStruct_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const auto& pStruct()const{
|
|
||||||
return dynPointStruct_.pStruct();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline auto& pStruct(){
|
|
||||||
return dynPointStruct_.pStruct();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline auto size()const{
|
inline auto size()const{
|
||||||
return pStruct().size();
|
return dynPointStruct_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline auto capacity() const{
|
inline auto capacity() const{
|
||||||
return pStruct().capacity();
|
return dynPointStruct_.capacity();
|
||||||
}
|
|
||||||
|
|
||||||
inline auto activePointsMaskD()const{
|
|
||||||
return pStruct().activePointsMaskD();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline auto numActive()const
|
|
||||||
{
|
|
||||||
return pStruct().numActive();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool allActive()const{
|
inline auto numActive()const
|
||||||
return pStruct().allActive();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline auto activeRange()const{
|
|
||||||
return pStruct().activeRange();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline auto activePointsMaskH()const{
|
|
||||||
return pStruct().activePointsMaskH();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const auto& pointPosition()const{
|
|
||||||
return pStruct().pointPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const auto& position()const
|
|
||||||
{
|
{
|
||||||
return pStruct().pointPosition();
|
return dynPointStruct_.numActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool isAllActive()const
|
||||||
|
{
|
||||||
|
return dynPointStruct_.isAllActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const auto& pointVelocity()const{
|
inline
|
||||||
return dynPointStruct().velocity();
|
const auto& pointPosition()const
|
||||||
|
{
|
||||||
|
return dynPointStruct_.pointPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const auto& velocity()const{
|
inline
|
||||||
return dynPointStruct().velocity();
|
const auto& velocity()const
|
||||||
|
{
|
||||||
|
return dynPointStruct_.velocity();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const auto& id()const{
|
inline
|
||||||
return id_;
|
const auto& diameter()const
|
||||||
}
|
{
|
||||||
|
|
||||||
inline auto& id(){
|
|
||||||
return id_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const auto& diameter()const{
|
|
||||||
return diameter_;
|
return diameter_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline auto& diameter(){
|
inline
|
||||||
|
auto& diameter()
|
||||||
|
{
|
||||||
return diameter_;
|
return diameter_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const auto& mass()const{
|
inline
|
||||||
|
const auto& mass()const
|
||||||
|
{
|
||||||
return mass_;
|
return mass_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline auto& mass() {
|
inline auto& mass()
|
||||||
|
{
|
||||||
return mass_;
|
return mass_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const auto& accelertion()const{
|
inline
|
||||||
return accelertion_;
|
const auto& accelertion()const
|
||||||
}
|
{
|
||||||
|
|
||||||
inline auto& accelertion(){
|
|
||||||
return accelertion_;
|
return accelertion_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
realx3PointField_D& contactForce()
|
auto& accelertion()
|
||||||
|
{
|
||||||
|
return accelertion_;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
auto& contactForce()
|
||||||
{
|
{
|
||||||
return contactForce_;
|
return contactForce_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
const realx3PointField_D& contactForce() const
|
const auto& contactForce() const
|
||||||
{
|
{
|
||||||
return contactForce_;
|
return contactForce_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
realx3PointField_D& contactTorque()
|
auto& contactTorque()
|
||||||
{
|
{
|
||||||
return contactTorque_;
|
return contactTorque_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
const realx3PointField_D& contactTorque() const
|
const auto& contactTorque() const
|
||||||
{
|
{
|
||||||
return contactTorque_;
|
return contactTorque_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const auto& propertyId()const{
|
inline
|
||||||
|
const auto& propertyId()const
|
||||||
|
{
|
||||||
return propertyId_;
|
return propertyId_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline auto& propertyId(){
|
inline
|
||||||
|
auto& propertyId()
|
||||||
|
{
|
||||||
return propertyId_;
|
return propertyId_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const auto& shapeName()const{
|
/*inline const auto& shapeName()const{
|
||||||
return shapeName_;
|
return shapeName_;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
inline auto& shapName(){
|
/*inline auto& shapName(){
|
||||||
return shapeName_;
|
return shapeName_;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
bool beforeIteration() override;
|
bool beforeIteration() override;
|
||||||
|
|
||||||
virtual
|
/*virtual
|
||||||
bool insertParticles
|
bool insertParticles
|
||||||
(
|
(
|
||||||
const realx3Vector& position,
|
const realx3Vector& position,
|
||||||
const wordVector& shapes,
|
const wordVector& shapes,
|
||||||
const setFieldList& setField
|
const setFieldList& setField
|
||||||
) = 0;
|
) = 0;*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -259,8 +234,8 @@ public:
|
|||||||
virtual
|
virtual
|
||||||
const realx3PointField_D& rAcceleration() const = 0;
|
const realx3PointField_D& rAcceleration() const = 0;
|
||||||
|
|
||||||
virtual
|
/*virtual
|
||||||
const realVector_D& boundingSphere()const = 0;
|
const realVector_D& boundingSphere()const = 0;*/
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
word shapeTypeName()const = 0;
|
word shapeTypeName()const = 0;
|
||||||
|
@ -18,55 +18,42 @@ Licence:
|
|||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
#include "property.hpp"
|
#include "property.hpp"
|
||||||
#include "dictionary.hpp"
|
#include "dictionary.hpp"
|
||||||
|
|
||||||
bool pFlow::property::readDictionary
|
bool pFlow::property::readDictionary()
|
||||||
(
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
materials_ = dict.getVal<wordVector>("materials");
|
materials_ = getVal<wordVector>("materials");
|
||||||
|
|
||||||
densities_ = dict.getVal<realVector>("densities");
|
densities_ = getVal<realVector>("densities");
|
||||||
|
|
||||||
if(materials_.size() != densities_.size() )
|
if(materials_.size() != densities_.size() )
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<
|
fatalErrorInFunction<<
|
||||||
" number of elements in material ("<<materials_.size()<<
|
" number of elements in material ("<<materials_.size()<<
|
||||||
") is not equal to number of elements in densities ("<<densities_.size()<<
|
") is not equal to number of elements in densities ("<<densities_.size()<<
|
||||||
") in dictionary "<< dict.globalName()<<endl;
|
") in dictionary "<< globalName()<<endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!makeNameIndex())
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<
|
|
||||||
" error in dictionary "<< dict.globalName()<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::property::writeDictionary
|
bool pFlow::property::writeDictionary()
|
||||||
(
|
|
||||||
dictionary& dict
|
|
||||||
)const
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!dict.add("materials", materials_))
|
if(!add("materials", materials_))
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<
|
fatalErrorInFunction<<
|
||||||
" error in writing materials to dictionary "<< dict.globalName()<<endl;
|
" error in writing materials to dictionary "<< globalName()<<endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!dict.add("densities", densities_))
|
if(!add("densities", densities_))
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<
|
fatalErrorInFunction<<
|
||||||
" error in writing densities to dictionary "<< dict.globalName()<<endl;
|
" error in writing densities to dictionary "<< globalName()<<endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +65,7 @@ bool pFlow::property::makeNameIndex()
|
|||||||
nameIndex_.clear();
|
nameIndex_.clear();
|
||||||
|
|
||||||
uint32 i=0;
|
uint32 i=0;
|
||||||
for(auto& nm:materials_)
|
for(auto const& nm:materials_)
|
||||||
{
|
{
|
||||||
if(!nameIndex_.insertIf(nm, i++))
|
if(!nameIndex_.insertIf(nm, i++))
|
||||||
{
|
{
|
||||||
@ -88,68 +75,77 @@ bool pFlow::property::makeNameIndex()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
nameIndex_.rehash(0);
|
nameIndex_.rehash(0);
|
||||||
numMaterials_ = materials_.size();
|
numMaterials_ = static_cast<uint32>(materials_.size());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pFlow::property::property
|
pFlow::property::property
|
||||||
(
|
(
|
||||||
|
const word& name,
|
||||||
const wordVector& materials,
|
const wordVector& materials,
|
||||||
const realVector& densities
|
const realVector& densities,
|
||||||
|
repository* owner
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fileDictionary
|
||||||
|
(
|
||||||
|
objectFile
|
||||||
|
(
|
||||||
|
name,
|
||||||
|
"",
|
||||||
|
objectFile::READ_NEVER,
|
||||||
|
objectFile::WRITE_NEVER
|
||||||
|
),
|
||||||
|
owner
|
||||||
|
),
|
||||||
materials_(materials),
|
materials_(materials),
|
||||||
densities_(densities)
|
densities_(densities)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(!writeDictionary())
|
||||||
|
{
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
|
||||||
if(!makeNameIndex())
|
if(!makeNameIndex())
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<
|
fatalErrorInFunction<<
|
||||||
" error in the input parameters of constructor. \n";
|
"error in the input parameters of constructor. \n";
|
||||||
fatalExit;
|
fatalExit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::property::property
|
pFlow::property::property
|
||||||
(
|
(
|
||||||
const fileSystem& file
|
const word& fileName,
|
||||||
|
repository* owner
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
dict_
|
fileDictionary
|
||||||
(
|
(
|
||||||
makeUnique<dictionary>
|
objectFile
|
||||||
("property", true)
|
(
|
||||||
)
|
fileName,
|
||||||
{
|
"",
|
||||||
iFstream dictStream(file);
|
objectFile::READ_ALWAYS,
|
||||||
|
objectFile::WRITE_NEVER
|
||||||
if(!dict_().read(dictStream))
|
),
|
||||||
{
|
owner
|
||||||
ioErrorInFile(dictStream.name(), dictStream.lineNumber());
|
|
||||||
fatalExit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!readDictionary(dict_()))
|
|
||||||
{
|
|
||||||
fatalExit;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pFlow::property::property
|
|
||||||
(
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
dict_
|
|
||||||
(
|
|
||||||
makeUnique<dictionary>(dict)
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!readDictionary(dict_()))
|
if(!readDictionary())
|
||||||
{
|
{
|
||||||
fatalExit;
|
fatalExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!makeNameIndex())
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"error in dictionary "<< globalName()<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ Licence:
|
|||||||
|
|
||||||
#include "Vectors.hpp"
|
#include "Vectors.hpp"
|
||||||
#include "hashMap.hpp"
|
#include "hashMap.hpp"
|
||||||
#include "fileSystem.hpp"
|
#include "fileDictionary.hpp"
|
||||||
#include "iFstream.hpp"
|
#include "iFstream.hpp"
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
@ -38,14 +38,13 @@ class dictionary;
|
|||||||
* used in the simulation: for walls and particles.
|
* used in the simulation: for walls and particles.
|
||||||
*/
|
*/
|
||||||
class property
|
class property
|
||||||
|
:
|
||||||
|
public fileDictionary
|
||||||
{
|
{
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
// - protected data members
|
// - protected data members
|
||||||
|
|
||||||
/// pointer to the dictionary, if it is constructed from a file/dictionary
|
|
||||||
uniquePtr<dictionary> dict_ = nullptr;
|
|
||||||
|
|
||||||
/// list of name of materials
|
/// list of name of materials
|
||||||
wordVector materials_;
|
wordVector materials_;
|
||||||
|
|
||||||
@ -62,10 +61,10 @@ protected:
|
|||||||
// - protected member functions
|
// - protected member functions
|
||||||
|
|
||||||
/// read from dict
|
/// read from dict
|
||||||
bool readDictionary(const dictionary& dict);
|
bool readDictionary();
|
||||||
|
|
||||||
/// write to dict
|
/// write to dict
|
||||||
bool writeDictionary(dictionary& dict)const;
|
bool writeDictionary();
|
||||||
|
|
||||||
/// creates a mapp
|
/// creates a mapp
|
||||||
bool makeNameIndex();
|
bool makeNameIndex();
|
||||||
@ -73,22 +72,19 @@ protected:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/// Type info
|
/// Type info
|
||||||
TypeInfoNV("property");
|
TypeInfo("property");
|
||||||
|
|
||||||
|
|
||||||
// - Constructors
|
// - Constructors
|
||||||
|
|
||||||
/// Emptry constructor, used for reading from a file
|
explicit
|
||||||
property(){}
|
property(
|
||||||
|
const word& fileName,
|
||||||
/// Constructe from materials and densities
|
repository* owner=nullptr);
|
||||||
property(const wordVector& materials, const realVector& densities);
|
|
||||||
|
property(const word& name,
|
||||||
/// Construct from file
|
const wordVector& materials,
|
||||||
property(const fileSystem& file);
|
const realVector& densities,
|
||||||
|
repository* owner=nullptr);
|
||||||
/// Construct from dictionary dict
|
|
||||||
property(const dictionary& dict);
|
|
||||||
|
|
||||||
/// Default copy
|
/// Default copy
|
||||||
property(const property& ) = default;
|
property(const property& ) = default;
|
||||||
@ -103,17 +99,11 @@ public:
|
|||||||
property& operator= (property&&) = default;
|
property& operator= (property&&) = default;
|
||||||
|
|
||||||
/// Default destructor
|
/// Default destructor
|
||||||
~property() = default;
|
~property() override = default;
|
||||||
|
|
||||||
|
|
||||||
// - Methods
|
// - Methods
|
||||||
|
|
||||||
/// Return dictionary
|
|
||||||
inline const auto& dict()const
|
|
||||||
{
|
|
||||||
return dict_();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Return number of materials
|
/// Return number of materials
|
||||||
inline auto numMaterials()const
|
inline auto numMaterials()const
|
||||||
{
|
{
|
||||||
@ -190,20 +180,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//// - IO operatoins
|
|
||||||
|
|
||||||
/// Read from dictionary
|
|
||||||
bool read(const dictionary& dict)
|
|
||||||
{
|
|
||||||
return readDictionary(dict);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Write to dictionary
|
|
||||||
bool write(dictionary& dict)const
|
|
||||||
{
|
|
||||||
return writeDictionary(dict);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,18 +34,6 @@ dictionary/entry/iEntry.cpp
|
|||||||
dictionary/entry/dataEntry.cpp
|
dictionary/entry/dataEntry.cpp
|
||||||
dictionary/twoPartEntry/twoPartEntry.cpp
|
dictionary/twoPartEntry/twoPartEntry.cpp
|
||||||
|
|
||||||
containers/Vector/Vectors.cpp
|
|
||||||
containers/VectorHD/VectorSingles.cpp
|
|
||||||
containers/Field/Fields.cpp
|
|
||||||
containers/List/anyList/anyList.cpp
|
|
||||||
containers/pointField/pointFields.cpp
|
|
||||||
|
|
||||||
#setFieldList/setFieldList.cpp
|
|
||||||
#setFieldList/setFieldEntry.cpp
|
|
||||||
|
|
||||||
Timer/Timer.cpp
|
|
||||||
Timer/Timers.cpp
|
|
||||||
|
|
||||||
repository/IOobject/objectFile.cpp
|
repository/IOobject/objectFile.cpp
|
||||||
repository/IOobject/IOfileHeader.cpp
|
repository/IOobject/IOfileHeader.cpp
|
||||||
repository/IOobject/IOobject.cpp
|
repository/IOobject/IOobject.cpp
|
||||||
@ -62,6 +50,24 @@ eventManagement/observer.cpp
|
|||||||
|
|
||||||
demComponent/demComponent.cpp
|
demComponent/demComponent.cpp
|
||||||
|
|
||||||
|
containers/Vector/Vectors.cpp
|
||||||
|
containers/VectorHD/VectorSingles.cpp
|
||||||
|
containers/Field/Fields.cpp
|
||||||
|
containers/List/anyList/anyList.cpp
|
||||||
|
containers/pointField/pointFields.cpp
|
||||||
|
|
||||||
|
#setFieldList/setFieldList.cpp
|
||||||
|
#setFieldList/setFieldEntry.cpp
|
||||||
|
|
||||||
|
Timer/Timer.cpp
|
||||||
|
Timer/Timers.cpp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
structuredData/box/box.cpp
|
structuredData/box/box.cpp
|
||||||
structuredData/line/line.cpp
|
structuredData/line/line.cpp
|
||||||
structuredData/infinitePlane/infinitePlane.cpp
|
structuredData/infinitePlane/infinitePlane.cpp
|
||||||
@ -73,6 +79,7 @@ structuredData/pointStructure/internalPoints.cpp
|
|||||||
structuredData/pointStructure/pointStructure.cpp
|
structuredData/pointStructure/pointStructure.cpp
|
||||||
structuredData/boundaries/boundaryBase/boundaryBase.cpp
|
structuredData/boundaries/boundaryBase/boundaryBase.cpp
|
||||||
structuredData/boundaries/boundaryExit/boundaryExit.cpp
|
structuredData/boundaries/boundaryExit/boundaryExit.cpp
|
||||||
|
structuredData/boundaries/boundaryNone/boundaryNone.cpp
|
||||||
structuredData/pointStructure/boundaryList.cpp
|
structuredData/pointStructure/boundaryList.cpp
|
||||||
|
|
||||||
commandLine/commandLine.cpp
|
commandLine/commandLine.cpp
|
||||||
|
@ -322,7 +322,7 @@ public:
|
|||||||
{
|
{
|
||||||
return readStdVector(is, vectorField());
|
return readStdVector(is, vectorField());
|
||||||
}
|
}
|
||||||
bool write(iOstream& os)
|
bool write(iOstream& os)const
|
||||||
{
|
{
|
||||||
return writeStdVector(os, vectorField());
|
return writeStdVector(os, vectorField());
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,21 @@ public:
|
|||||||
return field_.hostVector();
|
return field_.hostVector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const FieldType& field()const
|
||||||
|
{
|
||||||
|
return field_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pFlagTypeDevice& activePointsMaskDevice()const
|
||||||
|
{
|
||||||
|
return internalPoints_.activePointsMaskDevice();
|
||||||
|
}
|
||||||
|
|
||||||
|
const pFlagTypeHost& activePointsMaskHost()const
|
||||||
|
{
|
||||||
|
return internalPoints_.activePointsMaskHost();
|
||||||
|
}
|
||||||
|
|
||||||
FieldTypeHost activeValuesHost()const;
|
FieldTypeHost activeValuesHost()const;
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -41,9 +41,32 @@ pFlow::pointField<T, MemorySpace>::pointField
|
|||||||
boundaryFieldList_(pStruct.boundaries(), *this),
|
boundaryFieldList_(pStruct.boundaries(), *this),
|
||||||
pStruct_(pStruct),
|
pStruct_(pStruct),
|
||||||
defaultValue_(defVal)
|
defaultValue_(defVal)
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
template<class T, class MemorySpace>
|
||||||
|
pFlow::pointField<T, MemorySpace>::pointField
|
||||||
|
(
|
||||||
|
const objectFile& objf,
|
||||||
|
repository* owner,
|
||||||
|
pointStructure& pStruct,
|
||||||
|
const T& defVal
|
||||||
|
)
|
||||||
|
:
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
objf,
|
||||||
|
pStruct.ioPattern(),
|
||||||
|
owner
|
||||||
|
),
|
||||||
|
InternalFieldType
|
||||||
|
(
|
||||||
|
objf.name(),
|
||||||
|
pStruct
|
||||||
|
),
|
||||||
|
boundaryFieldList_(pStruct.boundaries(), *this),
|
||||||
|
pStruct_(pStruct),
|
||||||
|
defaultValue_(defVal)
|
||||||
|
{}
|
||||||
|
|
||||||
template<class T, class MemorySpace>
|
template<class T, class MemorySpace>
|
||||||
pFlow::pointField<T, MemorySpace>::pointField
|
pFlow::pointField<T, MemorySpace>::pointField
|
||||||
|
@ -81,6 +81,12 @@ public:
|
|||||||
pointStructure& pStruct,
|
pointStructure& pStruct,
|
||||||
const T& defVal);
|
const T& defVal);
|
||||||
|
|
||||||
|
pointField(
|
||||||
|
const objectFile& objf,
|
||||||
|
repository* owner,
|
||||||
|
pointStructure& pStruct,
|
||||||
|
const T& defVal);
|
||||||
|
|
||||||
pointField(
|
pointField(
|
||||||
const objectFile& objf,
|
const objectFile& objf,
|
||||||
pointStructure& pStruct,
|
pointStructure& pStruct,
|
||||||
|
@ -36,57 +36,39 @@ template<typename T>
|
|||||||
using pointField_D = pointField<T>;
|
using pointField_D = pointField<T>;
|
||||||
|
|
||||||
|
|
||||||
using int8PointField_D = pointField<int8>;
|
using int8PointField_D = pointField_D<int8>;
|
||||||
|
using int8PointField_H = pointField_H<int8>;
|
||||||
|
|
||||||
using int8PointField_H = pointField<int8, HostSpace>;
|
using uint8PointField_D = pointField_D<uint8>;
|
||||||
|
using uint8PointField_H = pointField_H<uint8>;
|
||||||
|
|
||||||
using realPointField_D = pointField<real>;
|
using int32PointField_D = pointField_D<int32>;
|
||||||
|
using int32PointField_H = pointField_H<int32>;
|
||||||
|
|
||||||
using realPointField_H = pointField<real, HostSpace>;
|
using uint32PointField_D = pointField_D<uint32>;
|
||||||
|
using uint32PointField_H = pointField_H<uint32>;
|
||||||
|
|
||||||
//using int32PointField_D = pointField<VectorSingle, int32>;
|
using int64PointField_D = pointField_D<int64>;
|
||||||
|
using int63PointField_H = pointField_H<int64>;
|
||||||
|
|
||||||
/*using int32PointField_H = pointField<VectorSingle, int32, HostSpace>;
|
using uint64PointField_D = pointField_D<uint64>;
|
||||||
|
using uint64PointField_H = pointField_H<uint64>;
|
||||||
|
|
||||||
using int64PointField_D = pointField<VectorSingle, int64>;
|
using int32PointField_D = pointField_D<int32>;
|
||||||
|
using int32PointField_H = pointField_H<int32>;
|
||||||
|
|
||||||
using int64PointField_H = pointField<VectorSingle, int64, HostSpace>;
|
using realPointField_D = pointField_D<real>;
|
||||||
|
using realPointField_H = pointField_H<real>;
|
||||||
|
|
||||||
using uint32PointField_D = pointField<VectorSingle, uint32>;
|
using realx3PointField_D = pointField_D<realx3>;
|
||||||
|
using realx3PointField_H = pointField_H<realx3>;
|
||||||
|
|
||||||
using uint32PointField_H = pointField<VectorSingle, uint32, HostSpace>;
|
using realx4PointField_D = pointField_D<realx4>;
|
||||||
|
using realx4PointField_H = pointField_H<realx4>;
|
||||||
|
|
||||||
using labelPointField_D = pointField<VectorSingle, label>;
|
|
||||||
|
|
||||||
using labelPointField_H = pointField<VectorSingle, label, HostSpace>;
|
|
||||||
|
|
||||||
using realPointField_D = pointField<VectorSingle, real>;
|
|
||||||
|
|
||||||
using realPointField_H = pointField<VectorSingle, real, HostSpace>;
|
|
||||||
|
|
||||||
using realx3PointField_D = pointField<VectorSingle, realx3> ;
|
|
||||||
|
|
||||||
using realx3PointField_H = pointField<VectorSingle, realx3, HostSpace>;
|
|
||||||
|
|
||||||
using wordPointField_H = pointField<VectorSingle, word, HostSpace>;
|
|
||||||
|
|
||||||
using int8PointField_HD = pointField<VectorDual, int8>;
|
|
||||||
|
|
||||||
using int16PointField_HD = pointField<VectorDual, int16>;
|
|
||||||
|
|
||||||
using int32PointField_HD = pointField<VectorDual, int32>;
|
|
||||||
|
|
||||||
using int64PointField_HD = pointField<VectorDual, int64>;
|
|
||||||
|
|
||||||
using uint32PointField_HD = pointField<VectorDual, uint32>;
|
|
||||||
|
|
||||||
using labelPointField_HD = pointField<VectorDual, label>;
|
|
||||||
|
|
||||||
using realPointField_HD = pointField<VectorDual, real>;
|
|
||||||
|
|
||||||
using realx3PointField_HD = pointField<VectorDual, realx3>;
|
|
||||||
|
|
||||||
using wordPointField = pointField<Vector, word, vecAllocator<word>>;*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ pFlow::fileDictionary::fileDictionary
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
of,
|
of,
|
||||||
IOPattern::IOPattern::AllProcessorsSimilar,
|
IOPattern::AllProcessorsSimilar,
|
||||||
owner
|
owner
|
||||||
),
|
),
|
||||||
dictionary
|
dictionary
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
// standard input and output streams
|
// standard input and output streams
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
IOType ioType_;
|
IOType ioType_;
|
||||||
|
|
||||||
@ -72,12 +72,16 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
IOPattern( IOType iotype);
|
IOPattern( IOPattern::IOType iotype);
|
||||||
|
|
||||||
IOPattern(const IOPattern&)=default;
|
IOPattern(const IOPattern&)=default;
|
||||||
|
|
||||||
|
IOPattern(IOPattern&&) = default;
|
||||||
|
|
||||||
IOPattern& operator=(const IOPattern&)=default;
|
IOPattern& operator=(const IOPattern&)=default;
|
||||||
|
|
||||||
|
IOPattern& operator=(IOPattern&&)=default;
|
||||||
|
|
||||||
~IOPattern() = default;
|
~IOPattern() = default;
|
||||||
|
|
||||||
inline
|
inline
|
||||||
@ -123,6 +127,13 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool thisCallWrite()const
|
||||||
|
{
|
||||||
|
if(isMasterProcessorOnly()&& !isMaster())return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
bool thisProcReadData()const
|
bool thisProcReadData()const
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ pFlow::uniquePtr<pFlow::oFstream> pFlow::IOfileHeader::outStream()const
|
|||||||
if(osPtr && owner())
|
if(osPtr && owner())
|
||||||
{
|
{
|
||||||
auto outPrecision = owner()->outFilePrecision();
|
auto outPrecision = owner()->outFilePrecision();
|
||||||
osPtr->precision(outPrecision);
|
osPtr->precision(static_cast<int>(outPrecision));
|
||||||
}
|
}
|
||||||
|
|
||||||
return osPtr;
|
return osPtr;
|
||||||
@ -62,7 +62,7 @@ pFlow::fileSystem pFlow::IOfileHeader::path() const
|
|||||||
{
|
{
|
||||||
f = localPath();
|
f = localPath();
|
||||||
}
|
}
|
||||||
f += name_;
|
f += name();
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,11 +146,8 @@ bool pFlow::IOfileHeader::writeHeader
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!forceWrite)
|
if(!forceWrite && !writeHeader()) return true;
|
||||||
{
|
|
||||||
if(!writeHeader()) return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
writeBanner(os);
|
writeBanner(os);
|
||||||
|
|
||||||
os.writeWordEntry("objectType", typeName );
|
os.writeWordEntry("objectType", typeName );
|
||||||
|
@ -64,60 +64,56 @@ pFlow::repository* pFlow::IOobject::releaseOwner
|
|||||||
|
|
||||||
bool pFlow::IOobject::readObject(bool rdHdr)
|
bool pFlow::IOobject::readObject(bool rdHdr)
|
||||||
{
|
{
|
||||||
|
if(!implyRead())return true;
|
||||||
if( implyRead() )
|
|
||||||
{
|
|
||||||
if( rdHdr & ioPattern().thisCallRead())
|
|
||||||
{
|
|
||||||
if( auto ptrIS = inStream(); ptrIS )
|
|
||||||
{
|
|
||||||
if(!readHeader(ptrIS()))return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
warningInFunction<<
|
|
||||||
"could not open file " << path() <<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ioPattern().thisCallRead())
|
|
||||||
{
|
|
||||||
if( auto ptrIS = inStream(); ptrIS )
|
|
||||||
{
|
|
||||||
if(!readObject(ptrIS(), rdHdr))return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
warningInFunction<<
|
|
||||||
"could not open file " << path() <<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if( rdHdr && ioPattern().thisCallRead())
|
||||||
|
{
|
||||||
|
if( auto ptrIS = inStream(); ptrIS )
|
||||||
|
{
|
||||||
|
if(!readHeader(ptrIS()))return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
warningInFunction<<
|
||||||
|
"could not open file " << path() <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ioPattern().thisCallRead())
|
||||||
|
{
|
||||||
|
if( auto ptrIS = inStream(); ptrIS )
|
||||||
|
{
|
||||||
|
if(!readObject(ptrIS(), rdHdr))return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
warningInFunction<<
|
||||||
|
"could not open file " << path() <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool pFlow::IOobject::writeObject() const
|
bool pFlow::IOobject::writeObject() const
|
||||||
{
|
{
|
||||||
if(implyWrite())
|
if(implyWrite()&& ioPattern().thisCallWrite())
|
||||||
{
|
{
|
||||||
if(ioPattern().thisProcWriteData())
|
|
||||||
|
if(auto ptrOS = outStream(); ptrOS )
|
||||||
{
|
{
|
||||||
if(auto ptrOS = outStream(); ptrOS )
|
return writeObject(ptrOS());
|
||||||
{
|
|
||||||
return writeObject(ptrOS());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
warningInFunction<<
|
|
||||||
"error in opening file "<< path() <<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
warningInFunction<<
|
||||||
|
"error in opening file "<< path() <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -126,11 +122,10 @@ bool pFlow::IOobject::writeObject() const
|
|||||||
|
|
||||||
bool pFlow::IOobject::readObject(iIstream& is, bool rdHdr)
|
bool pFlow::IOobject::readObject(iIstream& is, bool rdHdr)
|
||||||
{
|
{
|
||||||
if(rdHdr && ioPattern().thisCallRead() )
|
if(rdHdr &&
|
||||||
{
|
ioPattern().thisCallRead() &&
|
||||||
if(!readHeader(is))return false;
|
!readHeader(is)) return false;
|
||||||
}
|
|
||||||
|
|
||||||
if(ioPattern().thisCallRead())
|
if(ioPattern().thisCallRead())
|
||||||
{
|
{
|
||||||
return read(is, ioPattern());
|
return read(is, ioPattern());
|
||||||
@ -148,11 +143,9 @@ bool pFlow::IOobject::writeObject(iOstream& os) const
|
|||||||
if(this->writeHeader() && ioPattern().thisProcWriteHeader())
|
if(this->writeHeader() && ioPattern().thisProcWriteHeader())
|
||||||
writeHeader(os, typeName());
|
writeHeader(os, typeName());
|
||||||
|
|
||||||
if(ioPattern().thisProcWriteData())
|
if(ioPattern().thisCallWrite())
|
||||||
{ //return (object_->write_object_t(os, ioPattern_) && writeSeparator(os));
|
{
|
||||||
notImplementedFunction;
|
return write(os, ioPattern() );
|
||||||
//return object_->read_object_t(is, ioPattern_);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
|
@ -36,7 +36,7 @@ class IOobject
|
|||||||
:
|
:
|
||||||
public IOfileHeader
|
public IOfileHeader
|
||||||
{
|
{
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
IOPattern ioPattern_;
|
IOPattern ioPattern_;
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ public:
|
|||||||
const IOPattern& iop,
|
const IOPattern& iop,
|
||||||
repository* owner);
|
repository* owner);
|
||||||
|
|
||||||
~IOobject();
|
~IOobject() override;
|
||||||
|
|
||||||
// - copy construct
|
// - copy construct
|
||||||
IOobject(const IOobject& src)=delete;
|
IOobject(const IOobject& src)=delete;
|
||||||
|
@ -45,16 +45,16 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
/// Name of the entity
|
/// Name of the entity
|
||||||
word name_;
|
word name_;
|
||||||
|
|
||||||
/// Read flag
|
/// Read flag
|
||||||
readFlag rFlag_ = READ_NEVER;
|
readFlag rFlag_ = readFlag::READ_NEVER;
|
||||||
|
|
||||||
/// Write flag
|
/// Write flag
|
||||||
writeFlag wFlag_ = WRITE_NEVER;
|
writeFlag wFlag_ = writeFlag::WRITE_NEVER;
|
||||||
|
|
||||||
/// Local path of entity
|
/// Local path of entity
|
||||||
fileSystem localPath_ = "";
|
fileSystem localPath_ = "";
|
||||||
@ -70,7 +70,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// constructors
|
// constructors
|
||||||
objectFile
|
explicit objectFile
|
||||||
(
|
(
|
||||||
const word& name
|
const word& name
|
||||||
);
|
);
|
||||||
@ -80,8 +80,8 @@ public:
|
|||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const fileSystem& localPath,
|
const fileSystem& localPath,
|
||||||
const readFlag& rf = READ_NEVER,
|
const readFlag& rf = readFlag::READ_NEVER,
|
||||||
const writeFlag& wf = WRITE_NEVER,
|
const writeFlag& wf = writeFlag::WRITE_NEVER,
|
||||||
bool rwHeader = true
|
bool rwHeader = true
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -122,31 +122,31 @@ public:
|
|||||||
inline
|
inline
|
||||||
bool isReadAlways()const
|
bool isReadAlways()const
|
||||||
{
|
{
|
||||||
return rFlag_ == READ_ALWAYS;
|
return rFlag_ == readFlag::READ_ALWAYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
bool isReadNever()const
|
bool isReadNever()const
|
||||||
{
|
{
|
||||||
return rFlag_ == READ_NEVER;
|
return rFlag_ == readFlag::READ_NEVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
bool isReadIfPresent()const
|
bool isReadIfPresent()const
|
||||||
{
|
{
|
||||||
return rFlag_ == READ_IF_PRESENT;
|
return rFlag_ == readFlag::READ_IF_PRESENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
bool isWriteAlways()const
|
bool isWriteAlways()const
|
||||||
{
|
{
|
||||||
return wFlag_ == WRITE_ALWAYS;
|
return wFlag_ == writeFlag::WRITE_ALWAYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
bool isWriteNever()const
|
bool isWriteNever()const
|
||||||
{
|
{
|
||||||
return wFlag_ == WRITE_NEVER;
|
return wFlag_ == writeFlag::WRITE_NEVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -55,12 +55,6 @@ pFlow::Time::Time
|
|||||||
geometryRepository_,
|
geometryRepository_,
|
||||||
geometryFolder__,
|
geometryFolder__,
|
||||||
this
|
this
|
||||||
),
|
|
||||||
integration_
|
|
||||||
(
|
|
||||||
integrationRepository__,
|
|
||||||
integrationFolder__,
|
|
||||||
this
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -90,12 +84,6 @@ pFlow::Time::Time(
|
|||||||
geometryRepository_,
|
geometryRepository_,
|
||||||
geometryFolder__,
|
geometryFolder__,
|
||||||
this
|
this
|
||||||
),
|
|
||||||
integration_
|
|
||||||
(
|
|
||||||
integrationRepository__,
|
|
||||||
integrationFolder__,
|
|
||||||
this
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if(!readDictionary(setiingsDict))
|
if(!readDictionary(setiingsDict))
|
||||||
@ -109,6 +97,11 @@ pFlow::fileSystem pFlow::Time::localPath()const
|
|||||||
return fileSystem(timeName());
|
return fileSystem(timeName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pFlow::fileSystem pFlow::Time::integrationFolder() const
|
||||||
|
{
|
||||||
|
return integrationFolder__;
|
||||||
|
}
|
||||||
|
|
||||||
bool pFlow::Time::write
|
bool pFlow::Time::write
|
||||||
(
|
(
|
||||||
bool verbose
|
bool verbose
|
||||||
|
@ -28,7 +28,7 @@ Licence:
|
|||||||
|
|
||||||
#include "timeControl.hpp"
|
#include "timeControl.hpp"
|
||||||
#include "repository.hpp"
|
#include "repository.hpp"
|
||||||
|
#include "fileSystem.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
@ -49,10 +49,6 @@ protected:
|
|||||||
// - geometry folder/repository
|
// - geometry folder/repository
|
||||||
repository geometry_;
|
repository geometry_;
|
||||||
|
|
||||||
// - integration folder/repository
|
|
||||||
repository integration_;
|
|
||||||
|
|
||||||
|
|
||||||
bool readDictionary(const dictionary& dict);
|
bool readDictionary(const dictionary& dict);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -84,15 +80,7 @@ public:
|
|||||||
return geometry_;
|
return geometry_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const repository& integration()const
|
fileSystem integrationFolder()const;
|
||||||
{
|
|
||||||
return integration_;
|
|
||||||
}
|
|
||||||
|
|
||||||
repository& integration()
|
|
||||||
{
|
|
||||||
return integration_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Write to the file with binary format?
|
/// Write to the file with binary format?
|
||||||
bool outFileBinary()const override
|
bool outFileBinary()const override
|
||||||
|
@ -18,7 +18,6 @@ Licence:
|
|||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __uniquePtr_hpp__
|
#ifndef __uniquePtr_hpp__
|
||||||
#define __uniquePtr_hpp__
|
#define __uniquePtr_hpp__
|
||||||
|
|
||||||
@ -47,7 +46,7 @@ class uniquePtr
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef std::unique_ptr<T,Deleter> uniquePtrType;
|
using uniquePtrType = std::unique_ptr<T, Deleter>;
|
||||||
|
|
||||||
// using base constructors
|
// using base constructors
|
||||||
using uniquePtrType::unique_ptr;
|
using uniquePtrType::unique_ptr;
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
/*------------------------------- 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 "boundaryNone.hpp"
|
||||||
|
|
||||||
|
pFlow::boundaryNone::boundaryNone
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const plane& bplane,
|
||||||
|
internalPoints& internal
|
||||||
|
)
|
||||||
|
:
|
||||||
|
boundaryBase(dict, bplane, internal)
|
||||||
|
{}
|
||||||
|
|
||||||
|
bool pFlow::boundaryNone::beforeIteratoin
|
||||||
|
(
|
||||||
|
uint32 iterNum,
|
||||||
|
real t
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::boundaryNone::iterate
|
||||||
|
(
|
||||||
|
uint32 iterNum,
|
||||||
|
real t
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::boundaryNone::afterIteration
|
||||||
|
(
|
||||||
|
uint32 iterNum,
|
||||||
|
real t
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
/*------------------------------- 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 __boundaryNone_hpp__
|
||||||
|
#define __boundaryNone_hpp__
|
||||||
|
|
||||||
|
|
||||||
|
#include "boundaryBase.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
class boundaryNone
|
||||||
|
:
|
||||||
|
public boundaryBase
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
TypeInfo("boundary<none>");
|
||||||
|
|
||||||
|
boundaryNone(
|
||||||
|
const dictionary& dict,
|
||||||
|
const plane& bplane,
|
||||||
|
internalPoints& internal);
|
||||||
|
|
||||||
|
~boundaryNone() override= default;
|
||||||
|
|
||||||
|
add_vCtor
|
||||||
|
(
|
||||||
|
boundaryBase,
|
||||||
|
boundaryNone,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
|
||||||
|
bool beforeIteratoin(uint32 iterNum, real t) override;
|
||||||
|
|
||||||
|
bool iterate(uint32 iterNum, real t) override;
|
||||||
|
|
||||||
|
bool afterIteration(uint32 iterNum, real t) override;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -39,6 +39,11 @@ public:
|
|||||||
|
|
||||||
uint32 initialNumberInThis()const override;
|
uint32 initialNumberInThis()const override;
|
||||||
|
|
||||||
|
bool initialThisDomainActive()const override
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*bool updateDomains(
|
/*bool updateDomains(
|
||||||
span<realx3> pointPos,
|
span<realx3> pointPos,
|
||||||
pFlagTypeHost flags) override;*/
|
pFlagTypeHost flags) override;*/
|
||||||
|
@ -97,6 +97,9 @@ public:
|
|||||||
virtual
|
virtual
|
||||||
uint32 initialNumberInThis()const = 0;
|
uint32 initialNumberInThis()const = 0;
|
||||||
|
|
||||||
|
virtual
|
||||||
|
bool initialThisDomainActive()const = 0;
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
bool initialTransferBlockData(
|
bool initialTransferBlockData(
|
||||||
span<char> src,
|
span<char> src,
|
||||||
|
@ -172,7 +172,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
bool operator()(uint32 i)
|
bool operator()(uint32 i)const
|
||||||
{
|
{
|
||||||
return isActive(i);
|
return isActive(i);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
readFromTimeFolder(repository& rep);
|
explicit readFromTimeFolder(repository& rep);
|
||||||
|
|
||||||
auto path()const
|
auto path()const
|
||||||
{
|
{
|
||||||
@ -65,9 +65,9 @@ public:
|
|||||||
bool pointFieldGetType(word& typeName)const
|
bool pointFieldGetType(word& typeName)const
|
||||||
{
|
{
|
||||||
word fieldTYPENAME = pointField_H<T>::TYPENAME();
|
word fieldTYPENAME = pointField_H<T>::TYPENAME();
|
||||||
word fldType{}, space{};
|
word fldType{};
|
||||||
|
|
||||||
if( !pFlow::utilities::pointFieldGetType(
|
if(word space{}; !pFlow::utilities::pointFieldGetType(
|
||||||
fieldTYPENAME, fldType, space) )
|
fieldTYPENAME, fldType, space) )
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<
|
fatalErrorInFunction<<
|
||||||
@ -81,18 +81,19 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool pointFieldGetCheckType(word fieldName, word& typeName) const
|
bool pointFieldGetCheckType(word const& fieldName, word& typeName) const
|
||||||
{
|
{
|
||||||
|
|
||||||
word fieldTYPENAME = pointField_H<T>::TYPENAME();
|
word fieldTYPENAME = pointField_H<T>::TYPENAME();
|
||||||
word flType{},fldType{};
|
|
||||||
|
word flType{};
|
||||||
if(!pointFieldFileGetType( fieldName, flType))
|
if(!pointFieldFileGetType( fieldName, flType))
|
||||||
{
|
{
|
||||||
fatalExit;
|
fatalExit;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
word fldType{};
|
||||||
if( !pointFieldGetType<T>(fldType) )
|
if( !pointFieldGetType<T>(fldType) )
|
||||||
{
|
{
|
||||||
fatalExit;
|
fatalExit;
|
||||||
@ -112,7 +113,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
pointField_H<T>& createUniformPointField_H(word name, T value)
|
uniquePtr<pointField_H<T>> createUniformPointField_H(word const& name, T value)
|
||||||
{
|
{
|
||||||
if( !checkForPointStructure() )
|
if( !checkForPointStructure() )
|
||||||
{
|
{
|
||||||
@ -120,29 +121,28 @@ public:
|
|||||||
"cannot find " << pointStructureFile__ << " in repository "<< repository_.name()<<endl;
|
"cannot find " << pointStructureFile__ << " in repository "<< repository_.name()<<endl;
|
||||||
fatalExit;
|
fatalExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& pStruct = repository_.lookupObject<pointStructure>(pointStructureFile__);
|
auto& pStruct = repository_.lookupObject<pointStructure>(pointStructureFile__);
|
||||||
|
|
||||||
word fType;
|
|
||||||
pointFieldGetType<T>(fType);
|
|
||||||
word newName = name + fType;
|
|
||||||
|
|
||||||
auto& field = repository_.emplaceReplaceObject<pointField_H<T>>(
|
auto Ptr = makeUnique<pointField_H<T>>
|
||||||
objectFile(
|
(
|
||||||
|
objectFile
|
||||||
|
(
|
||||||
name,
|
name,
|
||||||
"",
|
"",
|
||||||
objectFile::READ_NEVER,
|
objectFile::READ_NEVER,
|
||||||
objectFile::WRITE_NEVER
|
objectFile::WRITE_NEVER
|
||||||
),
|
),
|
||||||
pStruct,
|
pStruct,
|
||||||
|
T{},
|
||||||
value
|
value
|
||||||
);
|
);
|
||||||
|
return Ptr;
|
||||||
return field;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
pointField_H<T>& readPointField_H(word name)
|
uniquePtr<pointField_H<T>> readPointField_H(word const& name)
|
||||||
{
|
{
|
||||||
if( !checkForPointStructure() )
|
if( !checkForPointStructure() )
|
||||||
{
|
{
|
||||||
@ -152,23 +152,25 @@ public:
|
|||||||
}
|
}
|
||||||
auto& pStruct = repository_.lookupObject<pointStructure>(pointStructureFile__);
|
auto& pStruct = repository_.lookupObject<pointStructure>(pointStructureFile__);
|
||||||
|
|
||||||
auto& field = repository_.emplaceObjectOrGet<pointField_H<T>>(
|
auto Ptr = makeUnique<pointField_H<T>>
|
||||||
objectFile(
|
(
|
||||||
|
objectFile
|
||||||
|
(
|
||||||
name,
|
name,
|
||||||
"",
|
"",
|
||||||
objectFile::READ_IF_PRESENT,
|
objectFile::READ_IF_PRESENT,
|
||||||
objectFile::WRITE_ALWAYS
|
objectFile::WRITE_ALWAYS
|
||||||
),
|
),
|
||||||
pStruct,
|
pStruct,
|
||||||
T{}
|
T{}
|
||||||
);
|
);
|
||||||
|
|
||||||
return field;
|
return Ptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
pointField_D<T>& readPointField_D(word name)
|
uniquePtr<pointField_D<T>> readPointField_D(word const& name)
|
||||||
{
|
{
|
||||||
if( !checkForPointStructure() )
|
if( !checkForPointStructure() )
|
||||||
{
|
{
|
||||||
@ -178,18 +180,20 @@ public:
|
|||||||
}
|
}
|
||||||
auto& pStruct = repository_.lookupObject<pointStructure>(pointStructureFile__);
|
auto& pStruct = repository_.lookupObject<pointStructure>(pointStructureFile__);
|
||||||
|
|
||||||
auto& field = repository_.emplaceObjectOrGet<pointField_H<T>>(
|
auto Ptr = makeUnique<pointField_D<T>>
|
||||||
objectFile(
|
(
|
||||||
|
objectFile
|
||||||
|
(
|
||||||
name,
|
name,
|
||||||
"",
|
"",
|
||||||
objectFile::READ_IF_PRESENT,
|
objectFile::READ_IF_PRESENT,
|
||||||
objectFile::WRITE_ALWAYS
|
objectFile::WRITE_ALWAYS
|
||||||
),
|
),
|
||||||
pStruct,
|
pStruct,
|
||||||
T{}
|
T{}
|
||||||
);
|
);
|
||||||
|
|
||||||
return field;
|
return Ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -72,21 +72,10 @@ int main( int argc, char* argv[] )
|
|||||||
// this should be palced in each main
|
// this should be palced in each main
|
||||||
#include "initialize_Control.hpp"
|
#include "initialize_Control.hpp"
|
||||||
|
|
||||||
auto objCPDict = IOobject::make<fileDictionary>
|
fileDictionary cpDict("particlesDict", Control.settings().path());
|
||||||
(
|
|
||||||
objectFile
|
|
||||||
(
|
|
||||||
"particlesDict",
|
|
||||||
Control.settings().path(),
|
|
||||||
objectFile::READ_ALWAYS,
|
|
||||||
objectFile::WRITE_ALWAYS
|
|
||||||
),
|
|
||||||
"particlesDict"
|
|
||||||
);
|
|
||||||
|
|
||||||
auto& cpDict = objCPDict().getObject<fileDictionary>();
|
uniquePtr<pointStructure> pStructPtr = nullptr;
|
||||||
|
|
||||||
pointStructure* pStructPtr = nullptr;
|
|
||||||
|
|
||||||
|
|
||||||
if(!setOnly)
|
if(!setOnly)
|
||||||
@ -100,24 +89,11 @@ int main( int argc, char* argv[] )
|
|||||||
|
|
||||||
auto finalPos = pointPosition().getFinalPosition();
|
auto finalPos = pointPosition().getFinalPosition();
|
||||||
|
|
||||||
|
pStructPtr = makeUnique<pointStructure>(Control, finalPos);
|
||||||
auto& pStruct = Control.time().emplaceObject<pointStructure>
|
|
||||||
(
|
|
||||||
objectFile
|
|
||||||
(
|
|
||||||
pointStructureFile__,
|
|
||||||
Control.time().path(),
|
|
||||||
objectFile::READ_NEVER,
|
|
||||||
objectFile::WRITE_ALWAYS
|
|
||||||
),
|
|
||||||
Control,
|
|
||||||
finalPos
|
|
||||||
);
|
|
||||||
|
|
||||||
pStructPtr = &pStruct;
|
|
||||||
|
|
||||||
REPORT(1)<< "Created pStruct with "<< pStruct.size() << " points and capacity "<<
|
REPORT(1)<< "Created pStruct with "<< pStructPtr().size() << " points and capacity "<<
|
||||||
pStruct.capacity()<<" . . ."<< END_REPORT;
|
pStructPtr().capacity()<<" . . ."<< END_REPORT;
|
||||||
|
|
||||||
//REPORT(1)<< "Writing pStruct to " << Control.time().path()+ pointStructureFile__<< END_REPORT<<endl<<endl;
|
//REPORT(1)<< "Writing pStruct to " << Control.time().path()+ pointStructureFile__<< END_REPORT<<endl<<endl;
|
||||||
|
|
||||||
@ -130,20 +106,8 @@ int main( int argc, char* argv[] )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// read the content of pStruct from 0/pStructure
|
||||||
auto& pStruct = Control.time().emplaceObject<pointStructure>
|
pStructPtr = makeUnique<pointStructure>(Control);
|
||||||
(
|
|
||||||
objectFile
|
|
||||||
(
|
|
||||||
pointStructureFile__,
|
|
||||||
Control.time().path(),
|
|
||||||
objectFile::READ_NEVER,
|
|
||||||
objectFile::WRITE_ALWAYS
|
|
||||||
),
|
|
||||||
Control
|
|
||||||
);
|
|
||||||
|
|
||||||
pStructPtr = &pStruct;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ Licence:
|
|||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "positionParticles.hpp"
|
#include "positionParticles.hpp"
|
||||||
|
#include "vocabs.hpp"
|
||||||
#include "box.hpp"
|
#include "box.hpp"
|
||||||
#include "cylinder.hpp"
|
#include "cylinder.hpp"
|
||||||
#include "sphere.hpp"
|
#include "sphere.hpp"
|
||||||
@ -101,7 +102,18 @@ pFlow::positionParticles::positionParticles
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
region_ = makeUnique<region<box>>( control.domainDict().subDict("globalBox"));
|
fileDictionary domainDict
|
||||||
|
(
|
||||||
|
objectFile
|
||||||
|
{
|
||||||
|
domainFile__,
|
||||||
|
"",
|
||||||
|
objectFile::READ_ALWAYS,
|
||||||
|
objectFile::WRITE_NEVER
|
||||||
|
},
|
||||||
|
&control.settings()
|
||||||
|
);
|
||||||
|
region_ = makeUnique<region<box>>( domainDict.subDict("globalBox"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user