modifications for version (1.0)
This commit is contained in:
parent
6b3a4f017b
commit
8beaec448a
|
@ -9,11 +9,7 @@ add_subdirectory(Particles)
|
||||||
|
|
||||||
add_subdirectory(Geometry)
|
add_subdirectory(Geometry)
|
||||||
|
|
||||||
#add_subdirectory(Interaction)
|
add_subdirectory(Interaction)
|
||||||
|
|
||||||
add_subdirectory(MotionModel)
|
add_subdirectory(MotionModel)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#add_subdirectory(MPIParallelization)
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ public:
|
||||||
realx3 transferPoint(const realx3& p, real dt)const
|
realx3 transferPoint(const realx3& p, real dt)const
|
||||||
{
|
{
|
||||||
if(!inTimeRange()) return p;
|
if(!inTimeRange()) return p;
|
||||||
return p + 0.5*dt*(velocity0_+velocity_);
|
return p + static_cast<real>(0.5*dt)*(velocity0_+velocity_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - IO operation
|
// - IO operation
|
||||||
|
|
|
@ -166,7 +166,7 @@ pFlow::real pFlow::sphereShape::Inertia(uint32 index) const
|
||||||
|
|
||||||
pFlow::realVector pFlow::sphereShape::Inertia() const
|
pFlow::realVector pFlow::sphereShape::Inertia() const
|
||||||
{
|
{
|
||||||
return realVector("I", 0.4*mass()*pow(0.5*diameters_,(real)2.0));
|
return realVector("I", (real)0.4*mass()*pow((real)0.5*diameters_,(real)2.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::sphereShape::Inertia_xx(uint32 index, real &Ixx) const
|
bool pFlow::sphereShape::Inertia_xx(uint32 index, real &Ixx) const
|
||||||
|
|
|
@ -64,15 +64,17 @@ bool pFlow::property::makeNameIndex()
|
||||||
{
|
{
|
||||||
nameIndex_.clear();
|
nameIndex_.clear();
|
||||||
|
|
||||||
|
|
||||||
uint32 i=0;
|
uint32 i=0;
|
||||||
for(auto const& nm:materials_)
|
for(auto const& nm:materials_)
|
||||||
{
|
{
|
||||||
if(!nameIndex_.insertIf(nm, i++))
|
if(!nameIndex_.insertIf(nm, i))
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<
|
fatalErrorInFunction<<
|
||||||
" repeated material name in the list of materials: " << materials_;
|
" repeated material name in the list of materials: " << materials_;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
nameIndex_.rehash(0);
|
nameIndex_.rehash(0);
|
||||||
numMaterials_ = static_cast<uint32>(materials_.size());
|
numMaterials_ = static_cast<uint32>(materials_.size());
|
||||||
|
@ -149,3 +151,33 @@ pFlow::property::property
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pFlow::property::property
|
||||||
|
(
|
||||||
|
const word &fileName,
|
||||||
|
const fileSystem &dir
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fileDictionary
|
||||||
|
(
|
||||||
|
objectFile
|
||||||
|
(
|
||||||
|
fileName,
|
||||||
|
dir,
|
||||||
|
objectFile::READ_ALWAYS,
|
||||||
|
objectFile::WRITE_NEVER
|
||||||
|
),
|
||||||
|
nullptr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if(!readDictionary())
|
||||||
|
{
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!makeNameIndex())
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"error in dictionary "<< globalName()<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ Licence:
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* property holds the pure properties of materials.
|
* property holds the pure properties of materials.
|
||||||
*
|
*
|
||||||
|
@ -52,6 +51,7 @@ private:
|
||||||
/// rapid mapping from name to index
|
/// rapid mapping from name to index
|
||||||
wordHashMap<uint32> nameIndex_;
|
wordHashMap<uint32> nameIndex_;
|
||||||
|
|
||||||
|
|
||||||
/// number of materials
|
/// number of materials
|
||||||
uint32 numMaterials_ = 0;
|
uint32 numMaterials_ = 0;
|
||||||
|
|
||||||
|
@ -79,6 +79,11 @@ public:
|
||||||
const word& fileName,
|
const word& fileName,
|
||||||
repository* owner=nullptr);
|
repository* owner=nullptr);
|
||||||
|
|
||||||
|
property(
|
||||||
|
const word& fileName,
|
||||||
|
const fileSystem& dir
|
||||||
|
);
|
||||||
|
|
||||||
property(const word& fileName,
|
property(const word& fileName,
|
||||||
const wordVector& materials,
|
const wordVector& materials,
|
||||||
const realVector& densities,
|
const realVector& densities,
|
||||||
|
@ -178,6 +183,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ demComponent/demComponent.cpp
|
||||||
containers/Vector/Vectors.cpp
|
containers/Vector/Vectors.cpp
|
||||||
containers/VectorHD/VectorSingles.cpp
|
containers/VectorHD/VectorSingles.cpp
|
||||||
containers/Field/Fields.cpp
|
containers/Field/Fields.cpp
|
||||||
|
containers/symArrayHD/symArrays.cpp
|
||||||
containers/List/anyList/anyList.cpp
|
containers/List/anyList/anyList.cpp
|
||||||
containers/pointField/pointFields.cpp
|
containers/pointField/pointFields.cpp
|
||||||
containers/triSurfaceField/triSurfaceFields.cpp
|
containers/triSurfaceField/triSurfaceFields.cpp
|
||||||
|
|
|
@ -63,8 +63,24 @@ void fill
|
||||||
T val
|
T val
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
using exe_space = typename ViewType1D<T, properties...>::execution_space;
|
||||||
auto subV = Kokkos::subview(view, span.getPair() );
|
auto subV = Kokkos::subview(view, span.getPair() );
|
||||||
Kokkos::deep_copy(subV, val);
|
if constexpr ( std::is_trivially_copyable_v<T>)
|
||||||
|
{
|
||||||
|
Kokkos::deep_copy(subV, val);
|
||||||
|
}
|
||||||
|
else if constexpr( isHostAccessible<exe_space>())
|
||||||
|
{
|
||||||
|
for(auto i=span.start(); i<span.end(); i++ )
|
||||||
|
{
|
||||||
|
view[i] = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static_assert("fill is not valid for non-trivially-copyable data type");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename... properties>
|
template<typename T, typename... properties>
|
||||||
|
@ -79,6 +95,32 @@ void fill
|
||||||
fill(view, rangeU32(start, end),val);
|
fill(view, rangeU32(start, end),val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T, typename... properties>
|
||||||
|
void fill
|
||||||
|
(
|
||||||
|
ViewType3D<T, properties...>& view,
|
||||||
|
rangeU32 range1,
|
||||||
|
rangeU32 range2,
|
||||||
|
rangeU32 range3,
|
||||||
|
const T& val
|
||||||
|
)
|
||||||
|
{
|
||||||
|
static_assert(std::is_trivially_copyable_v<T>, "Not valid type for fill");
|
||||||
|
auto subV = Kokkos::subview(view, range1, range2, range3);
|
||||||
|
Kokkos::deep_copy(subV, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T, typename... properties>
|
||||||
|
void fill
|
||||||
|
(
|
||||||
|
ViewType3D<T, properties...>& view,
|
||||||
|
const T& val
|
||||||
|
)
|
||||||
|
{
|
||||||
|
static_assert(std::is_trivially_copyable_v<T>, "Not valid type for fill");
|
||||||
|
Kokkos::deep_copy(view, val);
|
||||||
|
}
|
||||||
|
|
||||||
template<
|
template<
|
||||||
typename Type,
|
typename Type,
|
||||||
typename... properties>
|
typename... properties>
|
||||||
|
@ -89,7 +131,7 @@ void fillSequence(
|
||||||
const Type startVal
|
const Type startVal
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
static_assert(std::is_trivially_copyable_v<Type>, "Not valid type for fill");
|
||||||
using ExecutionSpace = typename ViewType1D<Type, properties...>::execution_space;
|
using ExecutionSpace = typename ViewType1D<Type, properties...>::execution_space;
|
||||||
uint32 numElems = end-start;
|
uint32 numElems = end-start;
|
||||||
|
|
||||||
|
@ -115,6 +157,8 @@ bool fillSelected
|
||||||
Type val
|
Type val
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static_assert(std::is_trivially_copyable_v<Type>, "Not valid type for fillSelected");
|
||||||
static_assert(
|
static_assert(
|
||||||
areAccessible<
|
areAccessible<
|
||||||
typename ViewType1D<Type, properties...>::execution_space,
|
typename ViewType1D<Type, properties...>::execution_space,
|
||||||
|
@ -146,7 +190,7 @@ bool fillSelected(
|
||||||
const ViewType1D<Type, properties...> vals,
|
const ViewType1D<Type, properties...> vals,
|
||||||
const uint32 numElems )
|
const uint32 numElems )
|
||||||
{
|
{
|
||||||
|
static_assert(std::is_trivially_copyable_v<Type>, "Not valid type for fillSelected");
|
||||||
static_assert(
|
static_assert(
|
||||||
areAccessible<
|
areAccessible<
|
||||||
typename ViewType1D<Type, properties...>::execution_space,
|
typename ViewType1D<Type, properties...>::execution_space,
|
||||||
|
@ -404,7 +448,7 @@ template<
|
||||||
typename Type,
|
typename Type,
|
||||||
typename... properties>
|
typename... properties>
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
int32 binarySearch(
|
uint32 binarySearch(
|
||||||
const ViewType1D<Type, properties...>& view,
|
const ViewType1D<Type, properties...>& view,
|
||||||
uint32 start,
|
uint32 start,
|
||||||
uint32 end,
|
uint32 end,
|
||||||
|
@ -414,7 +458,7 @@ int32 binarySearch(
|
||||||
if(end<=start)return -1;
|
if(end<=start)return -1;
|
||||||
|
|
||||||
if(auto res =
|
if(auto res =
|
||||||
binarySearch_(view.data()+start,end-start,val); res>=0) {
|
binarySearch_(view.data()+start,end-start,val); res!=-1) {
|
||||||
return res+start;
|
return res+start;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
@ -105,7 +105,10 @@ bool pFlow::iIstream::findTokenResume(const word& w)
|
||||||
|
|
||||||
if( next.isWord() && isFirstToken)
|
if( next.isWord() && isFirstToken)
|
||||||
{
|
{
|
||||||
if(next.wordToken() == w ) return true;
|
if(next.wordToken() == w )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(next.isEndStatement()|| next.isEndBlock())
|
if(next.isEndStatement()|| next.isEndBlock())
|
||||||
|
|
|
@ -154,7 +154,7 @@ namespace pFlow
|
||||||
#define TypeInfoTemplate12(tName, Type1, Type2) \
|
#define TypeInfoTemplate12(tName, Type1, Type2) \
|
||||||
inline static word TYPENAME() \
|
inline static word TYPENAME() \
|
||||||
{ \
|
{ \
|
||||||
return word(tName)+"<"+getTypeName<Type1>()+","+getTypeName<Type2>()+">";} \
|
return word(tName)+"<"+getTypeName<Type1>()+","+getTypeName<Type2>()+">"; \
|
||||||
} \
|
} \
|
||||||
virtual word typeName() const { return TYPENAME();}
|
virtual word typeName() const { return TYPENAME();}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,6 @@ Licence:
|
||||||
|
|
||||||
REPORT(0)<<"\nReading proprties . . . "<<END_REPORT;
|
REPORT(0)<<"\nReading proprties . . . "<<END_REPORT;
|
||||||
|
|
||||||
auto proprties = property(propertyFile__, &Control.caseSetup());
|
auto proprties = property(propertyFile__, Control.caseSetup().path());
|
||||||
|
|
||||||
#endif // __setProperty_hpp__
|
#endif // __setProperty_hpp__
|
||||||
|
|
Loading…
Reference in New Issue