mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-22 16:28:30 +00:00
pointStructure with boundaries, construction tested
This commit is contained in:
@ -74,7 +74,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)
|
||||||
|
@ -37,20 +37,35 @@ containers/Vector/Vectors.cpp
|
|||||||
containers/Field/Fields.cpp
|
containers/Field/Fields.cpp
|
||||||
containers/List/anyList/anyList.cpp
|
containers/List/anyList/anyList.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
|
||||||
repository/IOobject/IOPattern.cpp
|
repository/IOobject/IOPattern.cpp
|
||||||
|
repository/repository/repository.cpp
|
||||||
|
repository/Time/Time.cpp
|
||||||
|
repository/Time/timeControl.cpp
|
||||||
|
repository/systemControl/systemControl.cpp
|
||||||
|
repository/systemControl/dynamicLinkLibs.cpp
|
||||||
|
|
||||||
eventManagement/subscriber.cpp
|
eventManagement/subscriber.cpp
|
||||||
eventManagement/observer.cpp
|
eventManagement/observer.cpp
|
||||||
|
|
||||||
|
structuredData/box/box.cpp
|
||||||
structuredData/line/line.cpp
|
structuredData/line/line.cpp
|
||||||
structuredData/infinitePlane/infinitePlane.cpp
|
structuredData/infinitePlane/infinitePlane.cpp
|
||||||
structuredData/plane/plane.cpp
|
structuredData/plane/plane.cpp
|
||||||
structuredData/domain/domain.cpp
|
structuredData/domain/domain.cpp
|
||||||
|
structuredData/domain/simulationDomain.cpp
|
||||||
|
structuredData/domain/regularSimulationDomain.cpp
|
||||||
|
structuredData/pointStructure/boundaryList.cpp
|
||||||
structuredData/pointStructure/internalPoints.cpp
|
structuredData/pointStructure/internalPoints.cpp
|
||||||
|
structuredData/pointStructure/pointStructure.cpp
|
||||||
structuredData/boundaries/boundaryBase/boundaryBase.cpp
|
structuredData/boundaries/boundaryBase/boundaryBase.cpp
|
||||||
|
structuredData/boundaries/boundaryExit/boundaryExit.cpp
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -48,17 +48,17 @@ public:
|
|||||||
|
|
||||||
using iterator = typename VectorType::iterator;
|
using iterator = typename VectorType::iterator;
|
||||||
|
|
||||||
using constIterator = typename VectorType::constIterator;
|
using const_iterator = typename VectorType::const_iterator;
|
||||||
|
|
||||||
using reference = typename VectorType::reference;
|
using reference = typename VectorType::reference;
|
||||||
|
|
||||||
using constReference = typename VectorType::constReference;
|
using const_reference = typename VectorType::const_reference;
|
||||||
|
|
||||||
using valueType = typename VectorType::valueType;
|
using value_type = typename VectorType::value_type;
|
||||||
|
|
||||||
using pointer = typename VectorType::pointer;
|
using pointer = typename VectorType::pointer;
|
||||||
|
|
||||||
using constPointer = typename VectorType::constPointer;
|
using const_pointer = typename VectorType::const_pointer;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -30,7 +30,6 @@ Licence:
|
|||||||
#include "error.hpp"
|
#include "error.hpp"
|
||||||
#include "iOstream.hpp"
|
#include "iOstream.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -91,7 +90,7 @@ public:
|
|||||||
// - a list with initial length of len
|
// - a list with initial length of len
|
||||||
ListPtr(size_t len)
|
ListPtr(size_t len)
|
||||||
:
|
:
|
||||||
list_(len)
|
list_(len, nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// - copy construct, create new objects out of the pointers in the src
|
// - copy construct, create new objects out of the pointers in the src
|
||||||
@ -141,10 +140,10 @@ public:
|
|||||||
//// - Methods
|
//// - Methods
|
||||||
|
|
||||||
// - set the ith element
|
// - set the ith element
|
||||||
T* set(size_t i, T* ptr);
|
uniquePtr<T> set(size_t i, T* ptr);
|
||||||
|
|
||||||
// - set the ith element and take the ownership from uniquePtr
|
// - set the ith element and take the ownership from uniquePtr
|
||||||
uniquePtr<T> set(size_t i, uniquePtr<T>& ptr );
|
uniquePtr<T> set(size_t i, uniquePtr<T>&& ptr );
|
||||||
|
|
||||||
// - create the object in-place and set the pointer in ith position
|
// - create the object in-place and set the pointer in ith position
|
||||||
// if oject creation fails, uniquePtr deletes the memeory
|
// if oject creation fails, uniquePtr deletes the memeory
|
||||||
@ -155,7 +154,7 @@ public:
|
|||||||
void push_back(T* ptr);
|
void push_back(T* ptr);
|
||||||
|
|
||||||
// - put the pointer at the end
|
// - put the pointer at the end
|
||||||
void push_back(uniquePtr<T>& ptr);
|
void push_back(uniquePtr<T>&& ptr);
|
||||||
|
|
||||||
// - safely create (in-place) and put the pointer at the end
|
// - safely create (in-place) and put the pointer at the end
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
|
@ -144,7 +144,7 @@ pFlow::ListPtr<T>& pFlow::ListPtr<T>::operator=
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T* pFlow::ListPtr<T>::set
|
pFlow::uniquePtr<T> pFlow::ListPtr<T>::set
|
||||||
(
|
(
|
||||||
size_t i, T* ptr
|
size_t i, T* ptr
|
||||||
)
|
)
|
||||||
@ -158,7 +158,7 @@ template<typename T>
|
|||||||
pFlow::uniquePtr<T> pFlow::ListPtr<T>::set
|
pFlow::uniquePtr<T> pFlow::ListPtr<T>::set
|
||||||
(
|
(
|
||||||
size_t i,
|
size_t i,
|
||||||
uniquePtr<T>& ptr
|
uniquePtr<T>&& ptr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if( i > size() )
|
if( i > size() )
|
||||||
@ -171,10 +171,9 @@ pFlow::uniquePtr<T> pFlow::ListPtr<T>::set
|
|||||||
|
|
||||||
auto iter = list_.begin();
|
auto iter = list_.begin();
|
||||||
std::advance(iter, i);
|
std::advance(iter, i);
|
||||||
auto oldIter = iter;
|
T* oldPtr = *iter;
|
||||||
*iter = ptr.release();
|
*iter = ptr.release();
|
||||||
return *oldIter;
|
return uniquePtr<T>(oldPtr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -200,7 +199,7 @@ void pFlow::ListPtr<T>::push_back
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void pFlow::ListPtr<T>::push_back(uniquePtr<T>& ptr)
|
void pFlow::ListPtr<T>::push_back(uniquePtr<T>&& ptr)
|
||||||
{
|
{
|
||||||
list_.push_back( ptr.release() );
|
list_.push_back( ptr.release() );
|
||||||
}
|
}
|
||||||
@ -271,17 +270,23 @@ pFlow::uniquePtr<T> pFlow::ListPtr<T>::release
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void pFlow::ListPtr<T>::clear()
|
void pFlow::ListPtr<T>::clear()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
int i =0;
|
||||||
for( auto iter = list_.begin(); iter != list_.end(); ++iter )
|
for( auto iter = list_.begin(); iter != list_.end(); ++iter )
|
||||||
{
|
{
|
||||||
if(*iter != nullptr)
|
if(*iter != nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
delete *iter;
|
delete *iter;
|
||||||
*iter = nullptr;
|
*iter = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list_.clear();
|
list_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,19 +65,19 @@ public:
|
|||||||
|
|
||||||
typedef typename vectorType::iterator iterator;
|
typedef typename vectorType::iterator iterator;
|
||||||
|
|
||||||
typedef typename vectorType::const_iterator constIterator;
|
typedef typename vectorType::const_iterator const_iterator;
|
||||||
|
|
||||||
typedef typename vectorType::reference reference;
|
typedef typename vectorType::reference reference;
|
||||||
|
|
||||||
typedef typename vectorType::const_reference constReference;
|
typedef typename vectorType::const_reference const_reference;
|
||||||
|
|
||||||
typedef T valueType;
|
typedef T value_type;
|
||||||
|
|
||||||
typedef T* pointer;
|
typedef T* pointer;
|
||||||
|
|
||||||
typedef const T* constPointer;
|
typedef const T* const_pointer;
|
||||||
|
|
||||||
typedef typename std::initializer_list<T> initList;
|
typedef typename std::initializer_list<T> init_list;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
/// Vector from name and initializer list
|
/// Vector from name and initializer list
|
||||||
inline Vector(const word& name, const initList &l)
|
inline Vector(const word& name, const init_list &l)
|
||||||
:
|
:
|
||||||
vectorType(l),
|
vectorType(l),
|
||||||
name_(name)
|
name_(name)
|
||||||
@ -325,11 +325,25 @@ public:
|
|||||||
// - fill the whole content of vector, [begin, end), with val
|
// - fill the whole content of vector, [begin, end), with val
|
||||||
inline void fill( const T& val);
|
inline void fill( const T& val);
|
||||||
|
|
||||||
|
inline
|
||||||
|
auto getSpan()
|
||||||
|
{
|
||||||
|
return span<T>(this->data(), this->size());
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
auto getSpan()const
|
||||||
|
{
|
||||||
|
return span<const T>(this->data(), this->size());
|
||||||
|
}
|
||||||
|
|
||||||
static constexpr bool isHostAccessible()
|
static constexpr bool isHostAccessible()
|
||||||
{
|
{
|
||||||
return isHostAccessible_;
|
return isHostAccessible_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
inline void operator +=( const T& val);
|
inline void operator +=( const T& val);
|
||||||
inline void operator -=( const T& val);
|
inline void operator -=( const T& val);
|
||||||
inline void operator *=( const T& val);
|
inline void operator *=( const T& val);
|
||||||
|
@ -62,27 +62,27 @@ public:
|
|||||||
|
|
||||||
using iterator = T*;
|
using iterator = T*;
|
||||||
|
|
||||||
using constIterator = const T*;
|
using const_iterator = const T*;
|
||||||
|
|
||||||
using reference = T&;
|
using reference = T&;
|
||||||
|
|
||||||
using constReference = const T&;
|
using const_reference = const T&;
|
||||||
|
|
||||||
using valueType = T;
|
using value_type = T;
|
||||||
|
|
||||||
using pointer = T*;
|
using pointer = T*;
|
||||||
|
|
||||||
using constPointer = const T*;
|
using const_pointer = const T*;
|
||||||
|
|
||||||
//- typedefs related to memory management
|
//- typedefs related to memory management
|
||||||
|
|
||||||
using viewType = ViewType1D<T, MemorySpace>;
|
using viewType = ViewType1D<T, MemorySpace>;
|
||||||
|
|
||||||
using deviceType = typename viewType::device_type;
|
using device_type = typename viewType::device_type;
|
||||||
|
|
||||||
using memorySpace = typename viewType::memory_space;
|
using memory_space = typename viewType::memory_space;
|
||||||
|
|
||||||
using executionSpace = typename viewType::execution_space;
|
using execution_space = typename viewType::execution_space;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -102,19 +102,19 @@ protected:
|
|||||||
|
|
||||||
/// Is the memory of this vector accessible from Host
|
/// Is the memory of this vector accessible from Host
|
||||||
static constexpr
|
static constexpr
|
||||||
bool isHostAccessible_ = isHostAccessible<executionSpace>();
|
bool isHostAccessible_ = isHostAccessible<execution_space>();
|
||||||
//Kokkos::SpaceAccessibility<executionSpace,HostSpace>::accessible;
|
//Kokkos::SpaceAccessibility<execution_space,HostSpace>::accessible;
|
||||||
|
|
||||||
/// Is the memory of this vector accessiple from Divce
|
/// Is the memory of this vector accessiple from Divce
|
||||||
static constexpr
|
static constexpr
|
||||||
bool isDeviceAccessible_ = isDeviceAccessible<executionSpace>();
|
bool isDeviceAccessible_ = isDeviceAccessible<execution_space>();
|
||||||
|
|
||||||
|
|
||||||
/// Name of the memory space
|
/// Name of the memory space
|
||||||
constexpr static inline
|
constexpr static inline
|
||||||
const char* memoerySpaceName()
|
const char* memoerySpaceName()
|
||||||
{
|
{
|
||||||
return memorySpace::name();
|
return memory_space::name();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Evaluate capacity based on the input size
|
/// Evaluate capacity based on the input size
|
||||||
@ -461,6 +461,17 @@ public:
|
|||||||
assign(src, src.capacity());
|
assign(src, src.capacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
auto getSpan()
|
||||||
|
{
|
||||||
|
return span<T>(view_.data(), size());
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
auto getSpan()const
|
||||||
|
{
|
||||||
|
return span<const T>(view_.data(), this->size());
|
||||||
|
}
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
INLINE_FUNCTION_H
|
||||||
bool insertSetElement(uint32IndexContainer indices, const T& val);
|
bool insertSetElement(uint32IndexContainer indices, const T& val);
|
||||||
@ -520,7 +531,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
INLINE_FUNCTION_H
|
||||||
constPointer data()const{
|
const_pointer data()const{
|
||||||
return view_.data();
|
return view_.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,7 +546,7 @@ public:
|
|||||||
/// Return begin iterator. it works when host is accessible.
|
/// Return begin iterator. it works when host is accessible.
|
||||||
template<bool Enable = true>
|
template<bool Enable = true>
|
||||||
INLINE_FUNCTION_H
|
INLINE_FUNCTION_H
|
||||||
typename std::enable_if_t<isHostAccessible_ && Enable,constIterator>
|
typename std::enable_if_t<isHostAccessible_ && Enable,const_iterator>
|
||||||
begin()const {
|
begin()const {
|
||||||
return data();
|
return data();
|
||||||
}
|
}
|
||||||
@ -553,7 +564,7 @@ public:
|
|||||||
/// Return end iterator. it works when host is accessible.
|
/// Return end iterator. it works when host is accessible.
|
||||||
template<bool Enable = true>
|
template<bool Enable = true>
|
||||||
INLINE_FUNCTION_H
|
INLINE_FUNCTION_H
|
||||||
typename std::enable_if_t<isHostAccessible_ && Enable,constIterator>
|
typename std::enable_if_t<isHostAccessible_ && Enable,const_iterator>
|
||||||
end()const{
|
end()const{
|
||||||
return size_ > 0 ? data() + size_: data();
|
return size_ > 0 ? data() + size_: data();
|
||||||
}
|
}
|
||||||
@ -569,7 +580,7 @@ public:
|
|||||||
/// Return reference to element i. it works when host is accessible.
|
/// Return reference to element i. it works when host is accessible.
|
||||||
template<bool Enable = true>
|
template<bool Enable = true>
|
||||||
INLINE_FUNCTION_H
|
INLINE_FUNCTION_H
|
||||||
typename std::enable_if_t<isHostAccessible_ && Enable,constReference>
|
typename std::enable_if_t<isHostAccessible_ && Enable,const_reference>
|
||||||
operator[](size_t i)const{
|
operator[](size_t i)const{
|
||||||
return view_[i];
|
return view_[i];
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ bool pFlow::VectorSingle<T,MemorySpace>::insertSetElement(uint32IndexContainer i
|
|||||||
resize(maxInd+1);
|
resize(maxInd+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
using policy = Kokkos::RangePolicy<executionSpace,Kokkos::IndexType<uint32>>;
|
using policy = Kokkos::RangePolicy<execution_space,Kokkos::IndexType<uint32>>;
|
||||||
|
|
||||||
if constexpr( isDeviceAccessible_ )
|
if constexpr( isDeviceAccessible_ )
|
||||||
{
|
{
|
||||||
@ -88,7 +88,7 @@ bool pFlow::VectorSingle<T,MemorySpace>::insertSetElement
|
|||||||
resize(maxInd+1);
|
resize(maxInd+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
using policy = Kokkos::RangePolicy<executionSpace,Kokkos::IndexType<uint32>>;
|
using policy = Kokkos::RangePolicy<execution_space,Kokkos::IndexType<uint32>>;
|
||||||
|
|
||||||
hostViewType1D<const T> hVals( vals.data(), vals.size());
|
hostViewType1D<const T> hVals( vals.data(), vals.size());
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ bool pFlow::VectorSingle<T,MemorySpace>::reorderItems(uint32IndexContainer indic
|
|||||||
|
|
||||||
viewType sortedView(this->name(), newSize);
|
viewType sortedView(this->name(), newSize);
|
||||||
|
|
||||||
using policy = Kokkos::RangePolicy< executionSpace,Kokkos::IndexType<uint32>>;
|
using policy = Kokkos::RangePolicy< execution_space,Kokkos::IndexType<uint32>>;
|
||||||
|
|
||||||
if constexpr( isDeviceAccessible_)
|
if constexpr( isDeviceAccessible_)
|
||||||
{
|
{
|
||||||
|
@ -378,7 +378,8 @@ bool pFlow::dictionary::isFileDict()const
|
|||||||
bool pFlow::dictionary::addPtr
|
bool pFlow::dictionary::addPtr
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
uniquePtr<iEntry>& entry
|
uniquePtr<iEntry>& entry,
|
||||||
|
bool warning
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -390,9 +391,13 @@ bool pFlow::dictionary::addPtr
|
|||||||
// search all entries for repeated keyword
|
// search all entries for repeated keyword
|
||||||
if(auto [ptr, exist] = entries_.find(keyword); exist )
|
if(auto [ptr, exist] = entries_.find(keyword); exist )
|
||||||
{
|
{
|
||||||
warningInFunction <<
|
if(warning)
|
||||||
"keyword " << keyword << " already exists in the dicrionary " <<
|
{
|
||||||
this->globalName() << ". The old entry will be replaced by the new one. \n";
|
warningInFunction <<
|
||||||
|
"keyword " << keyword << " already exists in the dicrionary " <<
|
||||||
|
this->globalName() << ". The old entry will be replaced by the new one. \n";
|
||||||
|
}
|
||||||
|
|
||||||
// store the old pointer to entry
|
// store the old pointer to entry
|
||||||
oldEntryPtr = ptr;
|
oldEntryPtr = ptr;
|
||||||
}
|
}
|
||||||
@ -400,6 +405,7 @@ bool pFlow::dictionary::addPtr
|
|||||||
|
|
||||||
if( entries_.insertReplace(keyword, entry) )
|
if( entries_.insertReplace(keyword, entry) )
|
||||||
{
|
{
|
||||||
|
|
||||||
if(oldEntryPtr)
|
if(oldEntryPtr)
|
||||||
{
|
{
|
||||||
// this should be replaced
|
// this should be replaced
|
||||||
|
@ -175,9 +175,10 @@ public:
|
|||||||
/// if dictionary is file dictionary, return false
|
/// if dictionary is file dictionary, return false
|
||||||
virtual bool isFileDict()const;
|
virtual bool isFileDict()const;
|
||||||
|
|
||||||
/// add a pointer entry (dictionary/dataEntry)
|
/// @brief add a pointer entry (dictionary/dataEntry)
|
||||||
// replaces this entry with existing one
|
/// replaces this entry with existing one and issue a warning
|
||||||
bool addPtr(const word& keyword, uniquePtr<iEntry>& etry );
|
bool addPtr(const word& keyword, uniquePtr<iEntry>& etry, bool warning = true );
|
||||||
|
|
||||||
|
|
||||||
/// add a float dataEntry
|
/// add a float dataEntry
|
||||||
bool add(const word& keyword, const float& v);
|
bool add(const word& keyword, const float& v);
|
||||||
@ -206,13 +207,16 @@ public:
|
|||||||
/// add a uint8 dataEntry
|
/// add a uint8 dataEntry
|
||||||
bool add(const word& keyword, const uint8& v);
|
bool add(const word& keyword, const uint8& v);
|
||||||
|
|
||||||
// add a dictionary with the specifiedd keyword
|
/// @brief add a dictionary with the specifiedd keyword, if
|
||||||
|
/// it exists, replace it.
|
||||||
bool addDict(const word& keyword, const dictionary& dict);
|
bool addDict(const word& keyword, const dictionary& dict);
|
||||||
|
|
||||||
/// add a dataEntry of type T
|
/// add a dataEntry of type T
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool add(const word& keyword, const T& v );
|
bool add(const word& keyword, const T& v );
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
bool addOrKeep(const word& keyword, const T& v);
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
@ -311,6 +315,19 @@ bool dictionary::add(const word& keyword, const T& v )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
bool dictionary::addOrKeep(const word& keyword, const T& v )
|
||||||
|
{
|
||||||
|
if(!containsDataEntry(keyword))
|
||||||
|
{
|
||||||
|
uniquePtr<iEntry> ptr = makeUnique<dataEntry>(keyword, *this ,v);
|
||||||
|
return addPtr(keyword, ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool dictionary::readDataEntry
|
bool dictionary::readDataEntry
|
||||||
(
|
(
|
||||||
|
16
src/phasicFlow/eventManagement/eventManagement.hpp
Normal file
16
src/phasicFlow/eventManagement/eventManagement.hpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef __eventManagement_hpp__
|
||||||
|
#define __eventManagement_hpp__
|
||||||
|
|
||||||
|
#include "subscriber.hpp"
|
||||||
|
#include "observer.hpp"
|
||||||
|
#include "pointMessage.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
using pointSubcriber = subscriber<pointMessage>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -40,11 +40,23 @@ protected:
|
|||||||
// - list of subsribed objectd that recieve updage messages
|
// - list of subsribed objectd that recieve updage messages
|
||||||
mutable std::array<List<observer*>,16> observerList_;
|
mutable std::array<List<observer*>,16> observerList_;
|
||||||
|
|
||||||
|
word subName_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
subscriber()
|
subscriber(const word& name)
|
||||||
|
:
|
||||||
|
subName_(name)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
subscriber(const subscriber&) = delete;
|
||||||
|
|
||||||
|
subscriber(subscriber&&) = default;
|
||||||
|
|
||||||
|
subscriber& operator = (const subscriber&) = delete;
|
||||||
|
|
||||||
|
subscriber& operator = (subscriber&&) = default;
|
||||||
|
|
||||||
virtual ~subscriber();
|
virtual ~subscriber();
|
||||||
|
|
||||||
virtual bool subscribe(message msg, observer* obsevr)const;
|
virtual bool subscribe(message msg, observer* obsevr)const;
|
||||||
@ -55,6 +67,7 @@ public:
|
|||||||
|
|
||||||
//bool notify(const eventMessage& msg, const List<eventObserver*>& exclutionList );
|
//bool notify(const eventMessage& msg, const List<eventObserver*>& exclutionList );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool notify(const message msg, const anyList& varList);
|
bool notify(const message msg, const anyList& varList);
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ const inline char* integrationFolder__ = "integration";
|
|||||||
|
|
||||||
// file names
|
// file names
|
||||||
const inline char* settingsFile__ = "settingsDict";
|
const inline char* settingsFile__ = "settingsDict";
|
||||||
|
const inline char* domainFile__ = "domainDict";
|
||||||
const inline char* insertionFile__ = "particleInsertion";
|
const inline char* insertionFile__ = "particleInsertion";
|
||||||
const inline char* sphereShapeFile__ = "sphereShape";
|
const inline char* sphereShapeFile__ = "sphereShape";
|
||||||
const inline char* pointStructureFile__ = "pStructure";
|
const inline char* pointStructureFile__ = "pStructure";
|
||||||
|
@ -95,6 +95,18 @@ public:
|
|||||||
return processors::globalSize()>1;
|
return processors::globalSize()>1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
const char* runTypeName()
|
||||||
|
{
|
||||||
|
if(isParallel())
|
||||||
|
{
|
||||||
|
return "MPI";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "regular";
|
||||||
|
}
|
||||||
|
}
|
||||||
/// Is MPI initialized?
|
/// Is MPI initialized?
|
||||||
static
|
static
|
||||||
bool isInitialized();
|
bool isInitialized();
|
||||||
|
@ -76,9 +76,9 @@ public:
|
|||||||
|
|
||||||
stridedRange(const dictionary& dict)
|
stridedRange(const dictionary& dict)
|
||||||
:
|
:
|
||||||
begin_(dict.getVal<label>("begin")),
|
begin_(dict.getVal<T>("begin")),
|
||||||
end_(dict.getVal<label>("end")),
|
end_(dict.getVal<T>("end")),
|
||||||
stride_(dict.getVal<label>("stride"))
|
stride_(dict.getVal<T>("stride"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -111,7 +111,7 @@ bool pFlow::Time::write
|
|||||||
{
|
{
|
||||||
if(outputToFile())
|
if(outputToFile())
|
||||||
{
|
{
|
||||||
REPORT(0)<<"\nWriting to file at time: "<< cyanText(timeName())<<endREPORT;
|
REPORT(0)<<"\nWriting to file at time: "<< Cyan_Text(timeName())<<END_REPORT;
|
||||||
return repository::write(verbose);
|
return repository::write(verbose);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
//// - Methods
|
//// - Methods
|
||||||
virtual fileSystem localPath()const
|
virtual fileSystem localPath()const
|
||||||
{
|
{
|
||||||
return timeName();
|
return fileSystem(timeName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// - geometry repository
|
// - geometry repository
|
||||||
|
@ -203,7 +203,7 @@ bool pFlow::timeControl::operator ++(int)
|
|||||||
currentTime_ += dt_;
|
currentTime_ += dt_;
|
||||||
if(screenReport() && !managedExternaly_)
|
if(screenReport() && !managedExternaly_)
|
||||||
{
|
{
|
||||||
REPORT(0)<<"Time (s): "<<cyanText( currentTimeWord() )<<endREPORT;
|
REPORT(0)<<"Time (s): "<<Cyan_Text( currentTimeWord() )<<END_REPORT;
|
||||||
}
|
}
|
||||||
// switch outputToFile_ on/off
|
// switch outputToFile_ on/off
|
||||||
checkForOutputToFile();
|
checkForOutputToFile();
|
||||||
|
@ -245,7 +245,7 @@ bool pFlow::repository::write
|
|||||||
{
|
{
|
||||||
if(verbose)
|
if(verbose)
|
||||||
{
|
{
|
||||||
REPORT(1)<< "Writing to " << obj.second.path()<<endREPORT;
|
REPORT(1)<< "Writing to " << obj.second.path()<<END_REPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!obj.second.write())
|
if(!obj.second.write())
|
||||||
|
@ -37,7 +37,7 @@ pFlow::dynamicLinkLibs::dynamicLinkLibs(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
REPORT(1)<< "libs are "<< greenText(libNames)<<endREPORT;
|
REPORT(1)<< "libs are "<< Green_Text(libNames)<<END_REPORT;
|
||||||
|
|
||||||
for(auto libName:libNames)
|
for(auto libName:libNames)
|
||||||
{
|
{
|
||||||
@ -68,7 +68,7 @@ pFlow::dynamicLinkLibs::~dynamicLinkLibs()
|
|||||||
|
|
||||||
void* pFlow::dynamicLinkLibs::open(word libName)
|
void* pFlow::dynamicLinkLibs::open(word libName)
|
||||||
{
|
{
|
||||||
REPORT(2)<<"Loading "<< greenText(libName)<<endREPORT;
|
REPORT(2)<<"Loading "<< Green_Text(libName)<<END_REPORT;
|
||||||
|
|
||||||
void* handle = dlopen(libName.c_str(), RTLD_LAZY|RTLD_GLOBAL);
|
void* handle = dlopen(libName.c_str(), RTLD_LAZY|RTLD_GLOBAL);
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ pFlow::systemControl::systemControl
|
|||||||
),
|
),
|
||||||
libs_(settingsDict_),
|
libs_(settingsDict_),
|
||||||
outFilePrecision_(
|
outFilePrecision_(
|
||||||
settingsDict_.getValOrSet("outFilePrecision", static_cast<size_t>(6))
|
settingsDict_.getValOrSet("outFilePrecision", static_cast<uint64>(6))
|
||||||
),
|
),
|
||||||
Time_
|
Time_
|
||||||
(
|
(
|
||||||
@ -231,6 +231,22 @@ pFlow::systemControl::systemControl(
|
|||||||
writeToFileTimer_("Write to file", &timers_)
|
writeToFileTimer_("Write to file", &timers_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
pFlow::dictionary& pFlow::systemControl::domainDict()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
settings().emplaceObjectOrGet<dictionary>
|
||||||
|
(
|
||||||
|
objectFile
|
||||||
|
(
|
||||||
|
domainFile__,
|
||||||
|
"",
|
||||||
|
objectFile::READ_ALWAYS,
|
||||||
|
objectFile::WRITE_NEVER
|
||||||
|
),
|
||||||
|
domainFile__,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
bool pFlow::systemControl::operator ++(int)
|
bool pFlow::systemControl::operator ++(int)
|
||||||
{
|
{
|
||||||
|
@ -52,25 +52,25 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// - settings folder repository
|
/// settings folder repository
|
||||||
repository settings_;
|
repository settings_;
|
||||||
|
|
||||||
// - caseSetup folder repository
|
/// caseSetup folder repository
|
||||||
repository caseSetup_;
|
repository caseSetup_;
|
||||||
|
|
||||||
// - settingsDict fileDictionary
|
/// settingsDict fileDictionary
|
||||||
dictionary& settingsDict_;
|
dictionary& settingsDict_;
|
||||||
|
|
||||||
// - extra libs to be loaded
|
/// extra libs to be loaded
|
||||||
dynamicLinkLibs libs_;
|
dynamicLinkLibs libs_;
|
||||||
|
|
||||||
// - precision for writing to file
|
/// precision for writing to file
|
||||||
size_t outFilePrecision_ = 6;
|
size_t outFilePrecision_ = 6;
|
||||||
|
|
||||||
// - time repository
|
/// time repository
|
||||||
Time Time_;
|
Time Time_;
|
||||||
|
|
||||||
// - if time control is managed externaly
|
/// if time control is managed externaly
|
||||||
|
|
||||||
bool externalTimeControl_ = false;
|
bool externalTimeControl_ = false;
|
||||||
|
|
||||||
@ -163,6 +163,9 @@ public:
|
|||||||
return settingsDict_;
|
return settingsDict_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dictionary& domainDict();
|
||||||
|
|
||||||
|
|
||||||
virtual word runName() const
|
virtual word runName() const
|
||||||
{
|
{
|
||||||
return runName_;
|
return runName_;
|
||||||
|
@ -1,10 +1,27 @@
|
|||||||
|
/*------------------------------- 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 "boundaryBase.hpp"
|
#include "boundaryBase.hpp"
|
||||||
|
#include "dictionary.hpp"
|
||||||
|
|
||||||
|
/*pFlow::boundaryBase::boundaryBase
|
||||||
pFlow::boundaryBase::boundaryBase
|
|
||||||
(
|
(
|
||||||
const plane& bplane,
|
const plane& bplane,
|
||||||
uint32 mirrorProc,
|
uint32 mirrorProc,
|
||||||
@ -13,11 +30,60 @@ pFlow::boundaryBase::boundaryBase
|
|||||||
internalPoints& internal
|
internalPoints& internal
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
boundaryPlane_(bplane),
|
subscriber(groupNames(name,type)),
|
||||||
name_(name),
|
boundaryPlane_(bplane),
|
||||||
type_(type),
|
name_(name),
|
||||||
mirrorProcessoNo_(mirrorProc),
|
type_(type),
|
||||||
internal_(internal)
|
mirrorProcessoNo_(mirrorProc),
|
||||||
|
internal_(internal)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
pFlow::boundaryBase::boundaryBase
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const plane& bplane,
|
||||||
|
internalPoints& internal
|
||||||
|
)
|
||||||
|
:
|
||||||
|
subscriber(dict.name()),
|
||||||
|
boundaryPlane_(bplane),
|
||||||
|
neighborLength_(dict.getVal<real>("neighborLength")),
|
||||||
|
internal_(internal),
|
||||||
|
indexList_(groupNames(dict.name(),"indexList")),
|
||||||
|
mirrorProcessoNo_(dict.getVal<uint32>("mirrorProcessorNo")),
|
||||||
|
name_(dict.name()),
|
||||||
|
type_(dict.getVal<word>("type"))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pFlow::uniquePtr<pFlow::boundaryBase> pFlow::boundaryBase::create
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const plane& bplane,
|
||||||
|
internalPoints& internal
|
||||||
|
)
|
||||||
|
{
|
||||||
|
word type = dict.getVal<word>("type");
|
||||||
|
word bType = angleBracketsNames("boundary", type);
|
||||||
|
|
||||||
|
if( dictionaryvCtorSelector_.search(bType) )
|
||||||
|
{
|
||||||
|
return dictionaryvCtorSelector_[bType] (dict, bplane, internal);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printKeys
|
||||||
|
(
|
||||||
|
fatalError << "Ctor Selector "<< bType << " dose not exist. \n"
|
||||||
|
<<"Avaiable ones are: \n\n"
|
||||||
|
,
|
||||||
|
dictionaryvCtorSelector_
|
||||||
|
);
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
@ -1,12 +1,32 @@
|
|||||||
|
/*------------------------------- 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 __boundaryBase_hpp__
|
#ifndef __boundaryBase_hpp__
|
||||||
#define __boundaryBase_hpp__
|
#define __boundaryBase_hpp__
|
||||||
|
|
||||||
|
#include "virtualConstructor.hpp"
|
||||||
|
#include "subscriber.hpp"
|
||||||
#include "VectorSingles.hpp"
|
#include "VectorSingles.hpp"
|
||||||
#include "plane.hpp"
|
#include "plane.hpp"
|
||||||
|
|
||||||
|
#include "streams.hpp"
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
@ -14,8 +34,11 @@ namespace pFlow
|
|||||||
// forward
|
// forward
|
||||||
|
|
||||||
class internalPoints;
|
class internalPoints;
|
||||||
|
class dictionary;
|
||||||
|
|
||||||
class boundaryBase
|
class boundaryBase
|
||||||
|
:
|
||||||
|
public subscriber
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -26,45 +49,77 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
plane boundaryPlane_;
|
const plane& boundaryPlane_;
|
||||||
|
|
||||||
|
/// The length defined for creating neighbor list
|
||||||
|
real neighborLength_;
|
||||||
|
|
||||||
|
/// a reference to
|
||||||
|
internalPoints& internal_;
|
||||||
|
|
||||||
|
/// list of particles indices on device
|
||||||
|
uint32Vector_D indexList_;
|
||||||
|
|
||||||
|
uint32 mirrorProcessoNo_;
|
||||||
|
|
||||||
word name_;
|
word name_;
|
||||||
|
|
||||||
word type_;
|
word type_;
|
||||||
|
|
||||||
uint32 mirrorProcessoNo_;
|
|
||||||
|
|
||||||
/// list of particles indices on device
|
|
||||||
uint32Vector_D indexList_;
|
|
||||||
|
|
||||||
/// a reference to
|
|
||||||
internalPoints& internal_;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TypeInfo("boundaryBase");
|
TypeInfo("boundaryBase");
|
||||||
|
|
||||||
boundaryBase(
|
/*boundaryBase(
|
||||||
const plane& bplane,
|
const plane& bplane,
|
||||||
uint32 mirrorProc,
|
uint32 mirrorProc,
|
||||||
const word& name,
|
const word& name,
|
||||||
const word& type,
|
const word& type,
|
||||||
|
internalPoints& internal);*/
|
||||||
|
|
||||||
|
boundaryBase(
|
||||||
|
const dictionary& dict,
|
||||||
|
const plane& bplane,
|
||||||
internalPoints& internal);
|
internalPoints& internal);
|
||||||
|
|
||||||
boundaryBase(const boundaryBase&) = default;
|
boundaryBase(const boundaryBase&) = delete;
|
||||||
|
|
||||||
boundaryBase& operator=(const boundaryBase&) = default;
|
boundaryBase& operator=(const boundaryBase&) = delete;
|
||||||
|
|
||||||
boundaryBase(boundaryBase&&) = delete;
|
boundaryBase(boundaryBase&&) = default;
|
||||||
|
|
||||||
boundaryBase& operator=(boundaryBase&&) = delete;
|
boundaryBase& operator=(boundaryBase&&) = default;
|
||||||
|
|
||||||
virtual ~boundaryBase() = default;
|
virtual ~boundaryBase() = default;
|
||||||
|
|
||||||
|
|
||||||
virtual bool update() = 0 ;
|
create_vCtor
|
||||||
|
(
|
||||||
|
boundaryBase,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const plane& bplane,
|
||||||
|
internalPoints& internal
|
||||||
|
),
|
||||||
|
(dict, bplane, internal)
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual bool beforeIteratoin(uint32 iterNum, real t) = 0 ;
|
||||||
|
|
||||||
virtual bool iterate(uint32 iterNum, real t) = 0;
|
virtual bool iterate(uint32 iterNum, real t) = 0;
|
||||||
|
|
||||||
|
virtual bool afterIteration(uint32 iterNum, real t) = 0;
|
||||||
|
|
||||||
|
static
|
||||||
|
uniquePtr<boundaryBase> create
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const plane& bplane,
|
||||||
|
internalPoints& internal
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "boundaryExit.hpp"
|
||||||
|
#include "dictionary.hpp"
|
||||||
|
|
||||||
|
pFlow::boundaryExit::boundaryExit
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const plane& bplane,
|
||||||
|
internalPoints& internal
|
||||||
|
)
|
||||||
|
:
|
||||||
|
boundaryBase(dict, bplane, internal)
|
||||||
|
{
|
||||||
|
exitMarginLength_ = max(
|
||||||
|
dict.getValOrSet("exitMarginLength",0.0), 0.0);
|
||||||
|
checkForExitInterval_ = max(
|
||||||
|
dict.getValOrSet("checkForExitInterval", 1), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::boundaryExit::beforeIteratoin
|
||||||
|
(
|
||||||
|
uint32 iterNum,
|
||||||
|
real t
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::boundaryExit::iterate
|
||||||
|
(
|
||||||
|
uint32 iterNum,
|
||||||
|
real t
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::boundaryExit::afterIteration
|
||||||
|
(
|
||||||
|
uint32 iterNum,
|
||||||
|
real t
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
/*------------------------------- 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 __boundaryExit_hpp__
|
||||||
|
#define __boundaryExit_hpp__
|
||||||
|
|
||||||
|
|
||||||
|
#include "boundaryBase.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
class boundaryExit
|
||||||
|
:
|
||||||
|
public boundaryBase
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/// @brief Length of margin in the negative side of
|
||||||
|
/// boundary to still allow points stay in the
|
||||||
|
/// simulation.
|
||||||
|
real exitMarginLength_ = 0;
|
||||||
|
|
||||||
|
/// @brief between successive check for particle exit
|
||||||
|
/// (iteration-based).
|
||||||
|
uint32 checkForExitInterval_ = 1;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
TypeInfo("boundary<exit>");
|
||||||
|
|
||||||
|
boundaryExit(
|
||||||
|
const dictionary& dict,
|
||||||
|
const plane& bplane,
|
||||||
|
internalPoints& internal);
|
||||||
|
|
||||||
|
virtual
|
||||||
|
~boundaryExit() = default;
|
||||||
|
|
||||||
|
add_vCtor
|
||||||
|
(
|
||||||
|
boundaryBase,
|
||||||
|
boundaryExit,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
|
||||||
|
bool beforeIteratoin(uint32 iterNum, real t) override;
|
||||||
|
|
||||||
|
bool iterate(uint32 iterNum, real t) override;
|
||||||
|
|
||||||
|
bool afterIteration(uint32 iterNum, real t) override;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -124,6 +124,17 @@ public:
|
|||||||
return front_;
|
return front_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
const auto& boundaryPlane(uint32 i)const
|
||||||
|
{
|
||||||
|
if(i==0) return left_;
|
||||||
|
if(i==1) return right_;
|
||||||
|
if(i==2) return bottom_;
|
||||||
|
if(i==3) return top_;
|
||||||
|
if(i==4) return rear_;
|
||||||
|
return front_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}; // domain
|
}; // domain
|
||||||
|
|
||||||
|
114
src/phasicFlow/structuredData/domain/regularSimulationDomain.cpp
Normal file
114
src/phasicFlow/structuredData/domain/regularSimulationDomain.cpp
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "regularSimulationDomain.hpp"
|
||||||
|
#include "processors.hpp"
|
||||||
|
#include "streams.hpp"
|
||||||
|
|
||||||
|
bool pFlow::regularSimulationDomain::createBoundaryDicts()
|
||||||
|
{
|
||||||
|
auto& boundaries = globalDomainDict_.subDict("boundaries");
|
||||||
|
|
||||||
|
globalDomainDict_.addDict("regularSimulationDomainBoundaries", boundaries);
|
||||||
|
auto& rbBoundaries = globalDomainDict_.subDict("regularSimulationDomainBoundaries");
|
||||||
|
|
||||||
|
real neighborLength = boundaries.getVal<real>("neighborLength");
|
||||||
|
|
||||||
|
for(uint32 i=0; i<sizeOfBoundaries(); i++)
|
||||||
|
{
|
||||||
|
word bName = bundaryName(i);
|
||||||
|
if( !boundaries.containsDictionay(bName) )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"dictionary "<< bName<<
|
||||||
|
"does not exist in "<< boundaries.globalName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
auto& bDict = rbBoundaries.subDict(bName);
|
||||||
|
|
||||||
|
if(!bDict.addOrKeep("neighborLength", neighborLength))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"error in adding neighborLength to "<< bName <<
|
||||||
|
"in dictionary "<< boundaries.globalName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!bDict.add("mirrorProcessorNo",(uint32) processors::globalRank()))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"error in adding mirrorProcessorNo to "<< bName <<
|
||||||
|
" in dictionary "<< boundaries.globalName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::regularSimulationDomain::setThisDomain()
|
||||||
|
{
|
||||||
|
thisDomain_ = domain(globalBox_);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::regularSimulationDomain::regularSimulationDomain(
|
||||||
|
const dictionary &dict)
|
||||||
|
: simulationDomain(dict)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::regularSimulationDomain::updateDomains
|
||||||
|
(
|
||||||
|
const realx3Vector& pointPos
|
||||||
|
)
|
||||||
|
{
|
||||||
|
thisNumPoints_ = pointPos.size();
|
||||||
|
if(!createBoundaryDicts()) return false;
|
||||||
|
if(!setThisDomain()) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::uint32 pFlow::regularSimulationDomain::thisNumPoints() const
|
||||||
|
{
|
||||||
|
return thisNumPoints_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::regularSimulationDomain::transferBlockData
|
||||||
|
(
|
||||||
|
span<char> src,
|
||||||
|
span<char> dst,
|
||||||
|
uint32 sizeOfBlock
|
||||||
|
)
|
||||||
|
{
|
||||||
|
size_t requiredSize = sizeOfBlock*thisNumPoints();
|
||||||
|
if(dst.size() < requiredSize)
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"size of destination data block [in byte]"<< dst.size()<<
|
||||||
|
"is smaller than the required size [in byte]"<< requiredSize<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(src.size() < requiredSize )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"size of source data block [in byte]"<< src.size()<<
|
||||||
|
"is smaller than the required size [in byte]"<< requiredSize<<endl;
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::memcpy(dst.data(), src.data(), requiredSize);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pFlow::dictionary &pFlow::regularSimulationDomain::thisBoundaryDict() const
|
||||||
|
{
|
||||||
|
return globalDomainDict_.subDict("regularSimulationDomainBoundaries");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::regularSimulationDomain::requiresDataTransfer()const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
#ifndef __regularSimulationDomain_hpp__
|
||||||
|
#define __regularSimulationDomain_hpp__
|
||||||
|
|
||||||
|
#include "simulationDomain.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
class regularSimulationDomain
|
||||||
|
:
|
||||||
|
public simulationDomain
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
uint32 thisNumPoints_=0;
|
||||||
|
|
||||||
|
bool createBoundaryDicts() override;
|
||||||
|
|
||||||
|
bool setThisDomain()override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
TypeInfo("simulationDomain<regular>");
|
||||||
|
|
||||||
|
regularSimulationDomain(const dictionary& dict);
|
||||||
|
|
||||||
|
virtual
|
||||||
|
~regularSimulationDomain()=default;
|
||||||
|
|
||||||
|
add_vCtor
|
||||||
|
(
|
||||||
|
simulationDomain,
|
||||||
|
regularSimulationDomain,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
|
||||||
|
bool updateDomains(
|
||||||
|
const realx3Vector& pointPos)override;
|
||||||
|
|
||||||
|
uint32 thisNumPoints()const override;
|
||||||
|
|
||||||
|
|
||||||
|
bool transferBlockData(
|
||||||
|
span<char> src,
|
||||||
|
span<char> dst,
|
||||||
|
uint32 sizeOfBlock) override;
|
||||||
|
|
||||||
|
const dictionary& thisBoundaryDict()const override;
|
||||||
|
|
||||||
|
bool requiresDataTransfer() const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //__regularSimulationDomain_hpp__
|
56
src/phasicFlow/structuredData/domain/simulationDomain.cpp
Normal file
56
src/phasicFlow/structuredData/domain/simulationDomain.cpp
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*------------------------------- phasicFlow ---------------------------------
|
||||||
|
O C enter of
|
||||||
|
O O E ngineering and
|
||||||
|
O O M ultiscale modeling of
|
||||||
|
OOOOOOO F luid flow
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Copyright (C): www.cemf.ir
|
||||||
|
email: hamid.r.norouzi AT gmail.com
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Licence:
|
||||||
|
This file is part of phasicFlow code. It is a free software for simulating
|
||||||
|
granular and multiphase flows. You can redistribute it and/or modify it under
|
||||||
|
the terms of GNU General Public License v3 or any other later versions.
|
||||||
|
|
||||||
|
phasicFlow is distributed to help others in their research in the field of
|
||||||
|
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
||||||
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "simulationDomain.hpp"
|
||||||
|
#include "processors.hpp"
|
||||||
|
|
||||||
|
pFlow::simulationDomain::simulationDomain(const dictionary& dict)
|
||||||
|
:
|
||||||
|
globalBox_(dict.subDict("globalBox")),
|
||||||
|
globalDomainDict_(dict)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::uniquePtr<pFlow::simulationDomain>
|
||||||
|
pFlow::simulationDomain::create(const dictionary &dict)
|
||||||
|
{
|
||||||
|
|
||||||
|
word sType = angleBracketsNames(
|
||||||
|
"simulationDomain",
|
||||||
|
processors::runTypeName());
|
||||||
|
|
||||||
|
if( dictionaryvCtorSelector_.search(sType) )
|
||||||
|
{
|
||||||
|
return dictionaryvCtorSelector_[sType] (dict);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printKeys
|
||||||
|
(
|
||||||
|
fatalError << "Ctor Selector "<< sType << " dose not exist. \n"
|
||||||
|
<<"Avaiable ones are: \n\n"
|
||||||
|
,
|
||||||
|
dictionaryvCtorSelector_
|
||||||
|
);
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
142
src/phasicFlow/structuredData/domain/simulationDomain.hpp
Normal file
142
src/phasicFlow/structuredData/domain/simulationDomain.hpp
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
/*------------------------------- 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 __simulationDomain_hpp__
|
||||||
|
#define __simulationDomain_hpp__
|
||||||
|
|
||||||
|
#include "domain.hpp"
|
||||||
|
#include "virtualConstructor.hpp"
|
||||||
|
#include "Vectors.hpp"
|
||||||
|
|
||||||
|
#include "streams.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
class simulationDomain
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
static inline constexpr uint32 sizeOfBoundaries_ = 6;
|
||||||
|
|
||||||
|
static
|
||||||
|
inline const std::array<word,6> boundaryNames_ =
|
||||||
|
{
|
||||||
|
"left", "right",
|
||||||
|
"top", "bottom",
|
||||||
|
"rear", "front"
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/// @brief acutal limits of the simulation domain
|
||||||
|
box globalBox_;
|
||||||
|
|
||||||
|
/// @brief the actual limits of this processor domain
|
||||||
|
domain thisDomain_;
|
||||||
|
|
||||||
|
dictionary globalDomainDict_ ;
|
||||||
|
|
||||||
|
bool boundariesSet_ = false;
|
||||||
|
|
||||||
|
virtual bool createBoundaryDicts() = 0;
|
||||||
|
|
||||||
|
virtual bool setThisDomain() = 0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// - type info
|
||||||
|
TypeInfo("simulationDomain");
|
||||||
|
|
||||||
|
/// Constrcut from components
|
||||||
|
simulationDomain(const dictionary& dict);
|
||||||
|
|
||||||
|
/// Destructor
|
||||||
|
virtual
|
||||||
|
~simulationDomain() = default;
|
||||||
|
|
||||||
|
|
||||||
|
create_vCtor
|
||||||
|
(
|
||||||
|
simulationDomain,
|
||||||
|
dictionary,
|
||||||
|
(const dictionary& dict),
|
||||||
|
(dict)
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual
|
||||||
|
const dictionary& thisBoundaryDict()const = 0;
|
||||||
|
|
||||||
|
|
||||||
|
virtual
|
||||||
|
bool updateDomains(
|
||||||
|
const realx3Vector& pointPos) = 0;
|
||||||
|
|
||||||
|
//virtual getImportExportList() = 0;
|
||||||
|
|
||||||
|
//virtual getNumberInThisList() = 0;
|
||||||
|
|
||||||
|
virtual
|
||||||
|
uint32 thisNumPoints()const = 0;
|
||||||
|
|
||||||
|
virtual
|
||||||
|
bool transferBlockData(
|
||||||
|
span<char> src,
|
||||||
|
span<char> dst,
|
||||||
|
uint32 sizeOfBlock) = 0;
|
||||||
|
|
||||||
|
virtual
|
||||||
|
bool requiresDataTransfer() const = 0;
|
||||||
|
|
||||||
|
inline
|
||||||
|
const dictionary& boundaryDict(uint32 i)const
|
||||||
|
{
|
||||||
|
return thisBoundaryDict().subDict(bundaryName(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
const auto& boundaryPlane(uint32 i)const
|
||||||
|
{
|
||||||
|
return thisDomain_.boundaryPlane(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
const word& bundaryName(uint32 i)
|
||||||
|
{
|
||||||
|
return boundaryNames_[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
uint32 sizeOfBoundaries()
|
||||||
|
{
|
||||||
|
return boundaryNames_.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
uniquePtr<simulationDomain> create(const dictionary& dict);
|
||||||
|
|
||||||
|
}; // simulationDomain
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__simulationDomain_hpp__
|
104
src/phasicFlow/structuredData/domain/subDomain.hpp
Normal file
104
src/phasicFlow/structuredData/domain/subDomain.hpp
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
/*------------------------------- 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 __subDomain_hpp__
|
||||||
|
#define __subDomain_hpp__
|
||||||
|
|
||||||
|
#include "domain.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
class subDomain
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/// the actual limits of global domain
|
||||||
|
const domain& globalDomain_;
|
||||||
|
|
||||||
|
/// @brief dictionary of boundaries
|
||||||
|
const dictionary& boundaryDict_;
|
||||||
|
|
||||||
|
|
||||||
|
/// the actual limits of this processor domain
|
||||||
|
domain thisDomain_;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// - type info
|
||||||
|
TypeInfo("subDomain");
|
||||||
|
|
||||||
|
|
||||||
|
subDomain(
|
||||||
|
const domain& gDomain,
|
||||||
|
const domain& thisD,
|
||||||
|
const dictionary& bDicts)
|
||||||
|
:
|
||||||
|
globalDomain_(gDomain),
|
||||||
|
thisDomain_(thisD),
|
||||||
|
boundaryDict_(bDicts)
|
||||||
|
{}
|
||||||
|
|
||||||
|
const auto& thisDomain()const
|
||||||
|
{
|
||||||
|
return thisDomain_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dictionary& leftDict()const
|
||||||
|
{
|
||||||
|
return boundaryDict_.subDict("left");
|
||||||
|
}
|
||||||
|
|
||||||
|
const dictionary& rightDict()const
|
||||||
|
{
|
||||||
|
return boundaryDict_.subDict("right");
|
||||||
|
}
|
||||||
|
|
||||||
|
const dictionary& bottomDict()const
|
||||||
|
{
|
||||||
|
return boundaryDict_.subDict("bottom");;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dictionary& topDict()const
|
||||||
|
{
|
||||||
|
return boundaryDict_.subDict("top");;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dictionary& rearDict()const
|
||||||
|
{
|
||||||
|
return boundaryDict_.subDict("rear");;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dictionary& frontDict()const
|
||||||
|
{
|
||||||
|
return boundaryDict_.subDict("front");;
|
||||||
|
}
|
||||||
|
|
||||||
|
}; // subDomain
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__subDomain_hpp__
|
@ -0,0 +1,53 @@
|
|||||||
|
/*------------------------------- 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 "boundaryList.hpp"
|
||||||
|
#include "simulationDomain.hpp"
|
||||||
|
|
||||||
|
pFlow::boundaryList::boundaryList
|
||||||
|
(
|
||||||
|
const simulationDomain& simD,
|
||||||
|
internalPoints& internal
|
||||||
|
)
|
||||||
|
:
|
||||||
|
simDomain_(simD),
|
||||||
|
internal_(internal),
|
||||||
|
boundaryList_(simD.sizeOfBoundaries())
|
||||||
|
{}
|
||||||
|
|
||||||
|
bool pFlow::boundaryList::updateLists()
|
||||||
|
{
|
||||||
|
|
||||||
|
for(auto i=0; i<simDomain_.sizeOfBoundaries();i++)
|
||||||
|
{
|
||||||
|
boundaryList_.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
boundaryBase::create
|
||||||
|
(
|
||||||
|
simDomain_.boundaryDict(i),
|
||||||
|
simDomain_.boundaryPlane(i),
|
||||||
|
internal_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
listSet_ = true;
|
||||||
|
return true;
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
/*------------------------------- 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 __boundaryList_hpp__
|
||||||
|
#define __boundaryList_hpp__
|
||||||
|
|
||||||
|
#include "boundaryBase.hpp"
|
||||||
|
#include "ListPtr.hpp"
|
||||||
|
|
||||||
|
#include "streams.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
class simulationDomain;
|
||||||
|
|
||||||
|
class boundaryList
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//// - data members
|
||||||
|
internalPoints& internal_;
|
||||||
|
|
||||||
|
const simulationDomain& simDomain_;
|
||||||
|
|
||||||
|
ListPtr<boundaryBase> boundaryList_;
|
||||||
|
|
||||||
|
bool listSet_ = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/// type info
|
||||||
|
TypeInfo("boundaryList");
|
||||||
|
|
||||||
|
|
||||||
|
//// - Constructors
|
||||||
|
|
||||||
|
boundaryList(
|
||||||
|
const simulationDomain& simD,
|
||||||
|
internalPoints& internal);
|
||||||
|
|
||||||
|
//~boundaryList() = default;
|
||||||
|
|
||||||
|
~boundaryList() = default;
|
||||||
|
|
||||||
|
bool updateLists();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // pFlow
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__boundaryList_hpp__
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ Licence:
|
|||||||
|
|
||||||
|
|
||||||
#include "internalPoints.hpp"
|
#include "internalPoints.hpp"
|
||||||
|
#include "Vector.hpp"
|
||||||
|
|
||||||
void pFlow::internalPoints::syncPFlag()const
|
void pFlow::internalPoints::syncPFlag()const
|
||||||
{
|
{
|
||||||
@ -31,11 +31,6 @@ void pFlow::internalPoints::syncPFlag()const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*#include "setFieldList.hpp"
|
|
||||||
#include "error.hpp"
|
|
||||||
#include "iOstream.hpp"
|
|
||||||
|
|
||||||
#include "mortonIndexing.hpp"*/
|
|
||||||
|
|
||||||
/*FUNCTION_H
|
/*FUNCTION_H
|
||||||
bool pFlow::internalPoints::evaluateinternalPoints()
|
bool pFlow::internalPoints::evaluateinternalPoints()
|
||||||
@ -153,6 +148,7 @@ pFlow::uniquePtr<pFlow::int32IndexContainer>
|
|||||||
|
|
||||||
pFlow::internalPoints::internalPoints()
|
pFlow::internalPoints::internalPoints()
|
||||||
:
|
:
|
||||||
|
subscriber("internalPoints"),
|
||||||
pointPosition_("internalPoints", "internalPoints", initialCapacity_, 0, RESERVE()),
|
pointPosition_("internalPoints", "internalPoints", initialCapacity_, 0, RESERVE()),
|
||||||
pFlagsD_(initialCapacity_, 0 , 0)
|
pFlagsD_(initialCapacity_, 0 , 0)
|
||||||
{
|
{
|
||||||
@ -162,9 +158,10 @@ pFlow::internalPoints::internalPoints()
|
|||||||
|
|
||||||
pFlow::internalPoints::internalPoints
|
pFlow::internalPoints::internalPoints
|
||||||
(
|
(
|
||||||
const std::vector<realx3>& posVec
|
const realx3Vector& posVec
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
subscriber("internalPoints"),
|
||||||
pointPosition_("internalPoints", "internalPoints", posVec.capacity(), 0, RESERVE()),
|
pointPosition_("internalPoints", "internalPoints", posVec.capacity(), 0, RESERVE()),
|
||||||
pFlagsD_(posVec.capacity(), 0, posVec.size())
|
pFlagsD_(posVec.capacity(), 0, posVec.size())
|
||||||
{
|
{
|
||||||
@ -194,14 +191,19 @@ FUNCTION_H
|
|||||||
void pFlow::internalPoints::updateFlag
|
void pFlow::internalPoints::updateFlag
|
||||||
(
|
(
|
||||||
const domain& dm,
|
const domain& dm,
|
||||||
real dist
|
const std::array<real,6>& dist
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
pFlagsD_.markDeleteInDomain
|
pFlagsD_.markPointRegions
|
||||||
(
|
(
|
||||||
dm,
|
dm,
|
||||||
pointPosition_.deviceVectorAll(),
|
pointPosition_.deviceVectorAll(),
|
||||||
dist
|
dist[0],
|
||||||
|
dist[1],
|
||||||
|
dist[2],
|
||||||
|
dist[3],
|
||||||
|
dist[4],
|
||||||
|
dist[5]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,13 +216,20 @@ bool pFlow::internalPoints::read
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
if( !pointPosition_.read(is, iotype))
|
Field<Vector, realx3 , vecAllocator<realx3>> fRead("internalPoints", "internalPoints");
|
||||||
|
|
||||||
|
if( !fRead.read(is, iotype))
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<
|
fatalErrorInFunction<<
|
||||||
"Error in reading pointPosition from stream "<< is.name()<<endl;
|
"Error in reading pointPosition from stream "<< is.name()<<endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// here there should be some mechanism for field distribution between procesors
|
||||||
|
|
||||||
|
|
||||||
|
pointPosition_.assign(fRead.vectorField());
|
||||||
|
|
||||||
pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size());
|
pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size());
|
||||||
pFlagSync_ = false;
|
pFlagSync_ = false;
|
||||||
syncPFlag();
|
syncPFlag();
|
||||||
|
@ -17,29 +17,23 @@ Licence:
|
|||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __internalPoints_hpp__
|
#ifndef __internalPoints_hpp__
|
||||||
#define __internalPoints_hpp__
|
#define __internalPoints_hpp__
|
||||||
|
|
||||||
|
#include "subscriber.hpp"
|
||||||
|
#include "Vectors.hpp"
|
||||||
#include "Fields.hpp"
|
#include "Fields.hpp"
|
||||||
#include "pointFlag.hpp"
|
#include "pointFlag.hpp"
|
||||||
|
|
||||||
|
|
||||||
//#include "indexContainer.hpp"
|
//#include "indexContainer.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
//forward
|
|
||||||
/*class box;
|
|
||||||
class setFieldList;
|
|
||||||
class repository;*/
|
|
||||||
|
|
||||||
class internalPoints
|
class internalPoints
|
||||||
|
:
|
||||||
|
public subscriber
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -47,11 +41,11 @@ public:
|
|||||||
|
|
||||||
using pointsType = realx3Field_D;
|
using pointsType = realx3Field_D;
|
||||||
|
|
||||||
using device_type = typename pointsType::deviceType;
|
using device_type = typename pointsType::device_type;
|
||||||
|
|
||||||
using memory_space = typename pointsType::memorySpace;
|
using memory_space = typename pointsType::memory_space;
|
||||||
|
|
||||||
using execution_space = typename pointsType::executionSpace;
|
using execution_space = typename pointsType::execution_space;
|
||||||
|
|
||||||
using pFlagTypeDevice = pointFlag<execution_space>;
|
using pFlagTypeDevice = pointFlag<execution_space>;
|
||||||
|
|
||||||
@ -62,22 +56,25 @@ protected:
|
|||||||
|
|
||||||
//// - data members
|
//// - data members
|
||||||
|
|
||||||
// position of points on device
|
/// Position of points on device
|
||||||
realx3Field_D pointPosition_;
|
realx3Field_D pointPosition_;
|
||||||
|
|
||||||
// flag of points on device
|
/// flag of points on device
|
||||||
mutable pFlagTypeDevice pFlagsD_;
|
mutable pFlagTypeDevice pFlagsD_;
|
||||||
|
|
||||||
mutable pFlagTypeHost pFlagsH_;
|
/// flag of points on host
|
||||||
|
mutable pFlagTypeHost pFlagsH_;
|
||||||
|
|
||||||
mutable bool pFlagSync_ = false;
|
/// if both host and device flags sync
|
||||||
|
mutable bool pFlagSync_ = false;
|
||||||
|
|
||||||
|
//// - protected members
|
||||||
|
|
||||||
void syncPFlag()const;
|
void syncPFlag()const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
friend class dynamicinternalPoints;
|
//friend class dynamicinternalPoints;
|
||||||
|
|
||||||
// - type info
|
// - type info
|
||||||
TypeInfo("internalPoints");
|
TypeInfo("internalPoints");
|
||||||
@ -88,23 +85,21 @@ public:
|
|||||||
// - an empty internalPoints, good for reading from file
|
// - an empty internalPoints, good for reading from file
|
||||||
internalPoints();
|
internalPoints();
|
||||||
|
|
||||||
/// Construct from components
|
|
||||||
//internalPoints(const int8Vector& flgVec, const realx3Vector& posVec);
|
|
||||||
|
|
||||||
/// Construct from point positions, assume all points are active
|
/// Construct from point positions, assume all points are active
|
||||||
internalPoints(const std::vector<realx3>& posVec);
|
internalPoints(const realx3Vector& posVec);
|
||||||
|
|
||||||
/// Copy construct
|
/// No Copy construct
|
||||||
internalPoints(const internalPoints&) = default;
|
internalPoints(const internalPoints&) = delete;
|
||||||
|
|
||||||
/// Move construct
|
/// Move construct
|
||||||
internalPoints(internalPoints&&) = default;
|
internalPoints(internalPoints&&) = default;
|
||||||
|
|
||||||
/// Copy assignment
|
/// No Copy assignment
|
||||||
internalPoints& operator=(const internalPoints&) = default;
|
internalPoints& operator=(const internalPoints&) = delete;
|
||||||
|
|
||||||
/// Move assignment
|
/// Move assignment
|
||||||
internalPoints& operator=(internalPoints&&) = delete;
|
internalPoints& operator=(internalPoints&&) = default;
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
virtual ~internalPoints() = default;
|
virtual ~internalPoints() = default;
|
||||||
@ -116,7 +111,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
FUNCTION_H
|
FUNCTION_H
|
||||||
const pFlagTypeHost& activePointsMaskH()const;
|
const pFlagTypeHost& activePointsMaskH()const;
|
||||||
|
|
||||||
// - Const access pointPosition
|
// - Const access pointPosition
|
||||||
FUNCTION_H
|
FUNCTION_H
|
||||||
@ -166,7 +161,9 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
FUNCTION_H
|
FUNCTION_H
|
||||||
void updateFlag(const domain& dm, real dist);
|
void updateFlag(
|
||||||
|
const domain& dm,
|
||||||
|
const std::array<real,6>& dist);
|
||||||
|
|
||||||
/*FUNCTION_H
|
/*FUNCTION_H
|
||||||
size_t markDeleteOutOfBox(const box& domain);*/
|
size_t markDeleteOutOfBox(const box& domain);*/
|
||||||
@ -227,6 +224,7 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline
|
||||||
iOstream& operator<<(iOstream& os, const internalPoints& ip)
|
iOstream& operator<<(iOstream& os, const internalPoints& ip)
|
||||||
{
|
{
|
||||||
if( !ip.write(os, IOPattern::AllProcessorsDifferent) )
|
if( !ip.write(os, IOPattern::AllProcessorsDifferent) )
|
||||||
|
540
src/phasicFlow/structuredData/pointStructure/pStcutold.txt
Normal file
540
src/phasicFlow/structuredData/pointStructure/pStcutold.txt
Normal file
@ -0,0 +1,540 @@
|
|||||||
|
#include "pointStructureKernels.hpp"
|
||||||
|
#include "setFieldList.hpp"
|
||||||
|
#include "error.hpp"
|
||||||
|
#include "iOstream.hpp"
|
||||||
|
//#include "Time.hpp"
|
||||||
|
#include "mortonIndexing.hpp"
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool pFlow::pointStructure::evaluatePointStructure()
|
||||||
|
{
|
||||||
|
if(pointFlag_.size() != pointPosition_.size())
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"number of elements in pointFlag and pointPosition is not equal \n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setNumMaxPoints();
|
||||||
|
|
||||||
|
int32 minActive, maxActive;
|
||||||
|
numActivePoints_ = pFlow::pointStructureKernels::scanPointFlag(
|
||||||
|
0,
|
||||||
|
numPoints_,
|
||||||
|
static_cast<int8>(pointStructure::ACTIVE),
|
||||||
|
pointFlag_.deviceVectorAll(),
|
||||||
|
minActive,
|
||||||
|
maxActive
|
||||||
|
);
|
||||||
|
|
||||||
|
activeRange_ = {minActive, maxActive};
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
void pFlow::pointStructure::setNumMaxPoints()
|
||||||
|
{
|
||||||
|
maxPoints_ = pointFlag_.capacity();
|
||||||
|
numPoints_ = pointFlag_.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
pFlow::realx3Field_D& pFlow::pointStructure::pointPosition()
|
||||||
|
{
|
||||||
|
return pointPosition_;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
pFlow::int8Field_HD& pFlow::pointStructure::pointFlag()
|
||||||
|
{
|
||||||
|
return pointFlag_;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::uniquePtr<pFlow::int32IndexContainer>
|
||||||
|
pFlow::pointStructure::getNewPointsIndices(int32 numNewPoints)const
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if( capacity() - activeRange_.second >= numNewPoints )
|
||||||
|
{
|
||||||
|
// fill the sequence starting from activeRange_.second-1
|
||||||
|
return makeUnique<int32IndexContainer>(
|
||||||
|
activeRange_.second,
|
||||||
|
activeRange_.second+numNewPoints);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// second, check if there is space at the beginning
|
||||||
|
if( activeRange_.first >= numNewPoints)
|
||||||
|
{
|
||||||
|
return makeUnique<int32IndexContainer>(
|
||||||
|
0,
|
||||||
|
numNewPoints);
|
||||||
|
}
|
||||||
|
|
||||||
|
// otherwise scan the points from first to the end to find empty spaces
|
||||||
|
int32Vector newPoints(
|
||||||
|
numNewPoints,
|
||||||
|
RESERVE());
|
||||||
|
|
||||||
|
newPoints.clear();
|
||||||
|
int32 numAdded = 0;
|
||||||
|
ForAll(i, pointFlag_)
|
||||||
|
{
|
||||||
|
if(!isActive(i))
|
||||||
|
{
|
||||||
|
newPoints.push_back(static_cast<int32>(i));
|
||||||
|
numAdded++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(numAdded == numNewPoints)
|
||||||
|
{
|
||||||
|
return makeUnique<int32IndexContainer>(
|
||||||
|
newPoints.data(),
|
||||||
|
numNewPoints);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if there is space at the end for the remaining of points
|
||||||
|
if( numAdded <numNewPoints && capacity() - size() >= numNewPoints - numAdded )
|
||||||
|
{
|
||||||
|
int32 ind = size();
|
||||||
|
for(int32 i=numAdded; i<numNewPoints; i++)
|
||||||
|
{
|
||||||
|
newPoints.push_back(ind);
|
||||||
|
ind++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return makeUnique<int32IndexContainer>(
|
||||||
|
newPoints.data(),
|
||||||
|
numNewPoints);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"not enough capacity for inserting particles into the point structure\n";
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::pointStructure::pointStructure()
|
||||||
|
:
|
||||||
|
eventSubscriber(),
|
||||||
|
pointFlag_("pointFlag", "pointFlag", maxPoints_, 0 , RESERVE()),
|
||||||
|
pointPosition_("pointPosition", "pointPosition", maxPoints_, 0, RESERVE()),
|
||||||
|
activeRange_(0,0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
pFlow::pointStructure::pointStructure
|
||||||
|
(
|
||||||
|
const int8Vector& flgVec,
|
||||||
|
const realx3Vector& posVec
|
||||||
|
)
|
||||||
|
:
|
||||||
|
eventSubscriber(),
|
||||||
|
maxPoints_(posVec.capacity()),
|
||||||
|
pointFlag_("pointFlag", "pointFlag", maxPoints_, 0 , RESERVE()),
|
||||||
|
pointPosition_("pointPosition", "pointPosition", maxPoints_, 0, RESERVE()),
|
||||||
|
activeRange_(0,0)
|
||||||
|
{
|
||||||
|
|
||||||
|
pointFlag_.assign(flgVec);
|
||||||
|
|
||||||
|
pointPosition_.assign(posVec);
|
||||||
|
|
||||||
|
if( !evaluatePointStructure() )
|
||||||
|
{
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::pointStructure::pointStructure
|
||||||
|
(
|
||||||
|
const realx3Vector& posVec
|
||||||
|
)
|
||||||
|
:
|
||||||
|
eventSubscriber(),
|
||||||
|
maxPoints_(posVec.capacity()),
|
||||||
|
pointFlag_("pointFlag", "pointFlag", maxPoints_, 0 , RESERVE()),
|
||||||
|
pointPosition_("pointPosition", "pointPosition", maxPoints_, 0, RESERVE()),
|
||||||
|
activeRange_(0,0)
|
||||||
|
{
|
||||||
|
|
||||||
|
pointPosition_.assign(posVec);
|
||||||
|
|
||||||
|
pointFlag_.resize(pointPosition_.size(), static_cast<int8>(pointStructure::ACTIVE) );
|
||||||
|
//pointFlag_.syncViews();
|
||||||
|
|
||||||
|
if( !evaluatePointStructure() )
|
||||||
|
{
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
const pFlow::realx3Field_D& pFlow::pointStructure::pointPosition()const
|
||||||
|
{
|
||||||
|
return pointPosition_;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
const pFlow::int8Field_HD& pFlow::pointStructure::pointFlag()const
|
||||||
|
{
|
||||||
|
return pointFlag_;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - size of data structure
|
||||||
|
FUNCTION_H
|
||||||
|
pFlow::label pFlow::pointStructure::size()const
|
||||||
|
{
|
||||||
|
return numPoints_;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
pFlow::label pFlow::pointStructure::capacity()const
|
||||||
|
{
|
||||||
|
return maxPoints_;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
pFlow::label pFlow::pointStructure::numActive() const
|
||||||
|
{
|
||||||
|
return numActivePoints_;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool pFlow::pointStructure::allActive()const
|
||||||
|
{
|
||||||
|
return numActivePoints_ == numPoints_;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool pFlow::pointStructure::mortonSortPoints(const box& domain, real dx)
|
||||||
|
{
|
||||||
|
if( !getSortedIndex(
|
||||||
|
domain,
|
||||||
|
dx,
|
||||||
|
activeRange_,
|
||||||
|
pointPosition_.deviceVectorAll(),
|
||||||
|
pointFlag_.deviceVectorAll(),
|
||||||
|
mortonSortedIndex_) )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"failed to perform morton sorting!"<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pointPosition_.sortItems(mortonSortedIndex_);
|
||||||
|
pointFlag_.sortItems(mortonSortedIndex_);
|
||||||
|
|
||||||
|
auto oldSize = size();
|
||||||
|
auto oldCapacity = capacity();
|
||||||
|
auto oldRange = activeRange();
|
||||||
|
|
||||||
|
// update size, range, capacity
|
||||||
|
setNumMaxPoints();
|
||||||
|
activeRange_ = {0, static_cast<int>(mortonSortedIndex_.size())};
|
||||||
|
numActivePoints_ = mortonSortedIndex_.size();
|
||||||
|
|
||||||
|
eventMessage msg(eventMessage::REARRANGE);
|
||||||
|
|
||||||
|
if(oldSize != size() )
|
||||||
|
{
|
||||||
|
msg.add(eventMessage::SIZE_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(oldCapacity != capacity())
|
||||||
|
{
|
||||||
|
msg.add(eventMessage::CAP_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( oldRange != activeRange_)
|
||||||
|
{
|
||||||
|
msg.add(eventMessage::RANGE_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
// notify all the registered objects except the exclusionList
|
||||||
|
if( !this->notify(msg) ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
size_t pFlow::pointStructure::markDeleteOutOfBox(const box& domain)
|
||||||
|
{
|
||||||
|
if(numPoints_==0) return 0;
|
||||||
|
|
||||||
|
int32 minRange, maxRange;
|
||||||
|
int32 numMarked =
|
||||||
|
pFlow::pointStructureKernels::markDeleteOutOfBox(
|
||||||
|
domain,
|
||||||
|
activeRange_.first,
|
||||||
|
activeRange_.second,
|
||||||
|
pointStructure::DELETED,
|
||||||
|
pointPosition_.deviceVectorAll(),
|
||||||
|
pointFlag_.deviceVectorAll(),
|
||||||
|
activePointsMaskD(),
|
||||||
|
minRange, maxRange );
|
||||||
|
|
||||||
|
if(numMarked)
|
||||||
|
{
|
||||||
|
pointFlag_.modifyOnDevice();
|
||||||
|
pointFlag_.syncViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( numMarked<=numActivePoints_)
|
||||||
|
{
|
||||||
|
numActivePoints_ -= numMarked;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"number of points marked as delete ("<<numMarked<<
|
||||||
|
") is greater than the activePoints ("<<numActivePoints_<<
|
||||||
|
").\n";
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
|
||||||
|
range newRange = {minRange, maxRange};
|
||||||
|
|
||||||
|
if( activeRange_ != newRange )
|
||||||
|
{
|
||||||
|
activeRange_ = newRange;
|
||||||
|
eventMessage msg(eventMessage::RANGE_CHANGED);
|
||||||
|
|
||||||
|
// notify all the registered objects about active range change
|
||||||
|
if( !this->notify(msg) )
|
||||||
|
{
|
||||||
|
fatalExit<<
|
||||||
|
"something went wrong in notifying registered object about range change. \n";
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return numMarked;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool pFlow::pointStructure::updateForDelete()
|
||||||
|
{
|
||||||
|
notImplementedFunction;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*FUNCTION_H
|
||||||
|
pFlow::uniquePtr<pFlow::int32IndexContainer> pFlow::pointStructure::insertPoints
|
||||||
|
(
|
||||||
|
const realx3Vector& pos,
|
||||||
|
const setFieldList& setField,
|
||||||
|
repository& owner,
|
||||||
|
const List<eventObserver*>& exclusionList
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
auto numNew = pos.size();
|
||||||
|
if( numNew==0)
|
||||||
|
{
|
||||||
|
return makeUnique<int32IndexContainer>();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto newPointsPtr = getNewPointsIndices( numNew );
|
||||||
|
|
||||||
|
if(!newPointsPtr)return nullptr;
|
||||||
|
|
||||||
|
auto oldSize = size();
|
||||||
|
auto oldCapacity = capacity();
|
||||||
|
auto oldRange = activeRange();
|
||||||
|
|
||||||
|
tobeInsertedIndex_ = newPointsPtr();
|
||||||
|
|
||||||
|
// set the position of new points
|
||||||
|
|
||||||
|
if(!pointPosition_.insertSetElement(
|
||||||
|
newPointsPtr(),
|
||||||
|
pos)
|
||||||
|
)return nullptr;
|
||||||
|
|
||||||
|
|
||||||
|
if(!pointFlag_.insertSetElement(
|
||||||
|
newPointsPtr(),
|
||||||
|
static_cast<int8>(PointFlag::ACTIVE))
|
||||||
|
)return nullptr;
|
||||||
|
|
||||||
|
|
||||||
|
setNumMaxPoints();
|
||||||
|
auto minInd = newPointsPtr().min();
|
||||||
|
auto maxInd = newPointsPtr().max();
|
||||||
|
|
||||||
|
|
||||||
|
List<eventObserver*> localExlusion(exclusionList);
|
||||||
|
|
||||||
|
for(auto sfEntry:setField)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(void* fieldPtr =
|
||||||
|
sfEntry.setPointFieldSelectedAll(
|
||||||
|
owner,
|
||||||
|
newPointsPtr(),
|
||||||
|
false );
|
||||||
|
fieldPtr)
|
||||||
|
|
||||||
|
localExlusion.push_back(
|
||||||
|
static_cast<eventObserver*>(fieldPtr)
|
||||||
|
);
|
||||||
|
else
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// changes the active rage based on the new inserted points
|
||||||
|
activeRange_ = { static_cast<int>(min(activeRange_.first, minInd )),
|
||||||
|
static_cast<int>(max(activeRange_.second, maxInd+1))};
|
||||||
|
|
||||||
|
numActivePoints_ += numNew;
|
||||||
|
|
||||||
|
eventMessage msg(eventMessage::INSERT);
|
||||||
|
|
||||||
|
if( oldRange != activeRange_ )
|
||||||
|
msg.add(eventMessage::RANGE_CHANGED);
|
||||||
|
|
||||||
|
if( oldSize != size() )
|
||||||
|
msg.add(eventMessage::SIZE_CHANGED);
|
||||||
|
|
||||||
|
if( oldCapacity != capacity() )
|
||||||
|
msg.add(eventMessage::CAP_CHANGED);
|
||||||
|
|
||||||
|
// notify all the registered objects except the exclusionList
|
||||||
|
if( !this->notify(msg, localExlusion) ) return nullptr;
|
||||||
|
|
||||||
|
return newPointsPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*FUNCTION_H
|
||||||
|
bool pFlow::pointStructure::readPointStructure
|
||||||
|
(
|
||||||
|
iIstream& is
|
||||||
|
)
|
||||||
|
{
|
||||||
|
auto psCapacity = is.lookupDataOrSet("pointStructureCapacity", maxSizeDefault_);
|
||||||
|
pointPosition_.reallocate(psCapacity);
|
||||||
|
pointFlag_.reallocate(psCapacity);
|
||||||
|
|
||||||
|
if( !pointPosition_.read(is))
|
||||||
|
{
|
||||||
|
ioErrorInFile(is.name(), is.lineNumber())<<
|
||||||
|
"Error in reading pointPosition in pointStructure \n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(! pointFlag_.read(is, true))
|
||||||
|
{
|
||||||
|
ioErrorInFile(is.name(), is.lineNumber())<<
|
||||||
|
"Error in reading pointFlag in pointStructure \n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return evaluatePointStructure();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/*FUNCTION_H
|
||||||
|
bool pFlow::pointStructure::writePointStructure
|
||||||
|
(
|
||||||
|
iOstream& os
|
||||||
|
)const
|
||||||
|
{
|
||||||
|
os.writeWordEntry("pointStructureCapacity", maxPoints_);
|
||||||
|
|
||||||
|
if(!pointPosition_.write(os))
|
||||||
|
{
|
||||||
|
ioErrorInFile(os.name(), os.lineNumber())<<
|
||||||
|
"error in writing pointPosition to file \n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!pointFlag_.write(os))
|
||||||
|
{
|
||||||
|
ioErrorInFile(os.name(), os.lineNumber())<<
|
||||||
|
"error in writing pointFlag to file \n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
/*pFlow::uniquePtr<pFlow::int32Vector>
|
||||||
|
pFlow::pointStructure::newPointsIndices(
|
||||||
|
int32 numNewPoints
|
||||||
|
)const
|
||||||
|
{
|
||||||
|
|
||||||
|
auto newPointsPtr = makeUnique<int32Vector>(
|
||||||
|
"pointStructure::newPointsPtr",
|
||||||
|
numNewPoints);
|
||||||
|
|
||||||
|
auto& newPoints = newPointsPtr();
|
||||||
|
|
||||||
|
|
||||||
|
// first, check if there is space at the end
|
||||||
|
if( capacity() - activeRange_.second >= numNewPoints )
|
||||||
|
{
|
||||||
|
// fill the sequence starting from activeRange_.second-1
|
||||||
|
fillSequence(newPoints, activeRange_.second-1);
|
||||||
|
return newPointsPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// second, check if there is space at the beggining
|
||||||
|
if( activeRange_.first >= numNewPoints)
|
||||||
|
{
|
||||||
|
// fill the sequence starting from 0
|
||||||
|
fillSequence(newPoints, 0);
|
||||||
|
return newPointsPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// otherwise scan the points from first to the end to find empty spaces
|
||||||
|
newPoints.clear();
|
||||||
|
int32 numAdded = 0;
|
||||||
|
ForAll(i, pointFlag_)
|
||||||
|
{
|
||||||
|
if(!isActive(i))
|
||||||
|
{
|
||||||
|
newPoints.push_back(static_cast<int32>(i));
|
||||||
|
numAdded++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(numAdded == numNewPoints)
|
||||||
|
{
|
||||||
|
|
||||||
|
return newPointsPtr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if there is space at the end for the remaining of points
|
||||||
|
if( capacity() - size() >= numNewPoints - numAdded )
|
||||||
|
{
|
||||||
|
int32 ind = size();
|
||||||
|
for(int32 i=numAdded; i<numNewPoints; i++)
|
||||||
|
{
|
||||||
|
newPoints.push_back(ind);
|
||||||
|
ind++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return newPointsPtr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"not enough capacity for inserting particles into the point structure\n";
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
pFlow::pointStructure::pointStructure(const dictionary &domainDict)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -24,12 +24,9 @@ Licence:
|
|||||||
#include "phasicFlowKokkos.hpp"
|
#include "phasicFlowKokkos.hpp"
|
||||||
#include "domain.hpp"
|
#include "domain.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
template<typename ExecutionSpace>
|
template<typename ExecutionSpace>
|
||||||
class pointFlag
|
class pointFlag
|
||||||
{
|
{
|
||||||
@ -61,7 +58,7 @@ protected:
|
|||||||
|
|
||||||
rangeU32 activeRange_ = {0,0};
|
rangeU32 activeRange_ = {0,0};
|
||||||
|
|
||||||
bool isAllActive_ = false;
|
bool isAllActive_ = false;
|
||||||
|
|
||||||
uint32 nLeft_ = 0;
|
uint32 nLeft_ = 0;
|
||||||
|
|
||||||
@ -161,35 +158,19 @@ public:
|
|||||||
return flg > INTERNAL;
|
return flg > INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
bool isLeft(uint32 i)const
|
|
||||||
{
|
|
||||||
return (flags_[i]&LEFT) == LEFT;
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
bool isLeft(uint8 flg)const
|
bool isLeft(uint8 flg)const
|
||||||
{
|
{
|
||||||
return (flg&LEFT) == LEFT;
|
return (flg&LEFT) == LEFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
bool isRight(uint32 i)const
|
|
||||||
{
|
|
||||||
return (flags_[i]&&RIGHT) == RIGHT;
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
bool isRight(uint8 flg)const
|
bool isRight(uint8 flg)const
|
||||||
{
|
{
|
||||||
return (flg&&RIGHT) == RIGHT;
|
return (flg&&RIGHT) == RIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
bool isBottom(uint32 i)const
|
|
||||||
{
|
|
||||||
return (flags_[i]&&BOTTOM) == BOTTOM;
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
bool isBottom(uint8 flg)const
|
bool isBottom(uint8 flg)const
|
||||||
@ -197,43 +178,24 @@ public:
|
|||||||
return (flg&&BOTTOM) == BOTTOM;
|
return (flg&&BOTTOM) == BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
bool isTop(uint32 i)const
|
|
||||||
{
|
|
||||||
return (flags_[i]&&TOP) == TOP;
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
bool isTop(uint8 flg)const
|
bool isTop(uint8 flg)const
|
||||||
{
|
{
|
||||||
return (flg&&TOP) == TOP;
|
return (flg&&TOP) == TOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
bool isRear(uint32 i)const
|
|
||||||
{
|
|
||||||
return (flags_[i]&&REAR) == REAR;
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
bool isRear(uint8 flg)const
|
bool isRear(uint8 flg)const
|
||||||
{
|
{
|
||||||
return (flg&&REAR) == REAR;
|
return (flg&&REAR) == REAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
bool isFront(uint32 i)const
|
|
||||||
{
|
|
||||||
return (flags_[i]&&FRONT) == FRONT;
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
bool isFront(uint8 flg)const
|
bool isFront(uint8 flg)const
|
||||||
{
|
{
|
||||||
return (flg&&FRONT) == FRONT;
|
return (flg&&FRONT) == FRONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename ExeSpace>
|
template<typename ExeSpace>
|
||||||
pointFlag<ExeSpace> clone()const
|
pointFlag<ExeSpace> clone()const
|
||||||
{
|
{
|
||||||
@ -254,10 +216,15 @@ public:
|
|||||||
|
|
||||||
uint32 scanPointFlag();
|
uint32 scanPointFlag();
|
||||||
|
|
||||||
uint32 markDeleteInDomain(
|
uint32 markPointRegions(
|
||||||
domain dm,
|
domain dm,
|
||||||
ViewType1D<realx3, memory_space> points,
|
ViewType1D<realx3, memory_space> points,
|
||||||
real dist);
|
real leftLength,
|
||||||
|
real rightLength,
|
||||||
|
real bottomLength,
|
||||||
|
real topLength,
|
||||||
|
real rearLength,
|
||||||
|
real frontLength);
|
||||||
|
|
||||||
void fillNeighborsLists(
|
void fillNeighborsLists(
|
||||||
ViewType1D<uint32, memory_space> leftList,
|
ViewType1D<uint32, memory_space> leftList,
|
||||||
@ -267,6 +234,12 @@ public:
|
|||||||
ViewType1D<uint32, memory_space> rearList,
|
ViewType1D<uint32, memory_space> rearList,
|
||||||
ViewType1D<uint32, memory_space> frontList);
|
ViewType1D<uint32, memory_space> frontList);
|
||||||
|
|
||||||
|
uint32 markDelete(
|
||||||
|
const plane& pln,
|
||||||
|
ViewType1D<realx3, memory_space> points,
|
||||||
|
ViewType1D<uint32, memory_space> indices,
|
||||||
|
ViewType1D<uint32, memory_space> onOff);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -81,11 +81,16 @@ pFlow::uint32 pFlow::pointFlag<ExecutionSpace>::scanPointFlag()
|
|||||||
|
|
||||||
|
|
||||||
template<typename ExecutionSpace>
|
template<typename ExecutionSpace>
|
||||||
pFlow::uint32 pFlow::pointFlag<ExecutionSpace>::markDeleteInDomain
|
pFlow::uint32 pFlow::pointFlag<ExecutionSpace>::markPointRegions
|
||||||
(
|
(
|
||||||
domain dm,
|
domain dm,
|
||||||
ViewType1D<realx3, memory_space> points,
|
ViewType1D<realx3, memory_space> points,
|
||||||
real dist)
|
real leftLength,
|
||||||
|
real rightLength,
|
||||||
|
real bottomLength,
|
||||||
|
real topLength,
|
||||||
|
real rearLength,
|
||||||
|
real frontLength)
|
||||||
{
|
{
|
||||||
|
|
||||||
using rpMark = Kokkos::RangePolicy<execution_space,
|
using rpMark = Kokkos::RangePolicy<execution_space,
|
||||||
@ -134,37 +139,37 @@ pFlow::uint32 pFlow::pointFlag<ExecutionSpace>::markDeleteInDomain
|
|||||||
minUpdate = min(minUpdate,i);
|
minUpdate = min(minUpdate,i);
|
||||||
maxUpdate = max(maxUpdate,i);
|
maxUpdate = max(maxUpdate,i);
|
||||||
|
|
||||||
if(dm.left().inPositiveDistance(p, dist))
|
if(dm.left().inPositiveDistance(p, leftLength))
|
||||||
{
|
{
|
||||||
flg += LEFT;
|
flg += LEFT;
|
||||||
valLeft++;
|
valLeft++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dm.right().inPositiveDistance(p, dist))
|
if(dm.right().inPositiveDistance(p, rightLength))
|
||||||
{
|
{
|
||||||
flg += RIGHT;
|
flg += RIGHT;
|
||||||
valRight++;
|
valRight++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dm.bottom().inPositiveDistance(p, dist))
|
if(dm.bottom().inPositiveDistance(p, bottomLength))
|
||||||
{
|
{
|
||||||
flg += BOTTOM;
|
flg += BOTTOM;
|
||||||
valBottom++;
|
valBottom++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dm.top().inPositiveDistance(p, dist))
|
if(dm.top().inPositiveDistance(p, topLength))
|
||||||
{
|
{
|
||||||
flg += TOP;
|
flg += TOP;
|
||||||
valTop++;
|
valTop++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dm.rear().inPositiveDistance(p, dist))
|
if(dm.rear().inPositiveDistance(p, rearLength))
|
||||||
{
|
{
|
||||||
flg += REAR;
|
flg += REAR;
|
||||||
valRear++;
|
valRear++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dm.front().inPositiveDistance(p, dist))
|
if(dm.front().inPositiveDistance(p, frontLength))
|
||||||
{
|
{
|
||||||
flg += FRONT;
|
flg += FRONT;
|
||||||
valFront++;
|
valFront++;
|
||||||
@ -257,4 +262,76 @@ void pFlow::pointFlag<ExecutionSpace>::fillNeighborsLists
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename ExecutionSpace>
|
||||||
|
pFlow::uint32 pFlow::pointFlag<ExecutionSpace>::markDelete
|
||||||
|
(
|
||||||
|
const plane& pln,
|
||||||
|
ViewType1D<realx3, memory_space> points,
|
||||||
|
ViewType1D<uint32, memory_space> indices,
|
||||||
|
ViewType1D<uint32, memory_space> onOff
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// if it is empty, do nothing
|
||||||
|
if(indices.size() == 0 )return 0;
|
||||||
|
|
||||||
|
using rpMark = Kokkos::RangePolicy<execution_space,
|
||||||
|
Kokkos::IndexType<uint32>>;
|
||||||
|
|
||||||
|
uint32 start = activeRange().start();
|
||||||
|
uint32 end = activeRange().end();
|
||||||
|
|
||||||
|
uint32 minRange = end;
|
||||||
|
uint32 maxRange = start;
|
||||||
|
|
||||||
|
uint32 numMarked = 0;
|
||||||
|
|
||||||
|
if(start<end)
|
||||||
|
{
|
||||||
|
Kokkos::parallel_reduce(
|
||||||
|
"pointFlagKernels::markDelete",
|
||||||
|
rpScanFlag(0, indices.size()),
|
||||||
|
CLASS_LAMBDA_HD(
|
||||||
|
uint32 i,
|
||||||
|
uint32& minUpdate,
|
||||||
|
uint32& maxUpdate,
|
||||||
|
uint32& sumToUpdate)
|
||||||
|
{
|
||||||
|
auto indx = indices(i);
|
||||||
|
|
||||||
|
if( pln.pointInNegativeSide(points(indx)))
|
||||||
|
{
|
||||||
|
flags_[indx] = DELETED;
|
||||||
|
sumToUpdate++;
|
||||||
|
onOff[i] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
minUpdate = min(minUpdate,i);
|
||||||
|
maxUpdate = max(maxUpdate,i);
|
||||||
|
onOff[i] = 1;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Kokkos::Min<uint32>(minRange),
|
||||||
|
Kokkos::Max<uint32>(maxRange),
|
||||||
|
numMarked);
|
||||||
|
}
|
||||||
|
|
||||||
|
// means either range was empty or all points have been deleted.
|
||||||
|
if(minRange<start || maxRange>end)
|
||||||
|
{
|
||||||
|
minRange = 0;
|
||||||
|
maxRange = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
maxRange++; // add one to make it half
|
||||||
|
}
|
||||||
|
|
||||||
|
activeRange_ = {minRange, maxRange};
|
||||||
|
isAllActive_ = isAllActive_ && numMarked == 0;
|
||||||
|
numActive_ -= numMarked;
|
||||||
|
|
||||||
|
return numMarked;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // __pointFlagKernels_hpp__
|
#endif // __pointFlagKernels_hpp__
|
||||||
|
@ -18,540 +18,128 @@ Licence:
|
|||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
#include "pointStructure.hpp"
|
#include "pointStructure.hpp"
|
||||||
#include "pointStructureKernels.hpp"
|
#include "simulationDomain.hpp"
|
||||||
#include "setFieldList.hpp"
|
|
||||||
#include "error.hpp"
|
|
||||||
#include "iOstream.hpp"
|
|
||||||
//#include "Time.hpp"
|
|
||||||
#include "mortonIndexing.hpp"
|
|
||||||
|
|
||||||
FUNCTION_H
|
#include "streams.hpp"
|
||||||
bool pFlow::pointStructure::evaluatePointStructure()
|
|
||||||
{
|
|
||||||
if(pointFlag_.size() != pointPosition_.size())
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<
|
|
||||||
"number of elements in pointFlag and pointPosition is not equal \n";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
setNumMaxPoints();
|
pFlow::pointStructure::pointStructure
|
||||||
|
(
|
||||||
int32 minActive, maxActive;
|
const dictionary& domainDict
|
||||||
numActivePoints_ = pFlow::pointStructureKernels::scanPointFlag(
|
)
|
||||||
0,
|
|
||||||
numPoints_,
|
|
||||||
static_cast<int8>(pointStructure::ACTIVE),
|
|
||||||
pointFlag_.deviceVectorAll(),
|
|
||||||
minActive,
|
|
||||||
maxActive
|
|
||||||
);
|
|
||||||
|
|
||||||
activeRange_ = {minActive, maxActive};
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
void pFlow::pointStructure::setNumMaxPoints()
|
|
||||||
{
|
|
||||||
maxPoints_ = pointFlag_.capacity();
|
|
||||||
numPoints_ = pointFlag_.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
pFlow::realx3Field_D& pFlow::pointStructure::pointPosition()
|
|
||||||
{
|
|
||||||
return pointPosition_;
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
pFlow::int8Field_HD& pFlow::pointStructure::pointFlag()
|
|
||||||
{
|
|
||||||
return pointFlag_;
|
|
||||||
}
|
|
||||||
|
|
||||||
pFlow::uniquePtr<pFlow::int32IndexContainer>
|
|
||||||
pFlow::pointStructure::getNewPointsIndices(int32 numNewPoints)const
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
if( capacity() - activeRange_.second >= numNewPoints )
|
|
||||||
{
|
|
||||||
// fill the sequence starting from activeRange_.second-1
|
|
||||||
return makeUnique<int32IndexContainer>(
|
|
||||||
activeRange_.second,
|
|
||||||
activeRange_.second+numNewPoints);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// second, check if there is space at the beginning
|
|
||||||
if( activeRange_.first >= numNewPoints)
|
|
||||||
{
|
|
||||||
return makeUnique<int32IndexContainer>(
|
|
||||||
0,
|
|
||||||
numNewPoints);
|
|
||||||
}
|
|
||||||
|
|
||||||
// otherwise scan the points from first to the end to find empty spaces
|
|
||||||
int32Vector newPoints(
|
|
||||||
numNewPoints,
|
|
||||||
RESERVE());
|
|
||||||
|
|
||||||
newPoints.clear();
|
|
||||||
int32 numAdded = 0;
|
|
||||||
ForAll(i, pointFlag_)
|
|
||||||
{
|
|
||||||
if(!isActive(i))
|
|
||||||
{
|
|
||||||
newPoints.push_back(static_cast<int32>(i));
|
|
||||||
numAdded++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(numAdded == numNewPoints)
|
|
||||||
{
|
|
||||||
return makeUnique<int32IndexContainer>(
|
|
||||||
newPoints.data(),
|
|
||||||
numNewPoints);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if there is space at the end for the remaining of points
|
|
||||||
if( numAdded <numNewPoints && capacity() - size() >= numNewPoints - numAdded )
|
|
||||||
{
|
|
||||||
int32 ind = size();
|
|
||||||
for(int32 i=numAdded; i<numNewPoints; i++)
|
|
||||||
{
|
|
||||||
newPoints.push_back(ind);
|
|
||||||
ind++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return makeUnique<int32IndexContainer>(
|
|
||||||
newPoints.data(),
|
|
||||||
numNewPoints);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<"not enough capacity for inserting particles into the point structure\n";
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
pFlow::pointStructure::pointStructure()
|
|
||||||
:
|
:
|
||||||
eventSubscriber(),
|
internalPoints(),
|
||||||
pointFlag_("pointFlag", "pointFlag", maxPoints_, 0 , RESERVE()),
|
simulationDomain_
|
||||||
pointPosition_("pointPosition", "pointPosition", maxPoints_, 0, RESERVE()),
|
(
|
||||||
activeRange_(0,0)
|
simulationDomain::create(domainDict)
|
||||||
|
),
|
||||||
|
boundaries_
|
||||||
|
(
|
||||||
|
simulationDomain_(),
|
||||||
|
*this
|
||||||
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
pFlow::pointStructure::pointStructure
|
bool pFlow::pointStructure::distributePoints
|
||||||
(
|
(
|
||||||
const int8Vector& flgVec,
|
const realx3Vector &points
|
||||||
const realx3Vector& posVec
|
|
||||||
)
|
)
|
||||||
:
|
|
||||||
eventSubscriber(),
|
|
||||||
maxPoints_(posVec.capacity()),
|
|
||||||
pointFlag_("pointFlag", "pointFlag", maxPoints_, 0 , RESERVE()),
|
|
||||||
pointPosition_("pointPosition", "pointPosition", maxPoints_, 0, RESERVE()),
|
|
||||||
activeRange_(0,0)
|
|
||||||
{
|
{
|
||||||
|
uint32 thisN = simulationDomain_->thisNumPoints();
|
||||||
pointFlag_.assign(flgVec);
|
|
||||||
|
|
||||||
pointPosition_.assign(posVec);
|
Field<Vector, realx3 , vecAllocator<realx3>> internal(
|
||||||
|
"internalPoints",
|
||||||
|
"internalPoints",
|
||||||
|
thisN,
|
||||||
|
thisN,
|
||||||
|
RESERVE());
|
||||||
|
|
||||||
|
|
||||||
|
auto l = sizeof(realx3);
|
||||||
|
auto pointsSpan = span<char>(
|
||||||
|
reinterpret_cast<char*>
|
||||||
|
(
|
||||||
|
const_cast<realx3*>(points.data())
|
||||||
|
),
|
||||||
|
points.size()*l );
|
||||||
|
|
||||||
|
auto internalSpan = span<char>(reinterpret_cast<char*>(internal.data()), internal.size()*l);
|
||||||
|
|
||||||
|
if(!simulationDomain_->transferBlockData(pointsSpan, internalSpan, l))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"Error in transfering the block data "<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pointPosition_.assign(internal.vectorField());
|
||||||
|
|
||||||
|
|
||||||
|
pFlagsD_ = pFlagTypeDevice(pointPosition_.capacity(), 0, pointPosition_.size());
|
||||||
|
pFlagSync_ = false;
|
||||||
|
syncPFlag();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
if( !evaluatePointStructure() )
|
|
||||||
{
|
|
||||||
fatalExit;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::pointStructure::pointStructure
|
pFlow::pointStructure::pointStructure(
|
||||||
|
const dictionary &domainDict,
|
||||||
|
const realx3Vector &posVec)
|
||||||
|
: internalPoints(),
|
||||||
|
simulationDomain_(
|
||||||
|
simulationDomain::create(domainDict)),
|
||||||
|
boundaries_(
|
||||||
|
simulationDomain_(),
|
||||||
|
*this)
|
||||||
|
{
|
||||||
|
if(!simulationDomain_->updateDomains(posVec) )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"Failed to update domains."<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
|
||||||
|
boundaries_.updateLists();
|
||||||
|
|
||||||
|
if( !distributePoints(posVec) )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"Faild to distributes poinst"<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool pFlow::pointStructure::read
|
||||||
(
|
(
|
||||||
const realx3Vector& posVec
|
iIstream& is,
|
||||||
|
IOPattern::IOType iotype
|
||||||
)
|
)
|
||||||
:
|
|
||||||
eventSubscriber(),
|
|
||||||
maxPoints_(posVec.capacity()),
|
|
||||||
pointFlag_("pointFlag", "pointFlag", maxPoints_, 0 , RESERVE()),
|
|
||||||
pointPosition_("pointPosition", "pointPosition", maxPoints_, 0, RESERVE()),
|
|
||||||
activeRange_(0,0)
|
|
||||||
{
|
{
|
||||||
|
Field<Vector, realx3 , vecAllocator<realx3>> fRead("file_internalPoints", "internalPoints");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pointPosition_.assign(posVec);
|
if( !fRead.read(is, iotype))
|
||||||
|
|
||||||
pointFlag_.resize(pointPosition_.size(), static_cast<int8>(pointStructure::ACTIVE) );
|
|
||||||
//pointFlag_.syncViews();
|
|
||||||
|
|
||||||
if( !evaluatePointStructure() )
|
|
||||||
{
|
|
||||||
fatalExit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
const pFlow::realx3Field_D& pFlow::pointStructure::pointPosition()const
|
|
||||||
{
|
|
||||||
return pointPosition_;
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
const pFlow::int8Field_HD& pFlow::pointStructure::pointFlag()const
|
|
||||||
{
|
|
||||||
return pointFlag_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - size of data structure
|
|
||||||
FUNCTION_H
|
|
||||||
pFlow::label pFlow::pointStructure::size()const
|
|
||||||
{
|
|
||||||
return numPoints_;
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
pFlow::label pFlow::pointStructure::capacity()const
|
|
||||||
{
|
|
||||||
return maxPoints_;
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
pFlow::label pFlow::pointStructure::numActive() const
|
|
||||||
{
|
|
||||||
return numActivePoints_;
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
bool pFlow::pointStructure::allActive()const
|
|
||||||
{
|
|
||||||
return numActivePoints_ == numPoints_;
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
bool pFlow::pointStructure::mortonSortPoints(const box& domain, real dx)
|
|
||||||
{
|
|
||||||
if( !getSortedIndex(
|
|
||||||
domain,
|
|
||||||
dx,
|
|
||||||
activeRange_,
|
|
||||||
pointPosition_.deviceVectorAll(),
|
|
||||||
pointFlag_.deviceVectorAll(),
|
|
||||||
mortonSortedIndex_) )
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<"failed to perform morton sorting!"<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
pointPosition_.sortItems(mortonSortedIndex_);
|
|
||||||
pointFlag_.sortItems(mortonSortedIndex_);
|
|
||||||
|
|
||||||
auto oldSize = size();
|
|
||||||
auto oldCapacity = capacity();
|
|
||||||
auto oldRange = activeRange();
|
|
||||||
|
|
||||||
// update size, range, capacity
|
|
||||||
setNumMaxPoints();
|
|
||||||
activeRange_ = {0, static_cast<int>(mortonSortedIndex_.size())};
|
|
||||||
numActivePoints_ = mortonSortedIndex_.size();
|
|
||||||
|
|
||||||
eventMessage msg(eventMessage::REARRANGE);
|
|
||||||
|
|
||||||
if(oldSize != size() )
|
|
||||||
{
|
|
||||||
msg.add(eventMessage::SIZE_CHANGED);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(oldCapacity != capacity())
|
|
||||||
{
|
|
||||||
msg.add(eventMessage::CAP_CHANGED);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( oldRange != activeRange_)
|
|
||||||
{
|
|
||||||
msg.add(eventMessage::RANGE_CHANGED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// notify all the registered objects except the exclusionList
|
|
||||||
if( !this->notify(msg) ) return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
size_t pFlow::pointStructure::markDeleteOutOfBox(const box& domain)
|
|
||||||
{
|
|
||||||
if(numPoints_==0) return 0;
|
|
||||||
|
|
||||||
int32 minRange, maxRange;
|
|
||||||
int32 numMarked =
|
|
||||||
pFlow::pointStructureKernels::markDeleteOutOfBox(
|
|
||||||
domain,
|
|
||||||
activeRange_.first,
|
|
||||||
activeRange_.second,
|
|
||||||
pointStructure::DELETED,
|
|
||||||
pointPosition_.deviceVectorAll(),
|
|
||||||
pointFlag_.deviceVectorAll(),
|
|
||||||
activePointsMaskD(),
|
|
||||||
minRange, maxRange );
|
|
||||||
|
|
||||||
if(numMarked)
|
|
||||||
{
|
|
||||||
pointFlag_.modifyOnDevice();
|
|
||||||
pointFlag_.syncViews();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( numMarked<=numActivePoints_)
|
|
||||||
{
|
|
||||||
numActivePoints_ -= numMarked;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<
|
fatalErrorInFunction<<
|
||||||
"number of points marked as delete ("<<numMarked<<
|
"Error in reading pointPosition from stream "<< is.name()<<endl;
|
||||||
") is greater than the activePoints ("<<numActivePoints_<<
|
|
||||||
").\n";
|
|
||||||
fatalExit;
|
|
||||||
}
|
|
||||||
|
|
||||||
range newRange = {minRange, maxRange};
|
|
||||||
|
|
||||||
if( activeRange_ != newRange )
|
|
||||||
{
|
|
||||||
activeRange_ = newRange;
|
|
||||||
eventMessage msg(eventMessage::RANGE_CHANGED);
|
|
||||||
|
|
||||||
// notify all the registered objects about active range change
|
|
||||||
if( !this->notify(msg) )
|
|
||||||
{
|
|
||||||
fatalExit<<
|
|
||||||
"something went wrong in notifying registered object about range change. \n";
|
|
||||||
fatalExit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return numMarked;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
bool pFlow::pointStructure::updateForDelete()
|
|
||||||
{
|
|
||||||
notImplementedFunction;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
pFlow::uniquePtr<pFlow::int32IndexContainer> pFlow::pointStructure::insertPoints
|
|
||||||
(
|
|
||||||
const realx3Vector& pos,
|
|
||||||
const setFieldList& setField,
|
|
||||||
repository& owner,
|
|
||||||
const List<eventObserver*>& exclusionList
|
|
||||||
)
|
|
||||||
{
|
|
||||||
|
|
||||||
auto numNew = pos.size();
|
|
||||||
if( numNew==0)
|
|
||||||
{
|
|
||||||
return makeUnique<int32IndexContainer>();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto newPointsPtr = getNewPointsIndices( numNew );
|
|
||||||
|
|
||||||
if(!newPointsPtr)return nullptr;
|
|
||||||
|
|
||||||
auto oldSize = size();
|
|
||||||
auto oldCapacity = capacity();
|
|
||||||
auto oldRange = activeRange();
|
|
||||||
|
|
||||||
tobeInsertedIndex_ = newPointsPtr();
|
|
||||||
|
|
||||||
// set the position of new points
|
|
||||||
|
|
||||||
if(!pointPosition_.insertSetElement(
|
|
||||||
newPointsPtr(),
|
|
||||||
pos)
|
|
||||||
)return nullptr;
|
|
||||||
|
|
||||||
|
|
||||||
if(!pointFlag_.insertSetElement(
|
|
||||||
newPointsPtr(),
|
|
||||||
static_cast<int8>(PointFlag::ACTIVE))
|
|
||||||
)return nullptr;
|
|
||||||
|
|
||||||
|
|
||||||
setNumMaxPoints();
|
|
||||||
auto minInd = newPointsPtr().min();
|
|
||||||
auto maxInd = newPointsPtr().max();
|
|
||||||
|
|
||||||
|
|
||||||
List<eventObserver*> localExlusion(exclusionList);
|
|
||||||
|
|
||||||
for(auto sfEntry:setField)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(void* fieldPtr =
|
|
||||||
sfEntry.setPointFieldSelectedAll(
|
|
||||||
owner,
|
|
||||||
newPointsPtr(),
|
|
||||||
false );
|
|
||||||
fieldPtr)
|
|
||||||
|
|
||||||
localExlusion.push_back(
|
|
||||||
static_cast<eventObserver*>(fieldPtr)
|
|
||||||
);
|
|
||||||
else
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// changes the active rage based on the new inserted points
|
|
||||||
activeRange_ = { static_cast<int>(min(activeRange_.first, minInd )),
|
|
||||||
static_cast<int>(max(activeRange_.second, maxInd+1))};
|
|
||||||
|
|
||||||
numActivePoints_ += numNew;
|
|
||||||
|
|
||||||
eventMessage msg(eventMessage::INSERT);
|
|
||||||
|
|
||||||
if( oldRange != activeRange_ )
|
|
||||||
msg.add(eventMessage::RANGE_CHANGED);
|
|
||||||
|
|
||||||
if( oldSize != size() )
|
|
||||||
msg.add(eventMessage::SIZE_CHANGED);
|
|
||||||
|
|
||||||
if( oldCapacity != capacity() )
|
|
||||||
msg.add(eventMessage::CAP_CHANGED);
|
|
||||||
|
|
||||||
// notify all the registered objects except the exclusionList
|
|
||||||
if( !this->notify(msg, localExlusion) ) return nullptr;
|
|
||||||
|
|
||||||
return newPointsPtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
bool pFlow::pointStructure::readPointStructure
|
|
||||||
(
|
|
||||||
iIstream& is
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto psCapacity = is.lookupDataOrSet("pointStructureCapacity", maxSizeDefault_);
|
|
||||||
pointPosition_.reallocate(psCapacity);
|
|
||||||
pointFlag_.reallocate(psCapacity);
|
|
||||||
|
|
||||||
if( !pointPosition_.read(is))
|
|
||||||
{
|
|
||||||
ioErrorInFile(is.name(), is.lineNumber())<<
|
|
||||||
"Error in reading pointPosition in pointStructure \n";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(! pointFlag_.read(is, true))
|
|
||||||
{
|
|
||||||
ioErrorInFile(is.name(), is.lineNumber())<<
|
|
||||||
"Error in reading pointFlag in pointStructure \n";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!simulationDomain_->updateDomains(fRead))
|
||||||
return evaluatePointStructure();
|
{
|
||||||
}
|
fatalErrorInFunction<<
|
||||||
|
"error in updating domains"<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
FUNCTION_H
|
boundaries_.updateLists();
|
||||||
bool pFlow::pointStructure::writePointStructure
|
|
||||||
(
|
|
||||||
iOstream& os
|
|
||||||
)const
|
|
||||||
{
|
|
||||||
os.writeWordEntry("pointStructureCapacity", maxPoints_);
|
|
||||||
|
|
||||||
if(!pointPosition_.write(os))
|
return distributePoints(fRead);
|
||||||
{
|
|
||||||
ioErrorInFile(os.name(), os.lineNumber())<<
|
}
|
||||||
"error in writing pointPosition to file \n";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!pointFlag_.write(os))
|
|
||||||
{
|
|
||||||
ioErrorInFile(os.name(), os.lineNumber())<<
|
|
||||||
"error in writing pointFlag to file \n";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*pFlow::uniquePtr<pFlow::int32Vector>
|
|
||||||
pFlow::pointStructure::newPointsIndices(
|
|
||||||
int32 numNewPoints
|
|
||||||
)const
|
|
||||||
{
|
|
||||||
|
|
||||||
auto newPointsPtr = makeUnique<int32Vector>(
|
|
||||||
"pointStructure::newPointsPtr",
|
|
||||||
numNewPoints);
|
|
||||||
|
|
||||||
auto& newPoints = newPointsPtr();
|
|
||||||
|
|
||||||
|
|
||||||
// first, check if there is space at the end
|
|
||||||
if( capacity() - activeRange_.second >= numNewPoints )
|
|
||||||
{
|
|
||||||
// fill the sequence starting from activeRange_.second-1
|
|
||||||
fillSequence(newPoints, activeRange_.second-1);
|
|
||||||
return newPointsPtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// second, check if there is space at the beggining
|
|
||||||
if( activeRange_.first >= numNewPoints)
|
|
||||||
{
|
|
||||||
// fill the sequence starting from 0
|
|
||||||
fillSequence(newPoints, 0);
|
|
||||||
return newPointsPtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// otherwise scan the points from first to the end to find empty spaces
|
|
||||||
newPoints.clear();
|
|
||||||
int32 numAdded = 0;
|
|
||||||
ForAll(i, pointFlag_)
|
|
||||||
{
|
|
||||||
if(!isActive(i))
|
|
||||||
{
|
|
||||||
newPoints.push_back(static_cast<int32>(i));
|
|
||||||
numAdded++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(numAdded == numNewPoints)
|
|
||||||
{
|
|
||||||
|
|
||||||
return newPointsPtr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if there is space at the end for the remaining of points
|
|
||||||
if( capacity() - size() >= numNewPoints - numAdded )
|
|
||||||
{
|
|
||||||
int32 ind = size();
|
|
||||||
for(int32 i=numAdded; i<numNewPoints; i++)
|
|
||||||
{
|
|
||||||
newPoints.push_back(ind);
|
|
||||||
ind++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return newPointsPtr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<"not enough capacity for inserting particles into the point structure\n";
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}*/
|
|
@ -22,46 +22,31 @@ Licence:
|
|||||||
#ifndef __pointStructure_hpp__
|
#ifndef __pointStructure_hpp__
|
||||||
#define __pointStructure_hpp__
|
#define __pointStructure_hpp__
|
||||||
|
|
||||||
|
|
||||||
#include "Lists.hpp"
|
|
||||||
#include "internalPoints.hpp"
|
#include "internalPoints.hpp"
|
||||||
|
#include "simulationDomain.hpp"
|
||||||
#include "Vectors.hpp"
|
#include "boundaryList.hpp"
|
||||||
#include "VectorSingles.hpp"
|
#include "uniquePtr.hpp"
|
||||||
#include "VectorDuals.hpp"
|
|
||||||
#include "Fields.hpp"
|
|
||||||
#include "eventSubscriber.hpp"
|
|
||||||
#include "indexContainer.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
//forward
|
class simulationDomain;
|
||||||
class boundaryBase;
|
|
||||||
|
|
||||||
|
|
||||||
class pointStructure
|
class pointStructure
|
||||||
:
|
:
|
||||||
public eventSubscriber
|
public internalPoints
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
|
|
||||||
using boundaryListType = ListPtr<boundaryBase>;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//// - data members
|
//// - data members
|
||||||
domain globalDomain_;
|
uniquePtr<simulationDomain> simulationDomain_ = nullptr;
|
||||||
|
|
||||||
domain thisDomain_;
|
boundaryList boundaries_;
|
||||||
|
|
||||||
internalPoints internal_;
|
|
||||||
|
bool distributePoints(const realx3Vector& points);
|
||||||
boundaryListType boundaries_;
|
|
||||||
|
|
||||||
wordList boundaryTypes_;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -73,21 +58,22 @@ public:
|
|||||||
//// - Constructors
|
//// - Constructors
|
||||||
|
|
||||||
// - an empty pointStructure, good for reading from file
|
// - an empty pointStructure, good for reading from file
|
||||||
pointStructure();
|
pointStructure(const dictionary& domainDict);
|
||||||
|
|
||||||
// - construct from components
|
// - construct from components
|
||||||
pointStructure(const int8Vector& flgVec, const realx3Vector& posVec);
|
//pointStructure(const int8Vector& flgVec, const realx3Vector& posVec);
|
||||||
|
|
||||||
// - construct from point positions, assume all points are active
|
/// construct from point positions, assume all points are active
|
||||||
pointStructure(const realx3Vector& posVec);
|
pointStructure(
|
||||||
|
const dictionary& domainDict,
|
||||||
|
const realx3Vector& posVec);
|
||||||
|
|
||||||
// - copy construct
|
// - copy construct
|
||||||
//
|
//
|
||||||
// should be changed, may causs undefined behavior
|
// should be changed, may causs undefined behavior
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
pointStructure(const pointStructure&) = default;
|
pointStructure(const pointStructure&) = delete;
|
||||||
|
|
||||||
|
|
||||||
// - no move construct
|
// - no move construct
|
||||||
pointStructure(pointStructure&&) = delete;
|
pointStructure(pointStructure&&) = delete;
|
||||||
|
|
||||||
@ -95,49 +81,25 @@ public:
|
|||||||
//
|
//
|
||||||
// should be changed, may causs undefined behavior
|
// should be changed, may causs undefined behavior
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
pointStructure& operator=(const pointStructure&) = default;
|
pointStructure& operator=(const pointStructure&) = delete;
|
||||||
|
|
||||||
// - no move assignment
|
// - no move assignment
|
||||||
pointStructure& operator=(pointStructure&&) = delete;
|
pointStructure& operator=(pointStructure&&) = delete;
|
||||||
|
|
||||||
// - destructor
|
// - destructor
|
||||||
virtual ~pointStructure() = default
|
virtual ~pointStructure() = default;
|
||||||
|
|
||||||
// - size of data structure
|
|
||||||
FUNCTION_H
|
|
||||||
label size()const;
|
|
||||||
|
|
||||||
// - maximum capacity of data structure
|
|
||||||
|
/// Read
|
||||||
FUNCTION_H
|
FUNCTION_H
|
||||||
label capacity()const;
|
bool read(iIstream& is, IOPattern::IOType iotype);
|
||||||
|
|
||||||
|
|
||||||
|
/// Write
|
||||||
|
/*FUNCTION_H
|
||||||
|
bool write(iOstream& os, IOPattern::IOType iotype)const; */
|
||||||
|
|
||||||
|
|
||||||
// - 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 setFieldList& setField,
|
|
||||||
repository& owner,
|
|
||||||
const List<eventObserver*>& exclusionList={nullptr}
|
|
||||||
);*/
|
|
||||||
|
|
||||||
boundaryBase& boundary(size_t i)
|
|
||||||
{
|
|
||||||
return boundaries_[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const boundaryBase& boundary(size_t i)const
|
|
||||||
{
|
|
||||||
return boundaries_[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//// - IO operations
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ Licence:
|
|||||||
|
|
||||||
// initilized and finalize should be placed in onc scope
|
// initilized and finalize should be placed in onc scope
|
||||||
REPORT(0)<<"Initializing host/device execution spaces . . . \n";
|
REPORT(0)<<"Initializing host/device execution spaces . . . \n";
|
||||||
REPORT(1)<<"Host execution space is "<< greenText(pFlow::DefaultHostExecutionSpace::name())<<endREPORT;
|
REPORT(1)<<"Host execution space is "<< Green_Text(pFlow::DefaultHostExecutionSpace::name())<<END_REPORT;
|
||||||
REPORT(1)<<"Device execution space is "<<greenText(pFlow::DefaultExecutionSpace::name())<<endREPORT;
|
REPORT(1)<<"Device execution space is "<<Green_Text(pFlow::DefaultExecutionSpace::name())<<END_REPORT;
|
||||||
|
|
||||||
Kokkos::initialize( argc, argv );
|
Kokkos::initialize( argc, argv );
|
||||||
{
|
{
|
||||||
|
@ -24,10 +24,10 @@ Licence:
|
|||||||
// initilized and finalize should be placed in onc scope
|
// initilized and finalize should be placed in onc scope
|
||||||
#include "initialize.hpp"
|
#include "initialize.hpp"
|
||||||
|
|
||||||
REPORT(0)<<"\nCreating Control repository . . ."<<endREPORT;
|
REPORT(0)<<"\nCreating Control repository . . ."<<END_REPORT;
|
||||||
pFlow::uniquePtr<pFlow::systemControl> ControlPtr = nullptr;
|
pFlow::uniquePtr<pFlow::systemControl> ControlPtr = nullptr;
|
||||||
|
|
||||||
if(isCoupling)
|
/*if(isCoupling)
|
||||||
{
|
{
|
||||||
pFlow::readControlDict controlDict;
|
pFlow::readControlDict controlDict;
|
||||||
|
|
||||||
@ -36,13 +36,13 @@ if(isCoupling)
|
|||||||
controlDict.startTime(),
|
controlDict.startTime(),
|
||||||
controlDict.endTime(),
|
controlDict.endTime(),
|
||||||
controlDict.saveInterval(),
|
controlDict.saveInterval(),
|
||||||
controlDict.startTimeName()
|
controlDict.startTimeNreseame()
|
||||||
);
|
);
|
||||||
}
|
}*/
|
||||||
else
|
/*else
|
||||||
{
|
{*/
|
||||||
ControlPtr = pFlow::makeUnique<pFlow::systemControl>();
|
ControlPtr = pFlow::makeUnique<pFlow::systemControl>();
|
||||||
}
|
//}
|
||||||
|
|
||||||
auto& Control = ControlPtr();
|
auto& Control = ControlPtr();
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
|
|
||||||
add_subdirectory(checkPhasicFlow)
|
#add_subdirectory(checkPhasicFlow)
|
||||||
|
|
||||||
add_subdirectory(particlesPhasicFlow)
|
#add_subdirectory(particlesPhasicFlow)
|
||||||
|
|
||||||
add_subdirectory(geometryPhasicFlow)
|
#add_subdirectory(geometryPhasicFlow)
|
||||||
|
|
||||||
add_subdirectory(pFlowToVTK)
|
#add_subdirectory(pFlowToVTK)
|
||||||
|
|
||||||
add_subdirectory(Utilities)
|
#add_subdirectory(Utilities)
|
||||||
|
|
||||||
add_subdirectory(postprocessPhasicFlow)
|
#add_subdirectory(postprocessPhasicFlow)
|
||||||
|
|
||||||
|
@ -23,10 +23,11 @@ Licence:
|
|||||||
|
|
||||||
|
|
||||||
pFlow::empty::empty(
|
pFlow::empty::empty(
|
||||||
|
systemControl& control,
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
positionParticles(dict),
|
positionParticles(control, dict),
|
||||||
position_
|
position_
|
||||||
(
|
(
|
||||||
maxNumberOfParticles_, 0, RESERVE()
|
maxNumberOfParticles_, 0, RESERVE()
|
||||||
|
@ -44,7 +44,9 @@ public:
|
|||||||
// - type Info
|
// - type Info
|
||||||
TypeInfo("empty");
|
TypeInfo("empty");
|
||||||
|
|
||||||
empty(const dictionary& dict);
|
empty(
|
||||||
|
systemControl& control,
|
||||||
|
const dictionary& dict);
|
||||||
|
|
||||||
// - add this class to vCtor selection table
|
// - add this class to vCtor selection table
|
||||||
add_vCtor(
|
add_vCtor(
|
||||||
@ -56,12 +58,12 @@ public:
|
|||||||
|
|
||||||
//// - Methods
|
//// - Methods
|
||||||
|
|
||||||
virtual label numPoints()const
|
virtual uint64 numPoints()const
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual label size()const
|
virtual uint64 size()const
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ Licence:
|
|||||||
#include "setFields.hpp"
|
#include "setFields.hpp"
|
||||||
#include "systemControl.hpp"
|
#include "systemControl.hpp"
|
||||||
#include "commandLine.hpp"
|
#include "commandLine.hpp"
|
||||||
#include "readControlDict.hpp"
|
//#include "readControlDict.hpp"
|
||||||
|
|
||||||
using pFlow::output;
|
using pFlow::output;
|
||||||
using pFlow::endl;
|
using pFlow::endl;
|
||||||
|
@ -123,6 +123,7 @@ bool pFlow::positionOrdered::positionPointsOrdered()
|
|||||||
|
|
||||||
pFlow::positionOrdered::positionOrdered
|
pFlow::positionOrdered::positionOrdered
|
||||||
(
|
(
|
||||||
|
systemControl& control,
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
@ -62,7 +62,9 @@ public:
|
|||||||
// - type Info
|
// - type Info
|
||||||
TypeInfo("positionOrdered");
|
TypeInfo("positionOrdered");
|
||||||
|
|
||||||
positionOrdered(const dictionary& dict);
|
positionOrdered(
|
||||||
|
systemControl& control,
|
||||||
|
const dictionary& dict);
|
||||||
|
|
||||||
// - add this class to vCtor selection table
|
// - add this class to vCtor selection table
|
||||||
add_vCtor(
|
add_vCtor(
|
||||||
|
@ -76,6 +76,7 @@ pFlow::realx3Vector pFlow::positionParticles::sortByMortonCode(realx3Vector& pos
|
|||||||
|
|
||||||
pFlow::positionParticles::positionParticles
|
pFlow::positionParticles::positionParticles
|
||||||
(
|
(
|
||||||
|
systemControl& control,
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -95,6 +96,11 @@ pFlow::positionParticles::positionParticles
|
|||||||
{
|
{
|
||||||
region_ = makeUnique<region<sphere>>(dict.subDict("sphere"));
|
region_ = makeUnique<region<sphere>>(dict.subDict("sphere"));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
region_ = makeUnique<region<box>>( control.domainDict().subDict("globalBox"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ Licence:
|
|||||||
#include "virtualConstructor.hpp"
|
#include "virtualConstructor.hpp"
|
||||||
#include "Vectors.hpp"
|
#include "Vectors.hpp"
|
||||||
#include "dictionary.hpp"
|
#include "dictionary.hpp"
|
||||||
|
#include "systemControl.hpp"
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
@ -118,7 +119,9 @@ public:
|
|||||||
// - type Info
|
// - type Info
|
||||||
TypeInfo("positionParticles");
|
TypeInfo("positionParticles");
|
||||||
|
|
||||||
positionParticles(const dictionary& dict);
|
positionParticles(
|
||||||
|
systemControl& control,
|
||||||
|
const dictionary& dict);
|
||||||
|
|
||||||
create_vCtor
|
create_vCtor
|
||||||
(
|
(
|
||||||
@ -132,9 +135,9 @@ public:
|
|||||||
|
|
||||||
//// - Methods
|
//// - Methods
|
||||||
|
|
||||||
virtual label numPoints()const = 0;
|
virtual uint64 numPoints()const = 0;
|
||||||
|
|
||||||
virtual label size()const = 0;
|
virtual uint64 size()const = 0;
|
||||||
|
|
||||||
virtual real maxDiameter() const = 0;
|
virtual real maxDiameter() const = 0;
|
||||||
|
|
||||||
|
@ -158,10 +158,11 @@ bool pFlow::positionRandom::inCollision
|
|||||||
|
|
||||||
pFlow::positionRandom::positionRandom
|
pFlow::positionRandom::positionRandom
|
||||||
(
|
(
|
||||||
|
systemControl& control,
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
positionParticles(dict),
|
positionParticles(control, dict),
|
||||||
prDict_
|
prDict_
|
||||||
(
|
(
|
||||||
dict.subDict("positionRandomInfo")
|
dict.subDict("positionRandomInfo")
|
||||||
|
@ -66,7 +66,9 @@ public:
|
|||||||
// - type Info
|
// - type Info
|
||||||
TypeInfo("positionRandom");
|
TypeInfo("positionRandom");
|
||||||
|
|
||||||
positionRandom(const dictionary& dict);
|
positionRandom(
|
||||||
|
systemControl& control,
|
||||||
|
const dictionary& dict);
|
||||||
|
|
||||||
// - add this class to vCtor selection table
|
// - add this class to vCtor selection table
|
||||||
add_vCtor(
|
add_vCtor(
|
||||||
@ -78,12 +80,12 @@ public:
|
|||||||
|
|
||||||
//// - Methods
|
//// - Methods
|
||||||
|
|
||||||
virtual label numPoints()const
|
virtual uint64 numPoints()const
|
||||||
{
|
{
|
||||||
return position_.size();
|
return position_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual label size()const
|
virtual uint64 size()const
|
||||||
{
|
{
|
||||||
return position_.size();
|
return position_.size();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user