diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6f4967e6..7b403304 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,11 +9,7 @@ add_subdirectory(Particles) add_subdirectory(Geometry) -#add_subdirectory(Interaction) +add_subdirectory(Interaction) add_subdirectory(MotionModel) - - - -#add_subdirectory(MPIParallelization) diff --git a/src/MotionModel/entities/vibrating/vibrating.hpp b/src/MotionModel/entities/vibrating/vibrating.hpp index 42e73451..62241dfa 100644 --- a/src/MotionModel/entities/vibrating/vibrating.hpp +++ b/src/MotionModel/entities/vibrating/vibrating.hpp @@ -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(0.5*dt)*(velocity0_+velocity_); } // - IO operation diff --git a/src/Particles/SphereParticles/sphereShape/sphereShape.cpp b/src/Particles/SphereParticles/sphereShape/sphereShape.cpp index 75ec21e3..fac52d3c 100644 --- a/src/Particles/SphereParticles/sphereShape/sphereShape.cpp +++ b/src/Particles/SphereParticles/sphereShape/sphereShape.cpp @@ -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 diff --git a/src/Property/property.cpp b/src/Property/property.cpp index 25573665..d6af1f47 100644 --- a/src/Property/property.cpp +++ b/src/Property/property.cpp @@ -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(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()< 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; } } + + }; diff --git a/src/phasicFlow/CMakeLists.txt b/src/phasicFlow/CMakeLists.txt index 822f5cc6..d9d23fb7 100644 --- a/src/phasicFlow/CMakeLists.txt +++ b/src/phasicFlow/CMakeLists.txt @@ -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 diff --git a/src/phasicFlow/Kokkos/ViewAlgorithms.hpp b/src/phasicFlow/Kokkos/ViewAlgorithms.hpp index 1ee86959..d765e014 100644 --- a/src/phasicFlow/Kokkos/ViewAlgorithms.hpp +++ b/src/phasicFlow/Kokkos/ViewAlgorithms.hpp @@ -63,8 +63,24 @@ void fill T val ) { + using exe_space = typename ViewType1D::execution_space; auto subV = Kokkos::subview(view, span.getPair() ); - Kokkos::deep_copy(subV, val); + if constexpr ( std::is_trivially_copyable_v) + { + Kokkos::deep_copy(subV, val); + } + else if constexpr( isHostAccessible()) + { + for(auto i=span.start(); i @@ -79,6 +95,32 @@ void fill fill(view, rangeU32(start, end),val); } +template +void fill +( + ViewType3D& view, + rangeU32 range1, + rangeU32 range2, + rangeU32 range3, + const T& val +) +{ + static_assert(std::is_trivially_copyable_v, "Not valid type for fill"); + auto subV = Kokkos::subview(view, range1, range2, range3); + Kokkos::deep_copy(subV, val); +} + +template +void fill +( + ViewType3D& view, + const T& val +) +{ + static_assert(std::is_trivially_copyable_v, "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, "Not valid type for fill"); using ExecutionSpace = typename ViewType1D::execution_space; uint32 numElems = end-start; @@ -115,6 +157,8 @@ bool fillSelected Type val ) { + + static_assert(std::is_trivially_copyable_v, "Not valid type for fillSelected"); static_assert( areAccessible< typename ViewType1D::execution_space, @@ -146,7 +190,7 @@ bool fillSelected( const ViewType1D vals, const uint32 numElems ) { - + static_assert(std::is_trivially_copyable_v, "Not valid type for fillSelected"); static_assert( areAccessible< typename ViewType1D::execution_space, @@ -404,7 +448,7 @@ template< typename Type, typename... properties> INLINE_FUNCTION_HD -int32 binarySearch( +uint32 binarySearch( const ViewType1D& 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{ diff --git a/src/phasicFlow/streams/iStream/iIstream.cpp b/src/phasicFlow/streams/iStream/iIstream.cpp index b909b999..a74d9620 100755 --- a/src/phasicFlow/streams/iStream/iIstream.cpp +++ b/src/phasicFlow/streams/iStream/iIstream.cpp @@ -102,10 +102,13 @@ bool pFlow::iIstream::findTokenResume(const word& w) " at line number "<< lineNumber()<()+","+getTypeName()+">";} \ + return word(tName)+"<"+getTypeName()+","+getTypeName()+">"; \ } \ virtual word typeName() const { return TYPENAME();} diff --git a/src/setHelpers/setProperty.hpp b/src/setHelpers/setProperty.hpp index a35a1026..43ec5ef2 100644 --- a/src/setHelpers/setProperty.hpp +++ b/src/setHelpers/setProperty.hpp @@ -23,6 +23,6 @@ Licence: REPORT(0)<<"\nReading proprties . . . "<