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(Interaction)
|
||||
add_subdirectory(Interaction)
|
||||
|
||||
add_subdirectory(MotionModel)
|
||||
|
||||
|
||||
|
||||
|
||||
#add_subdirectory(MPIParallelization)
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
realx3 transferPoint(const realx3& p, real dt)const
|
||||
{
|
||||
if(!inTimeRange()) return p;
|
||||
return p + 0.5*dt*(velocity0_+velocity_);
|
||||
return p + static_cast<real>(0.5*dt)*(velocity0_+velocity_);
|
||||
}
|
||||
|
||||
// - IO operation
|
||||
|
|
|
@ -166,7 +166,7 @@ pFlow::real pFlow::sphereShape::Inertia(uint32 index) 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
|
||||
|
|
|
@ -64,15 +64,17 @@ bool pFlow::property::makeNameIndex()
|
|||
{
|
||||
nameIndex_.clear();
|
||||
|
||||
|
||||
uint32 i=0;
|
||||
for(auto const& nm:materials_)
|
||||
{
|
||||
if(!nameIndex_.insertIf(nm, i++))
|
||||
if(!nameIndex_.insertIf(nm, i))
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
" repeated material name in the list of materials: " << materials_;
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
nameIndex_.rehash(0);
|
||||
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
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* property holds the pure properties of materials.
|
||||
*
|
||||
|
@ -52,6 +51,7 @@ private:
|
|||
/// rapid mapping from name to index
|
||||
wordHashMap<uint32> nameIndex_;
|
||||
|
||||
|
||||
/// number of materials
|
||||
uint32 numMaterials_ = 0;
|
||||
|
||||
|
@ -78,6 +78,11 @@ public:
|
|||
property(
|
||||
const word& fileName,
|
||||
repository* owner=nullptr);
|
||||
|
||||
property(
|
||||
const word& fileName,
|
||||
const fileSystem& dir
|
||||
);
|
||||
|
||||
property(const word& fileName,
|
||||
const wordVector& materials,
|
||||
|
@ -177,6 +182,8 @@ public:
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ demComponent/demComponent.cpp
|
|||
containers/Vector/Vectors.cpp
|
||||
containers/VectorHD/VectorSingles.cpp
|
||||
containers/Field/Fields.cpp
|
||||
containers/symArrayHD/symArrays.cpp
|
||||
containers/List/anyList/anyList.cpp
|
||||
containers/pointField/pointFields.cpp
|
||||
containers/triSurfaceField/triSurfaceFields.cpp
|
||||
|
|
|
@ -63,8 +63,24 @@ void fill
|
|||
T val
|
||||
)
|
||||
{
|
||||
using exe_space = typename ViewType1D<T, properties...>::execution_space;
|
||||
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>
|
||||
|
@ -79,6 +95,32 @@ void fill
|
|||
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<
|
||||
typename Type,
|
||||
typename... properties>
|
||||
|
@ -89,7 +131,7 @@ void fillSequence(
|
|||
const Type startVal
|
||||
)
|
||||
{
|
||||
|
||||
static_assert(std::is_trivially_copyable_v<Type>, "Not valid type for fill");
|
||||
using ExecutionSpace = typename ViewType1D<Type, properties...>::execution_space;
|
||||
uint32 numElems = end-start;
|
||||
|
||||
|
@ -115,6 +157,8 @@ bool fillSelected
|
|||
Type val
|
||||
)
|
||||
{
|
||||
|
||||
static_assert(std::is_trivially_copyable_v<Type>, "Not valid type for fillSelected");
|
||||
static_assert(
|
||||
areAccessible<
|
||||
typename ViewType1D<Type, properties...>::execution_space,
|
||||
|
@ -146,7 +190,7 @@ bool fillSelected(
|
|||
const ViewType1D<Type, properties...> vals,
|
||||
const uint32 numElems )
|
||||
{
|
||||
|
||||
static_assert(std::is_trivially_copyable_v<Type>, "Not valid type for fillSelected");
|
||||
static_assert(
|
||||
areAccessible<
|
||||
typename ViewType1D<Type, properties...>::execution_space,
|
||||
|
@ -404,7 +448,7 @@ template<
|
|||
typename Type,
|
||||
typename... properties>
|
||||
INLINE_FUNCTION_HD
|
||||
int32 binarySearch(
|
||||
uint32 binarySearch(
|
||||
const ViewType1D<Type, properties...>& view,
|
||||
uint32 start,
|
||||
uint32 end,
|
||||
|
@ -414,7 +458,7 @@ int32 binarySearch(
|
|||
if(end<=start)return -1;
|
||||
|
||||
if(auto res =
|
||||
binarySearch_(view.data()+start,end-start,val); res>=0) {
|
||||
binarySearch_(view.data()+start,end-start,val); res!=-1) {
|
||||
return res+start;
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -102,10 +102,13 @@ bool pFlow::iIstream::findTokenResume(const word& w)
|
|||
" at line number "<< lineNumber()<<endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if( next.isWord() && isFirstToken)
|
||||
{
|
||||
if(next.wordToken() == w ) return true;
|
||||
if(next.wordToken() == w )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(next.isEndStatement()|| next.isEndBlock())
|
||||
|
|
|
@ -154,7 +154,7 @@ namespace pFlow
|
|||
#define TypeInfoTemplate12(tName, Type1, Type2) \
|
||||
inline static word TYPENAME() \
|
||||
{ \
|
||||
return word(tName)+"<"+getTypeName<Type1>()+","+getTypeName<Type2>()+">";} \
|
||||
return word(tName)+"<"+getTypeName<Type1>()+","+getTypeName<Type2>()+">"; \
|
||||
} \
|
||||
virtual word typeName() const { return TYPENAME();}
|
||||
|
||||
|
|
|
@ -23,6 +23,6 @@ Licence:
|
|||
|
||||
REPORT(0)<<"\nReading proprties . . . "<<END_REPORT;
|
||||
|
||||
auto proprties = property(propertyFile__, &Control.caseSetup());
|
||||
auto proprties = property(propertyFile__, Control.caseSetup().path());
|
||||
|
||||
#endif // __setProperty_hpp__
|
||||
|
|
Loading…
Reference in New Issue