Merge branch 'main' of github.com:PhasicFlow/phasicFlow into main
This commit is contained in:
commit
b6360643ee
|
@ -150,6 +150,35 @@ pFlow::particles::particles
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool pFlow::particles::beforeIteration()
|
||||||
|
{
|
||||||
|
auto domain = this->control().domain();
|
||||||
|
|
||||||
|
auto numMarked = dynPointStruct_.markDeleteOutOfBox(domain);
|
||||||
|
|
||||||
|
if(time_.sortTime())
|
||||||
|
{
|
||||||
|
real min_dx, max_dx;
|
||||||
|
boundingSphereMinMax(min_dx, max_dx);
|
||||||
|
Timer t;
|
||||||
|
t.start();
|
||||||
|
REPORT(0)<<"Performing morton sorting on particles ...."<<endREPORT;
|
||||||
|
if(!pStruct().mortonSortPoints(domain, max_dx))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"Morton sorting was not successful"<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
t.end();
|
||||||
|
REPORT(1)<<"Active range is "<< pStruct().activeRange()<<endREPORT;
|
||||||
|
REPORT(1)<<"It took "<< yellowText(t.totalTime())<<" seconds."<<endREPORT;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->zeroForce();
|
||||||
|
this->zeroTorque();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
pFlow::uniquePtr<pFlow::List<pFlow::eventObserver*>>
|
pFlow::uniquePtr<pFlow::List<pFlow::eventObserver*>>
|
||||||
pFlow::particles::getFieldObjectList()const
|
pFlow::particles::getFieldObjectList()const
|
||||||
{
|
{
|
||||||
|
|
|
@ -241,18 +241,7 @@ public:
|
||||||
return shapeName_;
|
return shapeName_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool beforeIteration() override
|
bool beforeIteration() override;
|
||||||
{
|
|
||||||
auto domain = this->control().domain();
|
|
||||||
|
|
||||||
auto numMarked = dynPointStruct_.markDeleteOutOfBox(domain);
|
|
||||||
|
|
||||||
|
|
||||||
this->zeroForce();
|
|
||||||
this->zeroTorque();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
bool insertParticles
|
bool insertParticles
|
||||||
|
|
|
@ -45,12 +45,14 @@ repository/IOobject/IOobject.cpp
|
||||||
repository/IOobject/IOfileHeader.cpp
|
repository/IOobject/IOfileHeader.cpp
|
||||||
|
|
||||||
structuredData/box/box.cpp
|
structuredData/box/box.cpp
|
||||||
|
structuredData/cells/cells.cpp
|
||||||
structuredData/cylinder/cylinder.cpp
|
structuredData/cylinder/cylinder.cpp
|
||||||
structuredData/sphere/sphere.cpp
|
structuredData/sphere/sphere.cpp
|
||||||
structuredData/iBox/iBoxs.cpp
|
structuredData/iBox/iBoxs.cpp
|
||||||
structuredData/line/line.cpp
|
structuredData/line/line.cpp
|
||||||
structuredData/zAxis/zAxis.cpp
|
structuredData/zAxis/zAxis.cpp
|
||||||
structuredData/pointStructure/pointStructure.cpp
|
structuredData/pointStructure/pointStructure.cpp
|
||||||
|
structuredData/pointStructure/mortonIndexing.cpp
|
||||||
structuredData/pointStructure/selectors/pStructSelector/pStructSelector.cpp
|
structuredData/pointStructure/selectors/pStructSelector/pStructSelector.cpp
|
||||||
structuredData/pointStructure/selectors/selectBox/selectBox.cpp
|
structuredData/pointStructure/selectors/selectBox/selectBox.cpp
|
||||||
structuredData/pointStructure/selectors/selectRange/selectRange.cpp
|
structuredData/pointStructure/selectors/selectRange/selectRange.cpp
|
||||||
|
|
|
@ -26,6 +26,8 @@ Licence:
|
||||||
#include <Kokkos_DualView.hpp>
|
#include <Kokkos_DualView.hpp>
|
||||||
#include <Kokkos_UnorderedMap.hpp>
|
#include <Kokkos_UnorderedMap.hpp>
|
||||||
|
|
||||||
|
#include "iOstream.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
@ -51,9 +53,12 @@ using DefaultExecutionSpace = Kokkos::DefaultExecutionSpace;
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
using kPair = Kokkos::pair<T1,T2>;
|
using kPair = Kokkos::pair<T1,T2>;
|
||||||
|
|
||||||
using range = kPair<int,int>;
|
template<typename T>
|
||||||
|
using kRange = kPair<T,T>;
|
||||||
|
|
||||||
using range64 = kPair<int long,int long>;
|
using range = kRange<int>;
|
||||||
|
|
||||||
|
using range64 = kRange<int long>;
|
||||||
|
|
||||||
template<typename T, typename... properties>
|
template<typename T, typename... properties>
|
||||||
using ViewTypeScalar = Kokkos::View<T,properties...>;
|
using ViewTypeScalar = Kokkos::View<T,properties...>;
|
||||||
|
@ -132,6 +137,13 @@ using deviceAtomicViewType3D =
|
||||||
T***,
|
T***,
|
||||||
Kokkos::MemoryTraits<std::is_same<DefaultExecutionSpace,Serial>::value?0:Kokkos::Atomic>>;
|
Kokkos::MemoryTraits<std::is_same<DefaultExecutionSpace,Serial>::value?0:Kokkos::Atomic>>;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
iOstream& operator <<(iOstream& os, const kRange<T>& rng)
|
||||||
|
{
|
||||||
|
os<<"["<<rng.first<<" "<<rng.second<<")";
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // pFlow
|
} // pFlow
|
||||||
|
|
||||||
|
|
|
@ -195,8 +195,8 @@ void permuteSort(const Type* first, PermuteType* pFirst, int32 numElems)
|
||||||
};
|
};
|
||||||
|
|
||||||
compOperator compare{first};
|
compOperator compare{first};
|
||||||
fillSequence<Type, useParallel>(pFirst, numElems, static_cast<PermuteType>(0));
|
fillSequence<PermuteType, useParallel>(pFirst, numElems, static_cast<PermuteType>(0));
|
||||||
sort<Type, compOperator, useParallel>(pFirst, numElems, compare);
|
sort<PermuteType, compOperator, useParallel>(pFirst, numElems, compare);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -83,16 +83,23 @@ bool pFlow::Field<VectorField, T, PropType>::readNonUniform
|
||||||
}
|
}
|
||||||
|
|
||||||
this->clear();
|
this->clear();
|
||||||
VectorType::read(is);
|
if(is.isBinary() && !std::is_same_v<T,word>)
|
||||||
|
|
||||||
is.readEndStatement("readField");
|
|
||||||
|
|
||||||
if( this->size() != flen )
|
|
||||||
{
|
{
|
||||||
ioErrorInFile( is.name(), is.lineNumber() ) <<
|
this->resize(flen);
|
||||||
" expected " << flen << " elements, but supplied "<<
|
is.read(reinterpret_cast<char*>(this->data()), this->size()*sizeof(T));
|
||||||
this->size() << " elements in file "<< is.name() <<endl;
|
is.readEndStatement("readField");
|
||||||
return false;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VectorType::read(is);
|
||||||
|
is.readEndStatement("readField");
|
||||||
|
if( this->size() != flen )
|
||||||
|
{
|
||||||
|
ioErrorInFile( is.name(), is.lineNumber() ) <<
|
||||||
|
" expected " << flen << " elements, but supplied "<<
|
||||||
|
this->size() << " elements in file "<< is.name() <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -104,10 +111,18 @@ bool pFlow::Field<VectorField, T, PropType>::readField
|
||||||
(
|
(
|
||||||
iIstream& is,
|
iIstream& is,
|
||||||
const size_t len,
|
const size_t len,
|
||||||
|
bool resume,
|
||||||
bool readLength
|
bool readLength
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if( !is.findToken(fieldKey_) )
|
|
||||||
|
bool tokenFound;
|
||||||
|
if( resume )
|
||||||
|
tokenFound = is.findTokenResume(fieldKey_);
|
||||||
|
else
|
||||||
|
tokenFound = is.findToken(fieldKey_);
|
||||||
|
|
||||||
|
if( !tokenFound )
|
||||||
{
|
{
|
||||||
ioErrorInFile( is.name(), is.lineNumber() ) <<
|
ioErrorInFile( is.name(), is.lineNumber() ) <<
|
||||||
" error in searching for filedkey " << fieldKey_<<endl;
|
" error in searching for filedkey " << fieldKey_<<endl;
|
||||||
|
@ -152,10 +167,11 @@ bool pFlow::Field<VectorField, T, PropType>::readField
|
||||||
template<template<class, class> class VectorField, class T, class PropType>
|
template<template<class, class> class VectorField, class T, class PropType>
|
||||||
bool pFlow::Field<VectorField, T, PropType>::readField
|
bool pFlow::Field<VectorField, T, PropType>::readField
|
||||||
(
|
(
|
||||||
iIstream& is
|
iIstream& is,
|
||||||
|
bool resume
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return readField(is, 0, true);
|
return readField(is, 0, resume ,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,7 +180,15 @@ bool pFlow::Field<VectorField, T, PropType>::writeField(iOstream& os)const
|
||||||
{
|
{
|
||||||
os.writeWordKeyword(fieldKey_) << nonUniform__<<endl;
|
os.writeWordKeyword(fieldKey_) << nonUniform__<<endl;
|
||||||
os<< this->size()<<endl;
|
os<< this->size()<<endl;
|
||||||
VectorType::write(os);
|
if( os.isBinary() && !std::is_same_v<T,word>)
|
||||||
|
{
|
||||||
|
os.write(reinterpret_cast<const char*>(this->data()), this->size()*sizeof(T));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VectorType::write(os);
|
||||||
|
}
|
||||||
os.endEntry();
|
os.endEntry();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -214,18 +214,18 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
//// - IO operations
|
//// - IO operations
|
||||||
bool readField(iIstream& is, const size_t len, bool readLength = true);
|
bool readField(iIstream& is, const size_t len, bool resume, bool readLength = true);
|
||||||
|
|
||||||
|
|
||||||
bool readField(iIstream& is );
|
bool readField(iIstream& is, bool resume );
|
||||||
|
|
||||||
|
|
||||||
bool writeField(iOstream& os)const;
|
bool writeField(iOstream& os)const;
|
||||||
|
|
||||||
|
|
||||||
bool read(iIstream& is)
|
bool read(iIstream& is, bool resume = false)
|
||||||
{
|
{
|
||||||
return readField(is);
|
return readField(is, resume);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool write(iOstream& os)const
|
bool write(iOstream& os)const
|
||||||
|
@ -240,7 +240,7 @@ public:
|
||||||
template<template<class, class> class VectorField, class T, class PropType>
|
template<template<class, class> class VectorField, class T, class PropType>
|
||||||
inline iIstream& operator >> (iIstream & is, Field<VectorField, T, PropType> & ifld )
|
inline iIstream& operator >> (iIstream & is, Field<VectorField, T, PropType> & ifld )
|
||||||
{
|
{
|
||||||
if( !ifld.readField(is) )
|
if( !ifld.readField(is, false) )
|
||||||
{
|
{
|
||||||
ioErrorInFile (is.name(), is.lineNumber());
|
ioErrorInFile (is.name(), is.lineNumber());
|
||||||
fatalExit;
|
fatalExit;
|
||||||
|
|
|
@ -197,6 +197,26 @@ bool pFlow::Vector<T, Allocator>::deleteElement
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T, typename Allocator>
|
||||||
|
void pFlow::Vector<T, Allocator>::sortItems(
|
||||||
|
const int32IndexContainer& indices)
|
||||||
|
{
|
||||||
|
if(indices.size() == 0)
|
||||||
|
{
|
||||||
|
this->resize(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
size_t newSize = indices.size();
|
||||||
|
auto hIndices = indices.hostView();
|
||||||
|
VectorType sortedVec(name(), capacity(), newSize, RESERVE());
|
||||||
|
|
||||||
|
ForAll(i, hIndices)
|
||||||
|
{
|
||||||
|
sortedVec[i] = vectorType::operator[](i);
|
||||||
|
}
|
||||||
|
*this = std::move(sortedVec);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T, typename Allocator>
|
template<typename T, typename Allocator>
|
||||||
bool pFlow::Vector<T, Allocator>::insertSetElement(
|
bool pFlow::Vector<T, Allocator>::insertSetElement(
|
||||||
const int32IndexContainer& indices,
|
const int32IndexContainer& indices,
|
||||||
|
|
|
@ -323,6 +323,9 @@ public:
|
||||||
// return false if out of range
|
// return false if out of range
|
||||||
bool deleteElement(label index);
|
bool deleteElement(label index);
|
||||||
|
|
||||||
|
/// Sort elements based on the indices
|
||||||
|
void sortItems(const int32IndexContainer& indices);
|
||||||
|
|
||||||
// - set or insert new elements into the vector
|
// - set or insert new elements into the vector
|
||||||
// return false if it fails
|
// return false if it fails
|
||||||
bool insertSetElement(const int32IndexContainer& indices, const T& val);
|
bool insertSetElement(const int32IndexContainer& indices, const T& val);
|
||||||
|
|
|
@ -545,6 +545,35 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
void sortItems(const int32IndexContainer& indices)
|
||||||
|
{
|
||||||
|
if(indices.size() == 0)
|
||||||
|
{
|
||||||
|
setSize(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
size_t newSize = indices.size();
|
||||||
|
|
||||||
|
deviceViewType sortedView("sortedView", newSize);
|
||||||
|
auto dVec = deviceVectorAll();
|
||||||
|
|
||||||
|
auto d_indices = indices.deviceView();
|
||||||
|
|
||||||
|
Kokkos::parallel_for(
|
||||||
|
"sortItems",
|
||||||
|
newSize,
|
||||||
|
LAMBDA_HD(int32 i){
|
||||||
|
sortedView[i] = dVec[d_indices[i]];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
Kokkos::fence();
|
||||||
|
setSize(newSize);
|
||||||
|
copy(deviceVector(), sortedView);
|
||||||
|
modifyOnDevice();
|
||||||
|
syncViews();
|
||||||
|
}
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
INLINE_FUNCTION_H
|
||||||
bool insertSetElement(const int32IndexContainer& indices, const T& val)
|
bool insertSetElement(const int32IndexContainer& indices, const T& val)
|
||||||
{
|
{
|
||||||
|
|
|
@ -558,6 +558,46 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
void sortItems(const int32IndexContainer& indices)
|
||||||
|
{
|
||||||
|
if(indices.size() == 0)
|
||||||
|
{
|
||||||
|
setSize(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t newSize = indices.size();
|
||||||
|
viewType sortedView("sortedView", newSize);
|
||||||
|
|
||||||
|
if constexpr (isHostAccessible_)
|
||||||
|
{
|
||||||
|
auto h_indices = indices.hostView();
|
||||||
|
Kokkos::parallel_for(
|
||||||
|
"sortItems",
|
||||||
|
newSize,
|
||||||
|
LAMBDA_HD(int32 i){
|
||||||
|
sortedView[i] = view_[h_indices[i]];
|
||||||
|
});
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
auto d_indices = indices.deviceView();
|
||||||
|
Kokkos::parallel_for(
|
||||||
|
"sortItems",
|
||||||
|
newSize,
|
||||||
|
LAMBDA_HD(int32 i){
|
||||||
|
sortedView[i] = view_[d_indices[i]];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Kokkos::fence();
|
||||||
|
setSize(newSize);
|
||||||
|
|
||||||
|
copy(deviceVector(), sortedView);
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
INLINE_FUNCTION_H
|
||||||
bool insertSetElement(const int32IndexContainer& indices, const Vector<T>& vals)
|
bool insertSetElement(const int32IndexContainer& indices, const Vector<T>& vals)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,3 +19,6 @@ Licence:
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "indexContainer.hpp"
|
#include "indexContainer.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
template class pFlow::indexContainer<pFlow::int32>;
|
|
@ -43,6 +43,10 @@ public:
|
||||||
// - viewType of data on host
|
// - viewType of data on host
|
||||||
using HostViewType = typename DualViewType::t_host;
|
using HostViewType = typename DualViewType::t_host;
|
||||||
|
|
||||||
|
using HostType = typename HostViewType::device_type;
|
||||||
|
|
||||||
|
using DeviceType = typename DeviceViewType::device_type;
|
||||||
|
|
||||||
template<typename ViewType>
|
template<typename ViewType>
|
||||||
class IndexAccessor
|
class IndexAccessor
|
||||||
{
|
{
|
||||||
|
@ -101,6 +105,10 @@ public:
|
||||||
|
|
||||||
indexContainer& operator = (const indexContainer&) = default;
|
indexContainer& operator = (const indexContainer&) = default;
|
||||||
|
|
||||||
|
indexContainer(indexContainer&&) = default;
|
||||||
|
|
||||||
|
indexContainer& operator = (indexContainer&&) = default;
|
||||||
|
|
||||||
~indexContainer() = default;
|
~indexContainer() = default;
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
|
@ -150,6 +158,16 @@ public:
|
||||||
return views_.d_view;
|
return views_.d_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HostViewType& hostView()
|
||||||
|
{
|
||||||
|
return views_.h_view;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceViewType& deviceView()
|
||||||
|
{
|
||||||
|
return views_.d_view;
|
||||||
|
}
|
||||||
|
|
||||||
auto indicesHost()const
|
auto indicesHost()const
|
||||||
{
|
{
|
||||||
return IndexAccessor<HostViewType>(views_.h_view);
|
return IndexAccessor<HostViewType>(views_.h_view);
|
||||||
|
@ -157,7 +175,45 @@ public:
|
||||||
|
|
||||||
auto indicesDevice()const
|
auto indicesDevice()const
|
||||||
{
|
{
|
||||||
return IndexAccessor<DeviceViewType>(views_.d_veiw);
|
return IndexAccessor<DeviceViewType>(views_.d_view);
|
||||||
|
}
|
||||||
|
|
||||||
|
void modifyOnHost()
|
||||||
|
{
|
||||||
|
views_.modify_host();
|
||||||
|
}
|
||||||
|
|
||||||
|
void modifyOnDevice()
|
||||||
|
{
|
||||||
|
views_.modify_device();
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncViews()
|
||||||
|
{
|
||||||
|
bool findMinMax = false;
|
||||||
|
if(views_.template need_sync<HostType>())
|
||||||
|
{
|
||||||
|
Kokkos::deep_copy(views_.d_view, views_.h_view);
|
||||||
|
findMinMax = true;
|
||||||
|
}
|
||||||
|
else if(views_.template need_sync<DeviceType>())
|
||||||
|
{
|
||||||
|
Kokkos::deep_copy(views_.h_view, views_.d_view);
|
||||||
|
findMinMax = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(findMinMax)
|
||||||
|
{
|
||||||
|
min_ = pFlow::min(views_.d_view, 0, size_);
|
||||||
|
max_ = pFlow::max(views_.d_view, 0, size_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t setSize(size_t ns)
|
||||||
|
{
|
||||||
|
auto tmp = size_;
|
||||||
|
size_ = ns;
|
||||||
|
return tmp;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,13 @@ bool pFlow::pointField<VectorField, T, MemorySpace>::update(const eventMessage&
|
||||||
return this->insertSetElement(newElems, defaultValue_);
|
return this->insertSetElement(newElems, defaultValue_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(msg.isRearranged())
|
||||||
|
{
|
||||||
|
auto sortedIndex = pStruct().mortonSortedIndex();
|
||||||
|
this->sortItems(sortedIndex);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,22 +24,24 @@ Licence:
|
||||||
pFlow::uniquePtr<pFlow::iFstream> pFlow::IOfileHeader::inStream()const
|
pFlow::uniquePtr<pFlow::iFstream> pFlow::IOfileHeader::inStream()const
|
||||||
{
|
{
|
||||||
if( fileExist() )
|
if( fileExist() )
|
||||||
return makeUnique<iFstream>(path());
|
return makeUnique<iFstream>(path(), inFileBinary());
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::uniquePtr<pFlow::oFstream> pFlow::IOfileHeader::outStream()const
|
pFlow::uniquePtr<pFlow::oFstream> pFlow::IOfileHeader::outStream()const
|
||||||
{
|
{
|
||||||
auto osPtr = makeUnique<oFstream>(path());
|
|
||||||
|
|
||||||
if(osPtr && owner_)
|
|
||||||
{
|
auto osPtr = makeUnique<oFstream>(path(), outFileBinary());
|
||||||
|
|
||||||
|
if(osPtr && owner_)
|
||||||
|
{
|
||||||
auto outPrecision = owner_->outFilePrecision();
|
auto outPrecision = owner_->outFilePrecision();
|
||||||
osPtr->precision(outPrecision);
|
osPtr->precision(outPrecision);
|
||||||
}
|
}
|
||||||
|
|
||||||
return osPtr;
|
return osPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::IOfileHeader::IOfileHeader
|
pFlow::IOfileHeader::IOfileHeader
|
||||||
|
@ -68,6 +70,19 @@ pFlow::fileSystem pFlow::IOfileHeader::path() const
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool pFlow::IOfileHeader::outFileBinary()const
|
||||||
|
{
|
||||||
|
if(owner_)
|
||||||
|
return owner_->outFileBinary();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::IOfileHeader::inFileBinary()const
|
||||||
|
{
|
||||||
|
return toUpper(fileFormat_) == "BINARY";
|
||||||
|
}
|
||||||
|
|
||||||
bool pFlow::IOfileHeader::headerOk(bool silent)
|
bool pFlow::IOfileHeader::headerOk(bool silent)
|
||||||
{
|
{
|
||||||
if(!fileExist())
|
if(!fileExist())
|
||||||
|
@ -130,6 +145,15 @@ bool pFlow::IOfileHeader::writeHeader(iOstream& os, const word& typeName) const
|
||||||
os.writeWordEntry("objectName", name() );
|
os.writeWordEntry("objectName", name() );
|
||||||
os.fatalCheck("writing objectName");
|
os.fatalCheck("writing objectName");
|
||||||
|
|
||||||
|
word fileFormat;
|
||||||
|
if(outFileBinary())
|
||||||
|
fileFormat = "Binary";
|
||||||
|
else
|
||||||
|
fileFormat = "ASCII";
|
||||||
|
|
||||||
|
os.writeWordEntry("fileFormat", fileFormat);
|
||||||
|
os.fatalCheck("writing fileFormat");
|
||||||
|
|
||||||
writeSeparator(os);
|
writeSeparator(os);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -164,6 +188,18 @@ bool pFlow::IOfileHeader::readHeader(iIstream& is, bool silent)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( !is.findTokenAndNextSilent("fileFormat", fileFormat_) )
|
||||||
|
{
|
||||||
|
if(!silent)
|
||||||
|
{
|
||||||
|
warningInFunction <<
|
||||||
|
"cannot find/error in reading fileFormat in file "<<
|
||||||
|
is.name()<<endl;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,9 @@ protected:
|
||||||
// object type read from file
|
// object type read from file
|
||||||
word objectType_;
|
word objectType_;
|
||||||
|
|
||||||
|
/// file format read from file
|
||||||
|
word fileFormat_ = "ASCII";
|
||||||
|
|
||||||
//// - methods
|
//// - methods
|
||||||
|
|
||||||
// - input file stream
|
// - input file stream
|
||||||
|
@ -83,6 +86,10 @@ public:
|
||||||
// - path to file name
|
// - path to file name
|
||||||
fileSystem path() const;
|
fileSystem path() const;
|
||||||
|
|
||||||
|
bool outFileBinary()const;
|
||||||
|
|
||||||
|
bool inFileBinary()const;
|
||||||
|
|
||||||
// - should be used for read operations
|
// - should be used for read operations
|
||||||
// check if the file exist,
|
// check if the file exist,
|
||||||
// read the header of the file to check if it is ok
|
// read the header of the file to check if it is ok
|
||||||
|
|
|
@ -65,9 +65,25 @@ bool pFlow::IOobject::read(bool rdHdr)
|
||||||
|
|
||||||
if( implyRead() )
|
if( implyRead() )
|
||||||
{
|
{
|
||||||
|
if( rdHdr )
|
||||||
|
{
|
||||||
|
if( auto ptrIS = inStream(); ptrIS )
|
||||||
|
{
|
||||||
|
if(!readHeader(ptrIS()))return false;
|
||||||
|
ptrIS.reset(nullptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
warningInFunction<<
|
||||||
|
"could not open file " << path() <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( auto ptrIS = inStream(); ptrIS )
|
if( auto ptrIS = inStream(); ptrIS )
|
||||||
{
|
{
|
||||||
return read( ptrIS(), rdHdr);
|
if(!read(ptrIS(), rdHdr))return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -76,6 +92,7 @@ bool pFlow::IOobject::read(bool rdHdr)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,25 @@ Licence:
|
||||||
#include "dictionary.hpp"
|
#include "dictionary.hpp"
|
||||||
#include "vocabs.hpp"
|
#include "vocabs.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
bool pFlow::Time::readDictionary(const dictionary& dict)
|
||||||
|
{
|
||||||
|
auto wF = toUpper(dict.getValOrSet<word>("writeFormat", "ASCII"));
|
||||||
|
|
||||||
|
if(wF == "ASCII")
|
||||||
|
outFormatBinary_ = false;
|
||||||
|
else if(wF == "BINARY")
|
||||||
|
outFormatBinary_ = true;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"Invalid writeFormat in file "<< dict.name()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
pFlow::Time::Time
|
pFlow::Time::Time
|
||||||
(
|
(
|
||||||
repository* owner,
|
repository* owner,
|
||||||
|
@ -45,6 +64,10 @@ pFlow::Time::Time
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(!readDictionary(setiingsDict))
|
||||||
|
{
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::Time::Time(
|
pFlow::Time::Time(
|
||||||
|
@ -75,7 +98,10 @@ pFlow::Time::Time(
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
if(!readDictionary(setiingsDict))
|
||||||
|
{
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::Time::write
|
bool pFlow::Time::write
|
||||||
|
|
|
@ -44,12 +44,17 @@ class Time
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
bool outFormatBinary_ = false;
|
||||||
|
|
||||||
// - geometry folder/repository
|
// - geometry folder/repository
|
||||||
repository geometry_;
|
repository geometry_;
|
||||||
|
|
||||||
// - integration folder/repository
|
// - integration folder/repository
|
||||||
repository integration_;
|
repository integration_;
|
||||||
|
|
||||||
|
|
||||||
|
bool readDictionary(const dictionary& dict);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructor with owner and settings dict
|
// Constructor with owner and settings dict
|
||||||
|
@ -90,6 +95,13 @@ public:
|
||||||
{
|
{
|
||||||
return integration_;
|
return integration_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Write to the file with binary format?
|
||||||
|
bool outFileBinary()const override
|
||||||
|
{
|
||||||
|
return outFormatBinary_;
|
||||||
|
}
|
||||||
|
|
||||||
// override the base write to manage write operation
|
// override the base write to manage write operation
|
||||||
// based on the valid write time intervals
|
// based on the valid write time intervals
|
||||||
virtual bool write(bool verbose = false) const;
|
virtual bool write(bool verbose = false) const;
|
||||||
|
|
|
@ -61,8 +61,16 @@ pFlow::timeControl::timeControl
|
||||||
(
|
(
|
||||||
startTime_,
|
startTime_,
|
||||||
dict.getValOrSet("timersReportInterval", 0.04)
|
dict.getValOrSet("timersReportInterval", 0.04)
|
||||||
|
),
|
||||||
|
performSorting_
|
||||||
|
(
|
||||||
|
dict.getValOrSet("performSorting", Logical("No"))
|
||||||
|
),
|
||||||
|
sortingInterval_
|
||||||
|
(
|
||||||
|
startTime_,
|
||||||
|
dict.getValOrSet("sortingInterval", static_cast<real>(1.0))
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
checkForOutputToFile();
|
checkForOutputToFile();
|
||||||
}
|
}
|
||||||
|
@ -95,6 +103,15 @@ pFlow::timeControl::timeControl(
|
||||||
(
|
(
|
||||||
startTime_,
|
startTime_,
|
||||||
dict.getValOrSet("timersReportInterval", 0.04)
|
dict.getValOrSet("timersReportInterval", 0.04)
|
||||||
|
),
|
||||||
|
performSorting_
|
||||||
|
(
|
||||||
|
dict.getValOrSet("performSorting", Logical("No"))
|
||||||
|
),
|
||||||
|
sortingInterval_
|
||||||
|
(
|
||||||
|
startTime_,
|
||||||
|
dict.getValOrSet("sortingInterval", static_cast<real>(1.0))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
checkForOutputToFile();
|
checkForOutputToFile();
|
||||||
|
@ -160,6 +177,11 @@ bool pFlow::timeControl::timersReportTime()const
|
||||||
return timersReportInterval_.isMember(currentTime_, dt_);
|
return timersReportInterval_.isMember(currentTime_, dt_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool pFlow::timeControl::sortTime()const
|
||||||
|
{
|
||||||
|
return performSorting_()&&sortingInterval_.isMember(currentTime_,dt_);
|
||||||
|
}
|
||||||
|
|
||||||
void pFlow::timeControl::setSaveTimeFolder(
|
void pFlow::timeControl::setSaveTimeFolder(
|
||||||
bool saveToFile,
|
bool saveToFile,
|
||||||
const word& timeName)
|
const word& timeName)
|
||||||
|
|
|
@ -74,9 +74,13 @@ protected:
|
||||||
|
|
||||||
real writeTime_ = 0; // for managedExternamly
|
real writeTime_ = 0; // for managedExternamly
|
||||||
|
|
||||||
realStridedRange timersReportInterval_;
|
realStridedRange timersReportInterval_;
|
||||||
|
|
||||||
int32StridedRagne screenReportInterval_ ={0,100};
|
Logical performSorting_;
|
||||||
|
|
||||||
|
realStridedRange sortingInterval_;
|
||||||
|
|
||||||
|
int32StridedRagne screenReportInterval_ ={0,100};
|
||||||
|
|
||||||
bool outputToFile_ = false;
|
bool outputToFile_ = false;
|
||||||
|
|
||||||
|
@ -165,6 +169,8 @@ public:
|
||||||
|
|
||||||
bool timersReportTime()const;
|
bool timersReportTime()const;
|
||||||
|
|
||||||
|
bool sortTime()const;
|
||||||
|
|
||||||
bool setOutputToFile(real writeTime, const word& timeName)
|
bool setOutputToFile(real writeTime, const word& timeName)
|
||||||
{
|
{
|
||||||
if(managedExternaly_)
|
if(managedExternaly_)
|
||||||
|
|
|
@ -204,7 +204,15 @@ public:
|
||||||
// list of repository names in this repository
|
// list of repository names in this repository
|
||||||
wordList repositoryNames()const;
|
wordList repositoryNames()const;
|
||||||
|
|
||||||
|
|
||||||
//// - IO operations
|
//// - IO operations
|
||||||
|
virtual bool outFileBinary()const
|
||||||
|
{
|
||||||
|
if(owner_)
|
||||||
|
return owner_->outFileBinary();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
virtual bool write(bool verbose = false) const;
|
virtual bool write(bool verbose = false) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,7 +24,7 @@ Licence:
|
||||||
#include "fileStream.hpp"
|
#include "fileStream.hpp"
|
||||||
#include "error.hpp"
|
#include "error.hpp"
|
||||||
|
|
||||||
|
#include "streams.hpp"
|
||||||
|
|
||||||
void pFlow::fileStream::openInFile
|
void pFlow::fileStream::openInFile
|
||||||
(
|
(
|
||||||
|
@ -39,7 +39,12 @@ void pFlow::fileStream::openInFile
|
||||||
fatalExit;
|
fatalExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inStream_ = makeUnique<std::ifstream>( path.wordPath(), std::ios_base::in);
|
if(binary_)
|
||||||
|
inStream_ = makeUnique<std::ifstream>(
|
||||||
|
path.wordPath(), std::ios_base::in | std::ios_base::binary);
|
||||||
|
else
|
||||||
|
inStream_ = makeUnique<std::ifstream>(
|
||||||
|
path.wordPath(), std::ios_base::in);
|
||||||
|
|
||||||
if( !inStream_->is_open())
|
if( !inStream_->is_open())
|
||||||
{
|
{
|
||||||
|
@ -66,7 +71,15 @@ void pFlow::fileStream::openOutFile
|
||||||
dir.createDirs();
|
dir.createDirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
outStream_ = makeUnique< std::ofstream>(path.wordPath(), std::ios_base::out);
|
if(binary_)
|
||||||
|
{
|
||||||
|
outStream_ = makeUnique< std::ofstream>(
|
||||||
|
path.wordPath(), std::ios_base::out| std::ios::binary);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outStream_ = makeUnique< std::ofstream>(
|
||||||
|
path.wordPath(), std::ios_base::out);
|
||||||
|
|
||||||
|
|
||||||
if(!outStream_->is_open())
|
if(!outStream_->is_open())
|
||||||
{
|
{
|
||||||
|
@ -92,11 +105,13 @@ void pFlow::fileStream::close()
|
||||||
pFlow::fileStream::fileStream
|
pFlow::fileStream::fileStream
|
||||||
(
|
(
|
||||||
const fileSystem& path,
|
const fileSystem& path,
|
||||||
bool outStream
|
bool outStream,
|
||||||
|
bool binary
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
inStream_(nullptr),
|
inStream_(nullptr),
|
||||||
outStream_(nullptr)
|
outStream_(nullptr),
|
||||||
|
binary_(binary)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(outStream)
|
if(outStream)
|
||||||
|
|
|
@ -43,6 +43,8 @@ protected:
|
||||||
// - out file stream
|
// - out file stream
|
||||||
uniquePtr<std::ofstream> outStream_;
|
uniquePtr<std::ofstream> outStream_;
|
||||||
|
|
||||||
|
bool binary_ = false;
|
||||||
|
|
||||||
// - open input file
|
// - open input file
|
||||||
void openInFile(const fileSystem& path);
|
void openInFile(const fileSystem& path);
|
||||||
|
|
||||||
|
@ -56,7 +58,7 @@ public:
|
||||||
|
|
||||||
// - Constructors
|
// - Constructors
|
||||||
|
|
||||||
fileStream( const fileSystem& path, bool outStream = false);
|
fileStream( const fileSystem& path, bool outStream = false, bool binary = false);
|
||||||
|
|
||||||
fileStream(const fileStream&)= delete;
|
fileStream(const fileStream&)= delete;
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,17 @@ Licence:
|
||||||
#include "iFstream.hpp"
|
#include "iFstream.hpp"
|
||||||
|
|
||||||
|
|
||||||
pFlow::iFstream::iFstream (const fileSystem& path)
|
pFlow::iFstream::iFstream
|
||||||
|
(
|
||||||
|
const fileSystem& path,
|
||||||
|
bool binary)
|
||||||
:
|
:
|
||||||
fileStream(path),
|
fileStream(path, false, binary),
|
||||||
Istream( fileStream::inStream(), path.wordPath())
|
Istream
|
||||||
|
(
|
||||||
|
fileStream::inStream(),
|
||||||
|
path.wordPath(),
|
||||||
|
(binary)? BINARY : ASCII
|
||||||
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
|
@ -40,7 +40,7 @@ class iFstream
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// - Constructor
|
// - Constructor
|
||||||
iFstream (const fileSystem& path);
|
iFstream (const fileSystem& path, bool binary = false);
|
||||||
|
|
||||||
// no copy constructor
|
// no copy constructor
|
||||||
iFstream( const iFstream& src) = delete;
|
iFstream( const iFstream& src) = delete;
|
||||||
|
|
|
@ -24,11 +24,13 @@ Licence:
|
||||||
#include "oFstream.hpp"
|
#include "oFstream.hpp"
|
||||||
|
|
||||||
|
|
||||||
pFlow::oFstream::oFstream (const fileSystem& path)
|
pFlow::oFstream::oFstream (const fileSystem& path, bool binary)
|
||||||
:
|
:
|
||||||
fileStream(path, true),
|
fileStream(path, true, binary),
|
||||||
Ostream( fileStream::outStream(), path.wordPath())
|
Ostream
|
||||||
{
|
(
|
||||||
|
fileStream::outStream(),
|
||||||
|
path.wordPath(),
|
||||||
}
|
(binary)? BINARY : ASCII
|
||||||
|
)
|
||||||
|
{}
|
|
@ -41,7 +41,7 @@ class oFstream
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
oFstream (const fileSystem& path);
|
oFstream (const fileSystem& path, bool binary = false);
|
||||||
|
|
||||||
// no copy constructor
|
// no copy constructor
|
||||||
oFstream( const oFstream& src) = delete;
|
oFstream( const oFstream& src) = delete;
|
||||||
|
|
|
@ -307,10 +307,11 @@ pFlow::Istream& pFlow::Istream::readVariable(word& str)
|
||||||
pFlow::Istream::Istream
|
pFlow::Istream::Istream
|
||||||
(
|
(
|
||||||
std::istream& is,
|
std::istream& is,
|
||||||
const word& streamName
|
const word& streamName,
|
||||||
|
writeFormat wf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
iIstream(),
|
iIstream(wf),
|
||||||
name_(streamName),
|
name_(streamName),
|
||||||
is_(is)
|
is_(is)
|
||||||
{
|
{
|
||||||
|
@ -846,6 +847,26 @@ pFlow::iIstream& pFlow::Istream::read(double& val)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pFlow::iIstream& pFlow::Istream::read
|
||||||
|
(
|
||||||
|
char* buffer,
|
||||||
|
std::streamsize count
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if ( !isBinary() )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"stream format is not binray. Stream name is "<<
|
||||||
|
name()<<'\n';
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
|
||||||
|
readBegin("binaryBlock");
|
||||||
|
is_.read(buffer, count);
|
||||||
|
readEnd("binaryBlock");
|
||||||
|
|
||||||
|
setState(is_.rdstate());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
void pFlow::Istream::rewind()
|
void pFlow::Istream::rewind()
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,8 +65,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
//- Construct wrapper around std::istream, set stream status
|
//- Construct wrapper around std::istream, set stream status
|
||||||
Istream( std::istream& is, const word& streamName);
|
Istream( std::istream& is, const word& streamName, writeFormat wf = ASCII);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~Istream() = default;
|
virtual ~Istream() = default;
|
||||||
|
@ -150,6 +149,8 @@ public:
|
||||||
//- Read a double
|
//- Read a double
|
||||||
virtual iIstream& read(double& val) override;
|
virtual iIstream& read(double& val) override;
|
||||||
|
|
||||||
|
iIstream& read(char* buffer, std::streamsize count) override;
|
||||||
|
|
||||||
|
|
||||||
//- Rewind the stream so that it may be read again
|
//- Rewind the stream so that it may be read again
|
||||||
virtual void rewind();
|
virtual void rewind();
|
||||||
|
|
|
@ -28,10 +28,11 @@ Licence:
|
||||||
pFlow::Ostream::Ostream
|
pFlow::Ostream::Ostream
|
||||||
(
|
(
|
||||||
std::ostream& os,
|
std::ostream& os,
|
||||||
const word& streamName
|
const word& streamName,
|
||||||
|
writeFormat wF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
iOstream(),
|
iOstream(wF),
|
||||||
name_(streamName),
|
name_(streamName),
|
||||||
os_(os)
|
os_(os)
|
||||||
{
|
{
|
||||||
|
@ -230,6 +231,29 @@ pFlow::iOstream& pFlow::Ostream::write(const double val)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pFlow::iOstream& pFlow::Ostream::write
|
||||||
|
(
|
||||||
|
const char* binaryData,
|
||||||
|
std::streamsize count
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if ( !isBinary() )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"stream format is not binray. Stream name is "<<
|
||||||
|
name()<<'\n';
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
|
||||||
|
os_ << token::BEGIN_LIST;
|
||||||
|
os_.write(binaryData, count);
|
||||||
|
os_ << token::END_LIST;
|
||||||
|
|
||||||
|
setState(os_.rdstate());
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void pFlow::Ostream::indent()
|
void pFlow::Ostream::indent()
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
Ostream ( std::ostream& os, const word& streamName);
|
Ostream ( std::ostream& os, const word& streamName, writeFormat wf = ASCII);
|
||||||
|
|
||||||
//- no copy construct
|
//- no copy construct
|
||||||
Ostream(const Ostream&) = delete;
|
Ostream(const Ostream&) = delete;
|
||||||
|
@ -75,76 +75,77 @@ public:
|
||||||
|
|
||||||
//- Write token to stream or otherwise handle it.
|
//- Write token to stream or otherwise handle it.
|
||||||
// return false if the token type was not handled by this method
|
// return false if the token type was not handled by this method
|
||||||
virtual bool write(const token& tok)override;
|
bool write(const token& tok)override;
|
||||||
|
|
||||||
//- Write character
|
//- Write character
|
||||||
virtual iOstream& write(const char c)override;
|
iOstream& write(const char c)override;
|
||||||
|
|
||||||
//- Write character string
|
//- Write character string
|
||||||
virtual iOstream& write(const char* str)override;
|
iOstream& write(const char* str)override;
|
||||||
|
|
||||||
//- Write word
|
//- Write word
|
||||||
virtual iOstream& write(const word& str)override;
|
iOstream& write(const word& str)override;
|
||||||
|
|
||||||
//- Write std::string surrounded by quotes.
|
//- Write std::string surrounded by quotes.
|
||||||
// Optional write without quotes.
|
// Optional write without quotes.
|
||||||
virtual iOstream& writeQuoted ( const word& str, const bool quoted=true )override;
|
iOstream& writeQuoted ( const word& str, const bool quoted=true ) override;
|
||||||
|
|
||||||
//- Write int64
|
//- Write int64
|
||||||
virtual iOstream& write(const int64 val) override;
|
iOstream& write(const int64 val) override;
|
||||||
|
|
||||||
//- Write int32
|
//- Write int32
|
||||||
virtual iOstream& write(const int32 val) override;
|
iOstream& write(const int32 val) override;
|
||||||
|
|
||||||
|
|
||||||
//- Write label
|
//- Write label
|
||||||
virtual iOstream& write(const label val) override;
|
iOstream& write(const label val) override;
|
||||||
|
|
||||||
//- Write uint32
|
//- Write uint32
|
||||||
virtual iOstream& write(const uint32 val) override;
|
iOstream& write(const uint32 val) override;
|
||||||
|
|
||||||
//- Write uint16
|
//- Write uint16
|
||||||
virtual iOstream& write(const uint16 val) override;
|
iOstream& write(const uint16 val) override;
|
||||||
|
|
||||||
//- Write float
|
//- Write float
|
||||||
virtual iOstream& write(const float val) override;
|
iOstream& write(const float val) override;
|
||||||
|
|
||||||
//- Write double
|
//- Write double
|
||||||
virtual iOstream& write(const double val) override;
|
iOstream& write(const double val) override;
|
||||||
|
|
||||||
|
/// Write a block of binray data
|
||||||
|
iOstream& write(const char* binaryData, std::streamsize count) override;
|
||||||
|
|
||||||
//- Add indentation characters
|
//- Add indentation characters
|
||||||
virtual void indent();
|
void indent() override;
|
||||||
|
|
||||||
|
|
||||||
//- Set stream flags
|
//- Set stream flags
|
||||||
virtual ios_base::fmtflags flags(const ios_base::fmtflags f);
|
ios_base::fmtflags flags(const ios_base::fmtflags f) override;
|
||||||
|
|
||||||
//- Flush stream
|
//- Flush stream
|
||||||
virtual void flush();
|
void flush() override;
|
||||||
|
|
||||||
//- Add newline and flush stream
|
//- Add newline and flush stream
|
||||||
virtual void endl();
|
void endl() override;
|
||||||
|
|
||||||
//- Get the current padding character
|
//- Get the current padding character
|
||||||
virtual char fill() const;
|
char fill() const override;
|
||||||
|
|
||||||
//- Set padding character for formatted field up to field width
|
//- Set padding character for formatted field up to field width
|
||||||
// \return previous padding character
|
// \return previous padding character
|
||||||
virtual char fill(const char fillch);
|
char fill(const char fillch) override;
|
||||||
|
|
||||||
//- Get width of output field
|
//- Get width of output field
|
||||||
virtual int width() const;
|
int width() const override;
|
||||||
|
|
||||||
//- Set width of output field
|
//- Set width of output field
|
||||||
// \return previous width
|
// \return previous width
|
||||||
virtual int width(const int w);
|
int width(const int w) override;
|
||||||
|
|
||||||
//- Get precision of output field
|
//- Get precision of output field
|
||||||
virtual int precision() const;
|
int precision() const override;
|
||||||
|
|
||||||
//- Set precision of output field
|
//- Set precision of output field
|
||||||
// return old precision
|
// return old precision
|
||||||
virtual int precision(const int p);
|
int precision(const int p) override;
|
||||||
|
|
||||||
//- Access to underlying std::ostream
|
//- Access to underlying std::ostream
|
||||||
virtual std::ostream& stdStream()
|
virtual std::ostream& stdStream()
|
||||||
|
|
|
@ -302,7 +302,15 @@ pFlow::iIstream& pFlow::iTstream::read
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pFlow::iIstream& pFlow::iTstream::read
|
||||||
|
(
|
||||||
|
char* buffer,
|
||||||
|
std::streamsize count
|
||||||
|
)
|
||||||
|
{
|
||||||
|
notImplementedFunction;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
void pFlow::iTstream::rewind()
|
void pFlow::iTstream::rewind()
|
||||||
{
|
{
|
||||||
|
|
|
@ -123,6 +123,8 @@ public:
|
||||||
//- Read a doubleScalar
|
//- Read a doubleScalar
|
||||||
virtual iIstream& read(double&) override;
|
virtual iIstream& read(double&) override;
|
||||||
|
|
||||||
|
iIstream& read(char* buffer, std::streamsize count) override;
|
||||||
|
|
||||||
// - Rewind the stream so that it may be read again
|
// - Rewind the stream so that it may be read again
|
||||||
virtual void rewind();
|
virtual void rewind();
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,15 @@ pFlow::iOstream& pFlow::oTstream::write(const double val)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pFlow::iOstream& pFlow::oTstream::write
|
||||||
|
(
|
||||||
|
const char* binaryData,
|
||||||
|
std::streamsize count
|
||||||
|
)
|
||||||
|
{
|
||||||
|
notImplementedFunction;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void pFlow::oTstream::append(const token& tok)
|
void pFlow::oTstream::append(const token& tok)
|
||||||
|
|
|
@ -102,6 +102,11 @@ public:
|
||||||
//- Write double
|
//- Write double
|
||||||
virtual iOstream& write(const double val) override;
|
virtual iOstream& write(const double val) override;
|
||||||
|
|
||||||
|
/// Write a block of binray data
|
||||||
|
iOstream& write(
|
||||||
|
const char* binaryData,
|
||||||
|
std::streamsize count) override;
|
||||||
|
|
||||||
// - append token to the stream
|
// - append token to the stream
|
||||||
virtual void append(const token& tok);
|
virtual void append(const token& tok);
|
||||||
|
|
||||||
|
|
|
@ -50,226 +50,260 @@ public:
|
||||||
|
|
||||||
enum streamAccess : char
|
enum streamAccess : char
|
||||||
{
|
{
|
||||||
CLOSED = 0, //!< stream is not open
|
CLOSED = 0, /// stream is not open
|
||||||
OPENED //!< stream is open
|
OPENED /// stream is open
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum writeFormat: char
|
||||||
|
{
|
||||||
|
ASCII = 0,
|
||||||
|
BINARY
|
||||||
|
};
|
||||||
|
|
||||||
//- Default precision
|
/// Default precision, only works for ASCII
|
||||||
static unsigned int precision_;
|
static unsigned int precision_;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//- Name for any generic stream - normally treat as readonly
|
/// Name for any generic stream - normally treat as readonly
|
||||||
static word staticName_;
|
static word staticName_;
|
||||||
|
|
||||||
|
/// Is stream open or closed
|
||||||
streamAccess openClosed_;
|
streamAccess openClosed_;
|
||||||
|
|
||||||
|
/// write format
|
||||||
|
writeFormat writeFormat_ = ASCII;
|
||||||
|
|
||||||
|
/// state
|
||||||
ios_base::iostate ioState_;
|
ios_base::iostate ioState_;
|
||||||
|
|
||||||
|
|
||||||
//- The file line
|
/// The file line
|
||||||
int32 lineNumber_;
|
int32 lineNumber_;
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
//- Protected Member Functions
|
||||||
|
|
||||||
//- Set stream opened
|
/// Set stream opened
|
||||||
void setOpened()
|
void setOpened()
|
||||||
{
|
{
|
||||||
openClosed_ = OPENED;
|
openClosed_ = OPENED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Set stream closed
|
/// Set stream closed
|
||||||
void setClosed()
|
void setClosed()
|
||||||
{
|
{
|
||||||
openClosed_ = CLOSED;
|
openClosed_ = CLOSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Set stream state
|
/// Set stream state
|
||||||
void setState(ios_base::iostate state)
|
void setState(ios_base::iostate state)
|
||||||
{
|
{
|
||||||
ioState_ = state;
|
ioState_ = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Set stream to be good
|
void setWriteFormat(writeFormat wF)
|
||||||
void setGood()
|
{
|
||||||
{
|
writeFormat_ = wF;
|
||||||
ioState_ = ios_base::iostate(0);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/// Set stream to be good
|
||||||
|
void setGood()
|
||||||
|
{
|
||||||
|
ioState_ = ios_base::iostate(0);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
//- Constructors
|
||||||
explicit IOstream():
|
|
||||||
openClosed_(CLOSED),
|
|
||||||
ioState_(ios_base::iostate(0)),
|
|
||||||
lineNumber_(0)
|
|
||||||
{
|
|
||||||
setBad();
|
|
||||||
}
|
|
||||||
|
|
||||||
IOstream(const IOstream&) = default;
|
/// Default
|
||||||
|
explicit IOstream():
|
||||||
|
openClosed_(CLOSED),
|
||||||
|
writeFormat_(ASCII),
|
||||||
|
ioState_(ios_base::iostate(0)),
|
||||||
|
lineNumber_(0)
|
||||||
|
{
|
||||||
|
setBad();
|
||||||
|
}
|
||||||
|
|
||||||
//- Destructor
|
/// Construct and set write format
|
||||||
virtual ~IOstream() = default;
|
explicit IOstream(writeFormat wF):
|
||||||
|
openClosed_(CLOSED),
|
||||||
|
writeFormat_(wF),
|
||||||
|
ioState_(ios_base::iostate(0)),
|
||||||
|
lineNumber_(0)
|
||||||
|
{
|
||||||
|
setBad();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Copy
|
||||||
|
IOstream(const IOstream&) = default;
|
||||||
|
|
||||||
|
/// Destructor
|
||||||
|
virtual ~IOstream() = default;
|
||||||
|
|
||||||
|
|
||||||
//// Member Functions
|
//- Member Functions
|
||||||
|
|
||||||
//- Return the name of the stream
|
/// Return the name of the stream
|
||||||
virtual const word& name() const;
|
virtual const word& name() const;
|
||||||
|
|
||||||
//- Return non-const access to the name of the stream
|
/// Return non-const access to the name of the stream
|
||||||
virtual word& name();
|
virtual word& name();
|
||||||
|
|
||||||
//- Check IOstream status for given operation.
|
/// Check IOstream status for given operation.
|
||||||
// Print IOstream state or generate a FatalIOError
|
/// Print IOstream state or generate a FatalIOError
|
||||||
// when an error has occurred.
|
/// when an error has occurred.
|
||||||
// The base implementation is a fatalCheck
|
/// The base implementation is a fatalCheck
|
||||||
virtual bool check(const char* operation) const;
|
virtual bool check(const char* operation) const;
|
||||||
|
|
||||||
//- Check IOstream status for given operation.
|
/// Check IOstream status for given operation.
|
||||||
// Generate a FatalIOError when an error has occurred.
|
/// Generate a FatalIOError when an error has occurred.
|
||||||
bool fatalCheck(const char* operation) const;
|
bool fatalCheck(const char* operation) const;
|
||||||
|
|
||||||
//- Return true if stream has been opened
|
/// Return true if stream has been opened
|
||||||
bool opened() const
|
bool opened() const
|
||||||
{
|
{
|
||||||
return openClosed_ == OPENED;
|
return openClosed_ == OPENED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if stream is closed
|
/// Return true if stream is closed
|
||||||
bool closed() const
|
bool closed() const
|
||||||
{
|
{
|
||||||
return openClosed_ == CLOSED;
|
return openClosed_ == CLOSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if next operation might succeed
|
/// Return true if stream format is binray
|
||||||
bool good() const
|
bool isBinary()const
|
||||||
{
|
{
|
||||||
return ioState_ == 0;
|
return writeFormat_ == BINARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if end of input seen
|
/// Return true if next operation might succeed
|
||||||
bool eof() const
|
bool good() const
|
||||||
{
|
{
|
||||||
return ioState_ & ios_base::eofbit;
|
return ioState_ == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if next operation will fail
|
/// Return true if end of input seen
|
||||||
bool fail() const
|
bool eof() const
|
||||||
{
|
{
|
||||||
return ioState_ & (ios_base::badbit | ios_base::failbit);
|
return ioState_ & ios_base::eofbit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if stream is corrupted
|
/// Return true if next operation will fail
|
||||||
bool bad() const
|
bool fail() const
|
||||||
{
|
{
|
||||||
return ioState_ & ios_base::badbit;
|
return ioState_ & (ios_base::badbit | ios_base::failbit);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if the stream has not failed
|
/// Return true if stream is corrupted
|
||||||
explicit operator bool() const
|
bool bad() const
|
||||||
{
|
{
|
||||||
return !fail();
|
return ioState_ & ios_base::badbit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if the stream has failed
|
/// Return true if the stream has not failed
|
||||||
bool operator!() const
|
explicit operator bool() const
|
||||||
{
|
{
|
||||||
return fail();
|
return !fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return true if the stream has failed
|
||||||
|
bool operator!() const
|
||||||
|
{
|
||||||
|
return fail();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Const access to the current stream line number
|
/// Const access to the current stream line number
|
||||||
int32 lineNumber() const
|
int32 lineNumber() const
|
||||||
{
|
{
|
||||||
return lineNumber_;
|
return lineNumber_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Non-const access to the current stream line number
|
/// Non-const access to the current stream line number
|
||||||
int32& lineNumber()
|
int32& lineNumber()
|
||||||
{
|
{
|
||||||
return lineNumber_;
|
return lineNumber_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Set the stream line number
|
/// Set the stream line number
|
||||||
// \return the previous value
|
/// return the previous value
|
||||||
int32 lineNumber(const int32 num)
|
int32 lineNumber(const int32 num)
|
||||||
{
|
{
|
||||||
const int32 old(lineNumber_);
|
const int32 old(lineNumber_);
|
||||||
lineNumber_ = num;
|
lineNumber_ = num;
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return flags of stream
|
/// Return flags of stream
|
||||||
virtual ios_base::fmtflags flags() const = 0;
|
virtual ios_base::fmtflags flags() const = 0;
|
||||||
|
|
||||||
//- Return the default precision
|
/// Return the default precision
|
||||||
static unsigned int defaultPrecision()
|
static unsigned int defaultPrecision()
|
||||||
{
|
{
|
||||||
return precision_;
|
return precision_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Reset the default precision
|
/// Reset the default precision
|
||||||
// \return the previous value
|
/// return the previous value
|
||||||
static unsigned int defaultPrecision(unsigned int prec)
|
static unsigned int defaultPrecision(unsigned int prec)
|
||||||
{
|
{
|
||||||
unsigned int old(precision_);
|
unsigned int old(precision_);
|
||||||
precision_ = prec;
|
precision_ = prec;
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Set stream to have reached eof
|
/// Set stream to have reached eof
|
||||||
void setEof()
|
void setEof()
|
||||||
{
|
{
|
||||||
ioState_ |= ios_base::eofbit;
|
ioState_ |= ios_base::eofbit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Set stream to have failed
|
/// Set stream to have failed
|
||||||
void setFail()
|
void setFail()
|
||||||
{
|
{
|
||||||
ioState_ |= ios_base::failbit;
|
ioState_ |= ios_base::failbit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Set stream to be bad
|
/// Set stream to be bad
|
||||||
void setBad()
|
void setBad()
|
||||||
{
|
{
|
||||||
ioState_ |= ios_base::badbit;
|
ioState_ |= ios_base::badbit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Set flags of stream
|
/// Set flags of stream
|
||||||
virtual ios_base::fmtflags flags(const ios_base::fmtflags f) = 0;
|
virtual ios_base::fmtflags flags(const ios_base::fmtflags f) = 0;
|
||||||
|
|
||||||
//- Set flags of stream
|
/// Set flags of stream
|
||||||
ios_base::fmtflags setf(const ios_base::fmtflags f)
|
ios_base::fmtflags setf(const ios_base::fmtflags f)
|
||||||
{
|
{
|
||||||
return flags(flags() | f);
|
return flags(flags() | f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Set flags of given field of stream
|
/// Set flags of given field of stream
|
||||||
ios_base::fmtflags setf
|
ios_base::fmtflags setf
|
||||||
(
|
(
|
||||||
const ios_base::fmtflags f,
|
const ios_base::fmtflags f,
|
||||||
const ios_base::fmtflags mask
|
const ios_base::fmtflags mask
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return flags((flags() & ~mask) | (f & mask));
|
return flags((flags() & ~mask) | (f & mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Unset flags of stream
|
/// Unset flags of stream
|
||||||
void unsetf(const ios_base::fmtflags f)
|
void unsetf(const ios_base::fmtflags f)
|
||||||
{
|
{
|
||||||
flags(flags() & ~f);
|
flags(flags() & ~f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}; // end of IOstream
|
}; // end of IOstream
|
||||||
|
|
||||||
|
|
||||||
//- An IOstream manipulator
|
/// An IOstream manipulator
|
||||||
typedef IOstream& (*IOstreamManip)(IOstream&);
|
typedef IOstream& (*IOstreamManip)(IOstream&);
|
||||||
|
|
||||||
inline IOstream& dec(IOstream& io)
|
inline IOstream& dec(IOstream& io)
|
||||||
|
|
|
@ -60,6 +60,11 @@ bool pFlow::iIstream::peekBack(token& tok)
|
||||||
bool pFlow::iIstream::findToken( const word & w )
|
bool pFlow::iIstream::findToken( const word & w )
|
||||||
{
|
{
|
||||||
rewind();
|
rewind();
|
||||||
|
return findTokenResume(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::iIstream::findTokenResume(const word& w)
|
||||||
|
{
|
||||||
token next;
|
token next;
|
||||||
bool isFirstToken = true;
|
bool isFirstToken = true;
|
||||||
|
|
||||||
|
@ -74,8 +79,6 @@ bool pFlow::iIstream::findToken( const word & w )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if( next.isWord() && isFirstToken)
|
if( next.isWord() && isFirstToken)
|
||||||
{
|
{
|
||||||
if(next.wordToken() == w ) return true;
|
if(next.wordToken() == w ) return true;
|
||||||
|
@ -93,6 +96,11 @@ bool pFlow::iIstream::findToken( const word & w )
|
||||||
bool pFlow::iIstream::findTokenSilent( const word & w, int32 limitLine )
|
bool pFlow::iIstream::findTokenSilent( const word & w, int32 limitLine )
|
||||||
{
|
{
|
||||||
rewind();
|
rewind();
|
||||||
|
return findTokenResumeSilent(w,limitLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::iIstream::findTokenResumeSilent( const word & w, int32 limitLine )
|
||||||
|
{
|
||||||
token next;
|
token next;
|
||||||
bool isFirstToken = true;
|
bool isFirstToken = true;
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,11 @@ public:
|
||||||
putBack_(false)
|
putBack_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
iIstream(writeFormat wf):
|
||||||
|
IOstream(wf),
|
||||||
|
putBack_(false)
|
||||||
|
{}
|
||||||
|
|
||||||
// - Copy construct
|
// - Copy construct
|
||||||
iIstream(const iIstream&) = default;
|
iIstream(const iIstream&) = default;
|
||||||
|
|
||||||
|
@ -122,6 +127,8 @@ public:
|
||||||
//- Read a doubleScalar
|
//- Read a doubleScalar
|
||||||
virtual iIstream& read(double&) = 0;
|
virtual iIstream& read(double&) = 0;
|
||||||
|
|
||||||
|
virtual iIstream& read(char* buffer, std::streamsize count) =0;
|
||||||
|
|
||||||
|
|
||||||
//- Rewind the stream so that it may be read again
|
//- Rewind the stream so that it may be read again
|
||||||
virtual void rewind() = 0;
|
virtual void rewind() = 0;
|
||||||
|
@ -132,10 +139,18 @@ public:
|
||||||
// - search for all tokesn and find the first word token tbat matchs w
|
// - search for all tokesn and find the first word token tbat matchs w
|
||||||
virtual bool findToken( const word & w );
|
virtual bool findToken( const word & w );
|
||||||
|
|
||||||
|
/// search for all tokesn after the current file position
|
||||||
|
/// and find the first word token tbat matchs w
|
||||||
|
virtual bool findTokenResume(const word& w);
|
||||||
|
|
||||||
|
|
||||||
// - search for all tokesn and find the first word token that matchs
|
// - search for all tokesn and find the first word token that matchs
|
||||||
virtual bool findTokenSilent( const word & w, int32 limitLine = 100 );
|
virtual bool findTokenSilent( const word & w, int32 limitLine = 100 );
|
||||||
|
|
||||||
|
/// search for all tokesn after the current file position
|
||||||
|
/// and find the first word token tbat matchs w
|
||||||
|
virtual bool findTokenResumeSilent( const word & w, int32 limitLine = 100 );
|
||||||
|
|
||||||
// - search for all tokens and find the first word token and also next word token
|
// - search for all tokens and find the first word token and also next word token
|
||||||
// chekck if it is eneded with end statement ;
|
// chekck if it is eneded with end statement ;
|
||||||
virtual bool findTokenAndNext( const word& w, word& nextW, bool checkEndStatement = true);
|
virtual bool findTokenAndNext( const word& w, word& nextW, bool checkEndStatement = true);
|
||||||
|
|
|
@ -58,219 +58,227 @@ protected:
|
||||||
|
|
||||||
// Protected Data
|
// Protected Data
|
||||||
|
|
||||||
//- Indentation of the entry from the start of the keyword
|
/// Indentation of the entry from the start of the keyword
|
||||||
static constexpr const unsigned short entryIndentation_ = 16;
|
static constexpr const unsigned short entryIndentation_ = 16;
|
||||||
|
|
||||||
//- Number of spaces per indent level
|
/// Number of spaces per indent level
|
||||||
unsigned short indentSize_ = 4;
|
unsigned short indentSize_ = 4;
|
||||||
|
|
||||||
//- Current indent level
|
/// Current indent level
|
||||||
unsigned short indentLevel_ = 0;
|
unsigned short indentLevel_ = 0;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
// Constructor
|
// Constructors
|
||||||
explicit iOstream()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Copy construct
|
/// Default
|
||||||
iOstream(const iOstream&) = default;
|
explicit iOstream()
|
||||||
|
{}
|
||||||
|
|
||||||
//- Destructor
|
/// Construct from writeFormat
|
||||||
virtual ~iOstream() = default;
|
explicit iOstream(writeFormat wF):
|
||||||
|
IOstream(wF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/// Copy construct
|
||||||
|
iOstream(const iOstream&) = default;
|
||||||
|
|
||||||
|
/// Destructor
|
||||||
|
virtual ~iOstream() = default;
|
||||||
|
|
||||||
|
|
||||||
// Write Functions
|
/// Write Functions
|
||||||
|
|
||||||
//- Write token to stream or otherwise handle it.
|
/// Write token to stream or otherwise handle it.
|
||||||
// \return false if the token type was not handled by this method
|
/// return false if the token type was not handled by this method
|
||||||
virtual bool write(const token& tok) = 0;
|
virtual bool write(const token& tok) = 0;
|
||||||
|
|
||||||
//- Write character
|
/// Write character
|
||||||
virtual iOstream& write(const char c) = 0;
|
virtual iOstream& write(const char c) = 0;
|
||||||
|
|
||||||
//- Write character string
|
/// Write character string
|
||||||
virtual iOstream& write(const char* str) = 0;
|
virtual iOstream& write(const char* str) = 0;
|
||||||
|
|
||||||
//- Write word
|
/// Write word
|
||||||
virtual iOstream& write(const word& str) = 0;
|
virtual iOstream& write(const word& str) = 0;
|
||||||
|
|
||||||
|
/// Write std::string surrounded by quotes.
|
||||||
|
/// Optional write without quotes.
|
||||||
|
virtual iOstream& writeQuoted
|
||||||
|
(
|
||||||
|
const word& str,
|
||||||
|
const bool quoted=true
|
||||||
|
) = 0;
|
||||||
|
|
||||||
|
/// Write int64
|
||||||
|
virtual iOstream& write(const int64 val) = 0;
|
||||||
|
|
||||||
|
/// Write int32
|
||||||
|
virtual iOstream& write(const int32 val) = 0;
|
||||||
|
|
||||||
|
/// Write label
|
||||||
|
virtual iOstream& write(const label val) = 0;
|
||||||
|
|
||||||
|
/// Write uint32
|
||||||
|
virtual iOstream& write(const uint32 val) = 0;
|
||||||
|
|
||||||
|
/// Write uint16
|
||||||
|
virtual iOstream& write(const uint16 val) = 0;
|
||||||
|
|
||||||
|
/// Write float
|
||||||
|
virtual iOstream& write(const float val) = 0;
|
||||||
|
|
||||||
|
/// Write double
|
||||||
|
virtual iOstream& write(const double val) = 0;
|
||||||
|
|
||||||
|
/// Write a block of binray data
|
||||||
|
virtual iOstream& write(const char* binaryData, std::streamsize count) = 0;
|
||||||
|
|
||||||
|
|
||||||
//- Write std::string surrounded by quotes.
|
// - Indent
|
||||||
// Optional write without quotes.
|
|
||||||
virtual iOstream& writeQuoted
|
/// Add indentation characters
|
||||||
(
|
virtual void indent() = 0;
|
||||||
const word& str,
|
|
||||||
const bool quoted=true
|
/// Return indent level
|
||||||
) = 0;
|
unsigned short indentSize() const
|
||||||
|
{
|
||||||
|
return indentSize_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Access to indent size
|
||||||
|
unsigned short& indentSize()
|
||||||
|
{
|
||||||
|
return indentSize_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return indent level
|
||||||
|
unsigned short indentLevel() const
|
||||||
|
{
|
||||||
|
return indentLevel_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Access to indent level
|
||||||
|
unsigned short& indentLevel()
|
||||||
|
{
|
||||||
|
return indentLevel_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Increment the indent level
|
||||||
|
void incrIndent()
|
||||||
|
{
|
||||||
|
++indentLevel_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Decrement the indent level
|
||||||
|
void decrIndent();
|
||||||
|
|
||||||
|
//- Punctuations
|
||||||
|
|
||||||
|
/// Write begin block group with a name
|
||||||
|
/// Increments indentation, adds newline.
|
||||||
|
virtual iOstream& beginBlock(const word& kw);
|
||||||
|
|
||||||
|
/// Write begin block group without a name
|
||||||
|
/// Increments indentation, adds newline.
|
||||||
|
virtual iOstream& beginBlock();
|
||||||
|
|
||||||
|
/// Write end block group
|
||||||
|
/// Decrements indentation, adds newline.
|
||||||
|
virtual iOstream& endBlock();
|
||||||
|
|
||||||
|
/// Write begin list "("
|
||||||
|
virtual iOstream& beginList();
|
||||||
|
|
||||||
|
/// Write begin list with keyword "kw ("
|
||||||
|
virtual iOstream& beginList(const word& kw);
|
||||||
|
|
||||||
|
/// Write end list ")"
|
||||||
|
virtual iOstream& endList();
|
||||||
|
|
||||||
|
/// Write begin list "["
|
||||||
|
virtual iOstream& beginSquare();
|
||||||
|
|
||||||
|
/// Write begin list with keyword "kw ["
|
||||||
|
virtual iOstream& beginSquare(const word& kw);
|
||||||
|
|
||||||
|
/// Write end list "]"
|
||||||
|
virtual iOstream& endSquare();
|
||||||
|
|
||||||
|
/// Write end entry (';') followed by newline.
|
||||||
|
virtual iOstream& endEntry();
|
||||||
|
|
||||||
|
/// Write a newLine to stream
|
||||||
|
virtual iOstream& newLine();
|
||||||
|
|
||||||
|
/// Write space to stream
|
||||||
|
virtual iOstream& space(int32 n=1);
|
||||||
|
|
||||||
|
/// Write the keyword followed by an appropriate indentation
|
||||||
|
virtual iOstream& writeWordKeyword(const word& kw);
|
||||||
|
|
||||||
|
/// Write a keyword/value entry.
|
||||||
|
template<class T>
|
||||||
|
iOstream& writeWordEntry(const word& key, const T& value)
|
||||||
|
{
|
||||||
|
writeWordKeyword(key) << value;
|
||||||
|
return endEntry();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Write int64
|
//- Stream state functions
|
||||||
virtual iOstream& write(const int64 val) = 0;
|
|
||||||
|
|
||||||
//- Write int32
|
/// Flush stream
|
||||||
virtual iOstream& write(const int32 val) = 0;
|
virtual void flush() = 0;
|
||||||
|
|
||||||
//- Write label
|
/// Add newline and flush stream
|
||||||
virtual iOstream& write(const label val) = 0;
|
virtual void endl() = 0;
|
||||||
|
|
||||||
//- Write uint32
|
/// Get padding character
|
||||||
virtual iOstream& write(const uint32 val) = 0;
|
virtual char fill() const = 0;
|
||||||
|
|
||||||
//- Write uint16
|
/// Set padding character for formatted field up to field width
|
||||||
virtual iOstream& write(const uint16 val) = 0;
|
virtual char fill(const char fillch) = 0;
|
||||||
|
|
||||||
//- Write float
|
/// Get width of output field
|
||||||
virtual iOstream& write(const float val) = 0;
|
virtual int width() const = 0;
|
||||||
|
|
||||||
//- Write double
|
/// Set width of output field (and return old width)
|
||||||
virtual iOstream& write(const double val) = 0;
|
virtual int width(const int w) = 0;
|
||||||
|
|
||||||
|
/// Get precision of output field
|
||||||
|
virtual int precision() const = 0;
|
||||||
|
|
||||||
|
/// Set precision of output field (and return old precision)
|
||||||
|
virtual int precision(const int p) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
//- Member Operators
|
||||||
|
|
||||||
//- Add indentation characters
|
/// Return a non-const reference to const iOstream
|
||||||
virtual void indent() = 0;
|
/// Needed for write functions where the stream argument is temporary:
|
||||||
|
/// e.g. thing thisThing(OFstream("thingFileName")());
|
||||||
//- Return indent level
|
iOstream& operator()() const
|
||||||
unsigned short indentSize() const
|
{
|
||||||
{
|
return const_cast<iOstream&>(*this);
|
||||||
return indentSize_;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//- Access to indent size
|
|
||||||
unsigned short& indentSize()
|
|
||||||
{
|
|
||||||
return indentSize_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return indent level
|
|
||||||
unsigned short indentLevel() const
|
|
||||||
{
|
|
||||||
return indentLevel_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Access to indent level
|
|
||||||
unsigned short& indentLevel()
|
|
||||||
{
|
|
||||||
return indentLevel_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Increment the indent level
|
|
||||||
void incrIndent()
|
|
||||||
{
|
|
||||||
++indentLevel_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Decrement the indent level
|
|
||||||
void decrIndent();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//- Write begin block group with a name
|
|
||||||
// Increments indentation, adds newline.
|
|
||||||
virtual iOstream& beginBlock(const word& kw);
|
|
||||||
|
|
||||||
//- Write begin block group without a name
|
|
||||||
// Increments indentation, adds newline.
|
|
||||||
virtual iOstream& beginBlock();
|
|
||||||
|
|
||||||
//- Write end block group
|
|
||||||
// Decrements indentation, adds newline.
|
|
||||||
virtual iOstream& endBlock();
|
|
||||||
|
|
||||||
//- Write begin list "("
|
|
||||||
virtual iOstream& beginList();
|
|
||||||
|
|
||||||
//- Write begin list with keyword "kw ("
|
|
||||||
virtual iOstream& beginList(const word& kw);
|
|
||||||
|
|
||||||
//- Write end list ")"
|
|
||||||
virtual iOstream& endList();
|
|
||||||
|
|
||||||
//- Write begin list "["
|
|
||||||
virtual iOstream& beginSquare();
|
|
||||||
|
|
||||||
//- Write begin list with keyword "kw ["
|
|
||||||
virtual iOstream& beginSquare(const word& kw);
|
|
||||||
|
|
||||||
//- Write end list "]"
|
|
||||||
virtual iOstream& endSquare();
|
|
||||||
|
|
||||||
//- Write end entry (';') followed by newline.
|
|
||||||
virtual iOstream& endEntry();
|
|
||||||
|
|
||||||
//- Write a newLine to stream
|
|
||||||
virtual iOstream& newLine();
|
|
||||||
|
|
||||||
//- Write space to stream
|
|
||||||
virtual iOstream& space(int32 n=1);
|
|
||||||
|
|
||||||
|
|
||||||
//- Write the keyword followed by an appropriate indentation
|
|
||||||
virtual iOstream& writeWordKeyword(const word& kw);
|
|
||||||
|
|
||||||
//- Write a keyword/value entry.
|
|
||||||
template<class T>
|
|
||||||
iOstream& writeWordEntry(const word& key, const T& value)
|
|
||||||
{
|
|
||||||
writeWordKeyword(key) << value;
|
|
||||||
return endEntry();
|
|
||||||
}
|
|
||||||
|
|
||||||
//// Stream state functions
|
|
||||||
|
|
||||||
//- Flush stream
|
|
||||||
virtual void flush() = 0;
|
|
||||||
|
|
||||||
//- Add newline and flush stream
|
|
||||||
virtual void endl() = 0;
|
|
||||||
|
|
||||||
//- Get padding character
|
|
||||||
virtual char fill() const = 0;
|
|
||||||
|
|
||||||
//- Set padding character for formatted field up to field width
|
|
||||||
virtual char fill(const char fillch) = 0;
|
|
||||||
|
|
||||||
//- Get width of output field
|
|
||||||
virtual int width() const = 0;
|
|
||||||
|
|
||||||
//- Set width of output field (and return old width)
|
|
||||||
virtual int width(const int w) = 0;
|
|
||||||
|
|
||||||
//- Get precision of output field
|
|
||||||
virtual int precision() const = 0;
|
|
||||||
|
|
||||||
//- Set precision of output field (and return old precision)
|
|
||||||
virtual int precision(const int p) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
|
||||||
|
|
||||||
//- Return a non-const reference to const iOstream
|
|
||||||
// Needed for write functions where the stream argument is temporary:
|
|
||||||
// e.g. thing thisThing(OFstream("thingFileName")());
|
|
||||||
iOstream& operator()() const
|
|
||||||
{
|
|
||||||
return const_cast<iOstream&>(*this);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//- An iOstream manipulator
|
/// An iOstream manipulator
|
||||||
typedef iOstream& (*iOstreamManip)(iOstream&);
|
typedef iOstream& (*iOstreamManip)(iOstream&);
|
||||||
|
|
||||||
|
|
||||||
//- operator<< handling for manipulators without arguments
|
/// operator<< handling for manipulators without arguments
|
||||||
inline iOstream& operator<<(iOstream& os, iOstreamManip f)
|
inline iOstream& operator<<(iOstream& os, iOstreamManip f)
|
||||||
{
|
{
|
||||||
return f(os);
|
return f(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- operator<< handling for manipulators without arguments
|
/// operator<< handling for manipulators without arguments
|
||||||
inline iOstream& operator<<(iOstream& os, IOstreamManip f)
|
inline iOstream& operator<<(iOstream& os, IOstreamManip f)
|
||||||
{
|
{
|
||||||
f(os);
|
f(os);
|
||||||
|
@ -278,21 +286,21 @@ inline iOstream& operator<<(iOstream& os, IOstreamManip f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Indent stream
|
/// Indent stream
|
||||||
inline iOstream& indent(iOstream& os)
|
inline iOstream& indent(iOstream& os)
|
||||||
{
|
{
|
||||||
os.indent();
|
os.indent();
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Increment the indent level
|
/// Increment the indent level
|
||||||
inline iOstream& incrIndent(iOstream& os)
|
inline iOstream& incrIndent(iOstream& os)
|
||||||
{
|
{
|
||||||
os.incrIndent();
|
os.incrIndent();
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Decrement the indent level
|
/// Decrement the indent level
|
||||||
inline iOstream& decrIndent(iOstream& os)
|
inline iOstream& decrIndent(iOstream& os)
|
||||||
{
|
{
|
||||||
os.decrIndent();
|
os.decrIndent();
|
||||||
|
@ -300,7 +308,7 @@ inline iOstream& decrIndent(iOstream& os)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Flush stream
|
/// Flush stream
|
||||||
inline iOstream& flush(iOstream& os)
|
inline iOstream& flush(iOstream& os)
|
||||||
{
|
{
|
||||||
os.flush();
|
os.flush();
|
||||||
|
@ -308,7 +316,7 @@ inline iOstream& flush(iOstream& os)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Add newline and flush stream
|
/// Add newline and flush stream
|
||||||
inline iOstream& endl(iOstream& os)
|
inline iOstream& endl(iOstream& os)
|
||||||
{
|
{
|
||||||
os.endl();
|
os.endl();
|
||||||
|
@ -316,7 +324,7 @@ inline iOstream& endl(iOstream& os)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Write begin block group without a name
|
/// Write begin block group without a name
|
||||||
// Increments indentation, adds newline.
|
// Increments indentation, adds newline.
|
||||||
inline iOstream& beginBlock(iOstream& os)
|
inline iOstream& beginBlock(iOstream& os)
|
||||||
{
|
{
|
||||||
|
@ -325,7 +333,7 @@ inline iOstream& beginBlock(iOstream& os)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Write end block group
|
/// Write end block group
|
||||||
// Decrements indentation, adds newline.
|
// Decrements indentation, adds newline.
|
||||||
inline iOstream& endBlock(iOstream& os)
|
inline iOstream& endBlock(iOstream& os)
|
||||||
{
|
{
|
||||||
|
@ -334,7 +342,7 @@ inline iOstream& endBlock(iOstream& os)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Write end entry (';') followed by newline.
|
/// Write end entry (';') followed by newline.
|
||||||
inline iOstream& endEntry(iOstream& os)
|
inline iOstream& endEntry(iOstream& os)
|
||||||
{
|
{
|
||||||
os.endEntry();
|
os.endEntry();
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
/*------------------------------- 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 "cells.hpp"
|
|
@ -0,0 +1,259 @@
|
||||||
|
/*------------------------------- 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 __cells_hpp__
|
||||||
|
#define __cells_hpp__
|
||||||
|
|
||||||
|
|
||||||
|
#include "types.hpp"
|
||||||
|
#include "box.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename indexType>
|
||||||
|
class cells
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
using CellType = triple<indexType>;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// - domain
|
||||||
|
box domain_{realx3(0.0), realx3(1.0)};
|
||||||
|
|
||||||
|
// - cell size
|
||||||
|
realx3 cellSize_{1,1,1};
|
||||||
|
|
||||||
|
CellType numCells_{1,1,1};
|
||||||
|
|
||||||
|
|
||||||
|
// - protected methods
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
void calculate()
|
||||||
|
{
|
||||||
|
numCells_ = (domain_.maxPoint()-domain_.minPoint())/cellSize_ + realx3(1.0);
|
||||||
|
numCells_ = max( numCells_ , CellType(static_cast<indexType>(1)) );
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
cells()
|
||||||
|
{}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
cells(const box& domain, real cellSize)
|
||||||
|
:
|
||||||
|
domain_(domain),
|
||||||
|
cellSize_(cellSize)
|
||||||
|
{
|
||||||
|
calculate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
cells(const box& domain, int32 nx, int32 ny, int32 nz)
|
||||||
|
:
|
||||||
|
domain_(domain),
|
||||||
|
cellSize_(
|
||||||
|
(domain_.maxPoint() - domain_.minPoint())/realx3(nx, ny, nz)
|
||||||
|
),
|
||||||
|
numCells_(nx, ny, nz)
|
||||||
|
{}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
cells(const cells&) = default;
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
cells& operator = (const cells&) = default;
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
cells(cells &&) = default;
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
cells& operator=(cells&&) = default;
|
||||||
|
|
||||||
|
cells getCells()const
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
void setCellSize(real cellSize)
|
||||||
|
{
|
||||||
|
cellSize_ = cellSize;
|
||||||
|
calculate();
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
void setCellSize(realx3 cellSize)
|
||||||
|
{
|
||||||
|
cellSize_ = cellSize;
|
||||||
|
calculate();
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
realx3 cellSize()const
|
||||||
|
{
|
||||||
|
return cellSize_;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
const CellType& numCells()const
|
||||||
|
{
|
||||||
|
return numCells_;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
indexType nx()const
|
||||||
|
{
|
||||||
|
return numCells_.x();
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
indexType ny()const
|
||||||
|
{
|
||||||
|
return numCells_.y();
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
indexType nz()const
|
||||||
|
{
|
||||||
|
return numCells_.z();
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
int64 totalCells()const
|
||||||
|
{
|
||||||
|
return static_cast<int64>(numCells_.x())*
|
||||||
|
static_cast<int64>(numCells_.y())*
|
||||||
|
static_cast<int64>(numCells_.z());
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& domain()const
|
||||||
|
{
|
||||||
|
return domain_;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
CellType pointIndex(const realx3& p)const
|
||||||
|
{
|
||||||
|
return CellType( (p - domain_.minPoint())/cellSize_ );
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
bool pointIndexInDomain(const realx3 p, CellType& index)const
|
||||||
|
{
|
||||||
|
if( !domain_.isInside(p) ) return false;
|
||||||
|
|
||||||
|
index = this->pointIndex(p);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
bool inDomain(const realx3& p)const
|
||||||
|
{
|
||||||
|
return domain_.isInside(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
bool isInRange(const CellType& cell)const
|
||||||
|
{
|
||||||
|
if(cell.x()<0)return false;
|
||||||
|
if(cell.y()<0)return false;
|
||||||
|
if(cell.z()<0)return false;
|
||||||
|
if(cell.x()>numCells_.x()-1) return false;
|
||||||
|
if(cell.y()>numCells_.y()-1) return false;
|
||||||
|
if(cell.z()>numCells_.z()-1) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
bool isInRange(indexType i, indexType j, indexType k)const
|
||||||
|
{
|
||||||
|
if(i<0)return false;
|
||||||
|
if(j<0)return false;
|
||||||
|
if(k<0)return false;
|
||||||
|
if(i>numCells_.x()-1) return false;
|
||||||
|
if(j>numCells_.y()-1) return false;
|
||||||
|
if(k>numCells_.z()-1) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
void extendBox(
|
||||||
|
const CellType& p1,
|
||||||
|
const CellType& p2,
|
||||||
|
const CellType& p3,
|
||||||
|
indexType extent,
|
||||||
|
CellType& minP,
|
||||||
|
CellType& maxP)const
|
||||||
|
{
|
||||||
|
minP = min( min( p1, p2), p3)-extent;
|
||||||
|
maxP = max( max( p1, p2), p3)+extent;
|
||||||
|
|
||||||
|
minP = bound(minP);
|
||||||
|
maxP = bound(maxP);
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
void extendBox(
|
||||||
|
const realx3& p1,
|
||||||
|
const realx3& p2,
|
||||||
|
const realx3& p3,
|
||||||
|
real extent,
|
||||||
|
realx3& minP,
|
||||||
|
realx3& maxP)const
|
||||||
|
{
|
||||||
|
minP = min(min(p1,p2),p3) - extent*cellSize_ ;
|
||||||
|
maxP = max(max(p1,p2),p3) + extent*cellSize_ ;
|
||||||
|
|
||||||
|
minP = bound(minP);
|
||||||
|
maxP = bound(maxP);
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
CellType bound(CellType p)const
|
||||||
|
{
|
||||||
|
return CellType(
|
||||||
|
min( numCells_.x()-1, max(0,p.x())),
|
||||||
|
min( numCells_.y()-1, max(0,p.y())),
|
||||||
|
min( numCells_.z()-1, max(0,p.z()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
realx3 bound(realx3 p)const
|
||||||
|
{
|
||||||
|
return realx3(
|
||||||
|
min( domain_.maxPoint().x(), max(domain_.minPoint().x(),p.x())),
|
||||||
|
min( domain_.maxPoint().y(), max(domain_.minPoint().y(),p.y())),
|
||||||
|
min( domain_.maxPoint().z(), max(domain_.minPoint().z(),p.z()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -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.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "mortonIndexing.hpp"
|
||||||
|
#include "cells.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
bool pFlow::getSortedIndex(
|
||||||
|
box boundingBox,
|
||||||
|
real dx,
|
||||||
|
range activeRange,
|
||||||
|
ViewType1D<realx3> pos,
|
||||||
|
ViewType1D<int8> flag,
|
||||||
|
int32IndexContainer& sortedIndex)
|
||||||
|
{
|
||||||
|
|
||||||
|
// obtain the morton code of the particles
|
||||||
|
cells<size_t> allCells( boundingBox, dx);
|
||||||
|
int32IndexContainer index(activeRange.first, activeRange.second);
|
||||||
|
|
||||||
|
ViewType1D<uint64_t> mortonCode("mortonCode", activeRange.second);
|
||||||
|
|
||||||
|
using rpMorton =
|
||||||
|
Kokkos::RangePolicy<Kokkos::IndexType<int32>>;
|
||||||
|
int32 numActive = 0;
|
||||||
|
Kokkos::parallel_reduce
|
||||||
|
(
|
||||||
|
"mortonIndexing::getIndex::morton",
|
||||||
|
rpMorton(activeRange.first, activeRange.second),
|
||||||
|
LAMBDA_HD(int32 i, int32& sumToUpdate){
|
||||||
|
if( flag[i] == 1 ) // active point
|
||||||
|
{
|
||||||
|
auto cellInd = allCells.pointIndex(pos[i]);
|
||||||
|
mortonCode[i] = xyzToMortonCode64(cellInd.x(), cellInd.y(), cellInd.z());
|
||||||
|
sumToUpdate++;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
mortonCode[i] = xyzToMortonCode64(-1,-1,-1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
numActive
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
permuteSort(
|
||||||
|
mortonCode,
|
||||||
|
activeRange.first,
|
||||||
|
activeRange.second,
|
||||||
|
index.deviceView(),
|
||||||
|
0 );
|
||||||
|
index.modifyOnDevice();
|
||||||
|
index.setSize(numActive);
|
||||||
|
index.syncViews();
|
||||||
|
|
||||||
|
sortedIndex = index;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*------------------------------- 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 __mortonIndexing_hpp__
|
||||||
|
#define __mortonIndexing_hpp__
|
||||||
|
|
||||||
|
#include "types.hpp"
|
||||||
|
#include "box.hpp"
|
||||||
|
#include "indexContainer.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
bool getSortedIndex(
|
||||||
|
box boundingBox,
|
||||||
|
real dx,
|
||||||
|
range activeRange,
|
||||||
|
ViewType1D<realx3> pos,
|
||||||
|
ViewType1D<int8> flag,
|
||||||
|
int32IndexContainer& sortedIndex);
|
||||||
|
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
uint64_t splitBy3(const uint64_t val){
|
||||||
|
uint64_t x = val;
|
||||||
|
x = (x | x << 32) & 0x1f00000000ffff;
|
||||||
|
x = (x | x << 16) & 0x1f0000ff0000ff;
|
||||||
|
x = (x | x << 8) & 0x100f00f00f00f00f;
|
||||||
|
x = (x | x << 4) & 0x10c30c30c30c30c3;
|
||||||
|
x = (x | x << 2) & 0x1249249249249249;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
uint64_t xyzToMortonCode64(uint64_t x, uint64_t y, uint64_t z)
|
||||||
|
{
|
||||||
|
return splitBy3(x) | (splitBy3(y) << 1) | (splitBy3(z) << 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
uint64_t getThirdBits(uint64_t x)
|
||||||
|
{
|
||||||
|
x = x & 0x9249249249249249;
|
||||||
|
x = (x | (x >> 2)) & 0x30c30c30c30c30c3;
|
||||||
|
x = (x | (x >> 4)) & 0xf00f00f00f00f00f;
|
||||||
|
x = (x | (x >> 8)) & 0x00ff0000ff0000ff;
|
||||||
|
x = (x | (x >> 16)) & 0xffff00000000ffff;
|
||||||
|
x = (x | (x >> 32)) & 0x00000000ffffffff;
|
||||||
|
return x;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
void mortonCode64Toxyz(uint64_t morton, uint64_t& x, uint64_t& y, uint64_t& z)
|
||||||
|
{
|
||||||
|
x = getThirdBits(morton);
|
||||||
|
y = getThirdBits(morton >> 1);
|
||||||
|
z = getThirdBits(morton >> 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct indexMorton
|
||||||
|
{
|
||||||
|
size_t morton;
|
||||||
|
size_t index;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //__mortonIndexing_hpp__
|
|
@ -24,7 +24,8 @@ Licence:
|
||||||
#include "setFieldList.hpp"
|
#include "setFieldList.hpp"
|
||||||
#include "error.hpp"
|
#include "error.hpp"
|
||||||
#include "iOstream.hpp"
|
#include "iOstream.hpp"
|
||||||
#include "Time.hpp"
|
//#include "Time.hpp"
|
||||||
|
#include "mortonIndexing.hpp"
|
||||||
|
|
||||||
FUNCTION_H
|
FUNCTION_H
|
||||||
bool pFlow::pointStructure::evaluatePointStructure()
|
bool pFlow::pointStructure::evaluatePointStructure()
|
||||||
|
@ -231,6 +232,55 @@ bool pFlow::pointStructure::allActive()const
|
||||||
return numActivePoints_ == numPoints_;
|
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
|
FUNCTION_H
|
||||||
size_t pFlow::pointStructure::markDeleteOutOfBox(const box& domain)
|
size_t pFlow::pointStructure::markDeleteOutOfBox(const box& domain)
|
||||||
|
@ -306,7 +356,6 @@ pFlow::uniquePtr<pFlow::int32IndexContainer> pFlow::pointStructure::insertPoints
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
auto numNew = pos.size();
|
auto numNew = pos.size();
|
||||||
if( numNew==0)
|
if( numNew==0)
|
||||||
{
|
{
|
||||||
|
@ -359,8 +408,8 @@ pFlow::uniquePtr<pFlow::int32IndexContainer> pFlow::pointStructure::insertPoints
|
||||||
}
|
}
|
||||||
|
|
||||||
// changes the active rage based on the new inserted points
|
// changes the active rage based on the new inserted points
|
||||||
activeRange_ = { min(activeRange_.first, minInd ),
|
activeRange_ = { static_cast<int>(min(activeRange_.first, minInd )),
|
||||||
max(activeRange_.second, maxInd+1)};
|
static_cast<int>(max(activeRange_.second, maxInd+1))};
|
||||||
|
|
||||||
numActivePoints_ += numNew;
|
numActivePoints_ += numNew;
|
||||||
|
|
||||||
|
@ -400,7 +449,7 @@ bool pFlow::pointStructure::readPointStructure
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! pointFlag_.read(is))
|
if(! pointFlag_.read(is, true))
|
||||||
{
|
{
|
||||||
ioErrorInFile(is.name(), is.lineNumber())<<
|
ioErrorInFile(is.name(), is.lineNumber())<<
|
||||||
"Error in reading pointFlag in pointStructure \n";
|
"Error in reading pointFlag in pointStructure \n";
|
||||||
|
|
|
@ -163,8 +163,11 @@ protected:
|
||||||
// index range of active points (half-open range)
|
// index range of active points (half-open range)
|
||||||
range activeRange_;
|
range activeRange_;
|
||||||
|
|
||||||
// - index vector for points to be inserted
|
/// Index vector for points to be inserted
|
||||||
int32IndexContainer tobeInsertedIndex_;
|
int32IndexContainer tobeInsertedIndex_;
|
||||||
|
|
||||||
|
/// Sorted index of particles based on morton code
|
||||||
|
int32IndexContainer mortonSortedIndex_;
|
||||||
|
|
||||||
|
|
||||||
//// - protected methods
|
//// - protected methods
|
||||||
|
@ -298,6 +301,10 @@ public:
|
||||||
FUNCTION_H
|
FUNCTION_H
|
||||||
virtual bool updateForDelete();
|
virtual bool updateForDelete();
|
||||||
|
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
virtual bool mortonSortPoints(const box& domain, real dx);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// - const access to points to be newly inserted
|
// - const access to points to be newly inserted
|
||||||
|
@ -320,6 +327,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
auto mortonSortedIndex()const
|
||||||
|
{
|
||||||
|
return mortonSortedIndex_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// - update data structure by inserting/setting new points
|
// - update data structure by inserting/setting new points
|
||||||
// Notifies all the fields in the registered list of data structure
|
// Notifies all the fields in the registered list of data structure
|
||||||
// and exclude the fields that re in the exclusionList
|
// and exclude the fields that re in the exclusionList
|
||||||
|
|
|
@ -214,14 +214,12 @@ bool pFlow::multiTriSurface::readMultiTriSurface
|
||||||
{
|
{
|
||||||
if( !readTriSurface(is) )return false;
|
if( !readTriSurface(is) )return false;
|
||||||
|
|
||||||
is >> lastPointIndex_;
|
// from current position
|
||||||
if(!is.check(FUNCTION_NAME) ) return false;
|
if(!lastPointIndex_.read(is, true)) return false;
|
||||||
|
|
||||||
is >> lastVertexIndex_;
|
if(!lastVertexIndex_.read(is, true) ) return false;
|
||||||
if(!is.check(FUNCTION_NAME) ) return false;
|
|
||||||
|
|
||||||
is >> surfaceNames_;
|
if( !surfaceNames_.read(is, true)) return false;
|
||||||
if( !is.check(FUNCTION_NAME)) return false;
|
|
||||||
|
|
||||||
calculateVars();
|
calculateVars();
|
||||||
|
|
||||||
|
|
|
@ -193,13 +193,15 @@ bool pFlow::triSurface::readTriSurface
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
std::cout<<"triSurface file is binary "<< is.isBinary()<<std::endl;
|
||||||
|
|
||||||
is.fatalCheck(FUNCTION_NAME);
|
is.fatalCheck(FUNCTION_NAME);
|
||||||
|
|
||||||
is >> points_;
|
// from start of file
|
||||||
is.fatalCheck(FUNCTION_NAME);
|
if(!points_.read(is)) return false;
|
||||||
|
|
||||||
is >> vertices_;
|
// from the current position
|
||||||
is.fatalCheck(FUNCTION_NAME);
|
if(!vertices_.read(is, true)) return false;
|
||||||
|
|
||||||
if( !check() )
|
if( !check() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName interaction;
|
objectName interaction;
|
||||||
objectType dicrionary;
|
objectType dicrionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
materials (wallMat); // a list of materials names
|
materials (wallMat); // a list of materials names
|
||||||
densities (1000.0); // density of materials [kg/m3]
|
densities (1000.0); // density of materials [kg/m3]
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName geometryDict;
|
objectName geometryDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// motion model: rotating object around an axis
|
// motion model: rotating object around an axis
|
||||||
motionModel rotatingAxisMotion;
|
motionModel rotatingAxisMotion;
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName settingsDict;
|
objectName settingsDict;
|
||||||
objectType dictionary;;
|
objectType dictionary;;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
run inclinedScrewConveyor;
|
run inclinedScrewConveyor;
|
||||||
|
|
||||||
|
@ -31,6 +33,8 @@ domain
|
||||||
|
|
||||||
integrationMethod AdamsBashforth2; // integration method
|
integrationMethod AdamsBashforth2; // integration method
|
||||||
|
|
||||||
|
writeFormat ascii;
|
||||||
|
|
||||||
timersReport Yes; // report timers?
|
timersReport Yes; // report timers?
|
||||||
|
|
||||||
timersReportInterval 0.01; // time interval for reporting timers
|
timersReportInterval 0.01; // time interval for reporting timers
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName interaction;
|
objectName interaction;
|
||||||
objectType dicrionary;
|
objectType dicrionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
materials (prop1); // a list of materials names
|
materials (prop1); // a list of materials names
|
||||||
densities (1000.0); // density of materials [kg/m3]
|
densities (1000.0); // density of materials [kg/m3]
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName particleInsertion;
|
objectName particleInsertion;
|
||||||
objectType dicrionary;
|
objectType dicrionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
active no; // is insertion active?
|
active no; // is insertion active?
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName sphereDict;
|
objectName sphereDict;
|
||||||
objectType sphereShape;
|
objectType sphereShape;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
names (smallSphere largeSphere); // names of shapes
|
names (smallSphere largeSphere); // names of shapes
|
||||||
diameters (0.003 0.005); // diameter of shapes
|
diameters (0.003 0.005); // diameter of shapes
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName geometryDict;
|
objectName geometryDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// motion model: rotating object around an axis
|
// motion model: rotating object around an axis
|
||||||
motionModel rotatingAxisMotion;
|
motionModel rotatingAxisMotion;
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName particlesDict;
|
objectName particlesDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// positions particles
|
// positions particles
|
||||||
positionParticles
|
positionParticles
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName postprocessDict;
|
objectName postprocessDict;
|
||||||
objectType dictionary;;
|
objectType dictionary;;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
rectMesh
|
rectMesh
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName settingsDict;
|
objectName settingsDict;
|
||||||
objectType dictionary;;
|
objectType dictionary;;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
run rotatingDrumSmall;
|
run rotatingDrumSmall;
|
||||||
|
|
||||||
|
@ -31,6 +33,8 @@ domain
|
||||||
|
|
||||||
integrationMethod AdamsBashforth2; // integration method
|
integrationMethod AdamsBashforth2; // integration method
|
||||||
|
|
||||||
|
writeFormat ascii;
|
||||||
|
|
||||||
timersReport Yes; // report timers?
|
timersReport Yes; // report timers?
|
||||||
|
|
||||||
timersReportInterval 0.01; // time interval for reporting timers
|
timersReportInterval 0.01; // time interval for reporting timers
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName interaction;
|
objectName interaction;
|
||||||
objectType dicrionary;
|
objectType dicrionary;
|
||||||
/*----------------------------------------------------------------------------*/
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// a list of materials names
|
// a list of materials names
|
||||||
materials (lightMat heavyMat wallMat);
|
materials (lightMat heavyMat wallMat);
|
||||||
// density of materials [kg/m3]
|
// density of materials [kg/m3]
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName particleInsertion;
|
objectName particleInsertion;
|
||||||
objectType dicrionary;
|
objectType dicrionary;
|
||||||
|
fileFormat ASCII;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// is insertion active?
|
// is insertion active?
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName sphereDict;
|
objectName sphereDict;
|
||||||
objectType sphereShape;
|
objectType sphereShape;
|
||||||
|
fileFormat ASCII;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// names of shapes
|
// names of shapes
|
||||||
names (smallSphere largeSphere);
|
names (smallSphere largeSphere);
|
||||||
// diameter of shapes (m)
|
// diameter of shapes (m)
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName geometryDict;
|
objectName geometryDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
/* ------------------------------------------------------------------------- */
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// motion model: all surfaces are fixed
|
// motion model: all surfaces are fixed
|
||||||
motionModel rotatingAxisMotion;
|
motionModel rotatingAxisMotion;
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName particlesDict;
|
objectName particlesDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
setFields
|
setFields
|
||||||
{
|
{
|
||||||
defaultValue
|
defaultValue
|
||||||
|
|
|
@ -2,24 +2,30 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName settingsDict;
|
objectName settingsDict;
|
||||||
objectType dictionary;;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
run RotatingDrumwithBaffles;
|
run RotatingDrumwithBaffles;
|
||||||
|
|
||||||
// time step for integration (s)
|
// time step for integration (s)
|
||||||
dt 0.00001;
|
dt 0.00001;
|
||||||
|
|
||||||
// start time for simulation
|
// start time for simulation
|
||||||
startTime 0;
|
startTime 0;
|
||||||
|
|
||||||
// end time for simulation
|
// end time for simulation
|
||||||
endTime 10;
|
endTime 10;
|
||||||
|
|
||||||
// time interval for saving the simulation
|
// time interval for saving the simulation
|
||||||
saveInterval 0.05;
|
saveInterval 0.05;
|
||||||
|
|
||||||
// maximum number of digits for time folder
|
// maximum number of digits for time folder
|
||||||
timePrecision 6;
|
timePrecision 6;
|
||||||
|
|
||||||
// gravity vector (m/s2)
|
// gravity vector (m/s2)
|
||||||
g (0 -9.8 0);
|
g (0 -9.8 0);
|
||||||
|
|
||||||
/*Simulation domain*/
|
/*Simulation domain*/
|
||||||
/* Every particles that goes outside this domain is deleted.*/
|
/* Every particles that goes outside this domain is deleted.*/
|
||||||
|
@ -28,9 +34,15 @@ domain
|
||||||
min (-0.328 0.095 -0.025);
|
min (-0.328 0.095 -0.025);
|
||||||
max (-0.068 0.355 0.125);
|
max (-0.068 0.355 0.125);
|
||||||
}
|
}
|
||||||
|
|
||||||
// integration method
|
// integration method
|
||||||
integrationMethod AdamsBashforth3;
|
integrationMethod AdamsBashforth3;
|
||||||
|
|
||||||
|
// binary or ascii for saving data
|
||||||
|
writeFormat ascii;
|
||||||
|
|
||||||
// report timers?
|
// report timers?
|
||||||
timersReport Yes;
|
timersReport Yes;
|
||||||
|
|
||||||
// time interval for reporting timers
|
// time interval for reporting timers
|
||||||
timersReportInterval 0.01;
|
timersReportInterval 0.01;
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName interaction;
|
objectName interaction;
|
||||||
objectType dicrionary;
|
objectType dicrionary;
|
||||||
/* ------------------------------------------------------------------------- */
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// a list of materials names
|
// a list of materials names
|
||||||
materials (wallMat lightMat);
|
materials (wallMat lightMat);
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName particleInsertion;
|
objectName particleInsertion;
|
||||||
objectType dicrionary;
|
objectType dicrionary;
|
||||||
/* ------------------------------------------------------------------------- */
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// is insertion active?
|
// is insertion active?
|
||||||
active yes;
|
active yes;
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName sphereDict;
|
objectName sphereDict;
|
||||||
objectType sphereShape;
|
objectType sphereShape;
|
||||||
/* ------------------------------------------------------------------------- */
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// names of particles
|
// names of particles
|
||||||
names (smallSphere largeSphere);
|
names (smallSphere largeSphere);
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName geometryDict;
|
objectName geometryDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
/* ------------------------------------------------------------------------- */
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// motion model: rotating object around an axis
|
// motion model: rotating object around an axis
|
||||||
motionModel rotatingAxisMotion;
|
motionModel rotatingAxisMotion;
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName particlesDict;
|
objectName particlesDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
/* ------------------------------------------------------------------------- */
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
setFields
|
setFields
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName settingsDict;
|
objectName settingsDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
/* ------------------------------------------------------------------------- */
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
run rotatingVblender;
|
run rotatingVblender;
|
||||||
|
|
||||||
|
@ -40,6 +41,8 @@ domain
|
||||||
// integration method
|
// integration method
|
||||||
integrationMethod AdamsBashforth2;
|
integrationMethod AdamsBashforth2;
|
||||||
|
|
||||||
|
writeFormat ascii;
|
||||||
|
|
||||||
// report timers?
|
// report timers?
|
||||||
timersReport Yes;
|
timersReport Yes;
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
objectName interaction;
|
||||||
|
objectType dicrionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
objectName interaction;
|
|
||||||
objectType dicrionary;
|
|
||||||
|
|
||||||
materials (prop1); // a list of materials names
|
materials (prop1); // a list of materials names
|
||||||
densities (1000.0); // density of materials [kg/m3]
|
densities (1000.0); // density of materials [kg/m3]
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
objectName particleInsertion;
|
||||||
objectName particleInsertion;
|
objectType dicrionary;
|
||||||
objectType dicrionary;
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
active no; // is insertion active?
|
active no; // is insertion active?
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName sphereDict;
|
objectName sphereDict;
|
||||||
objectType sphereShape;
|
objectType sphereShape;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
names (smallSphere largeSphere); // names of shapes
|
names (smallSphere largeSphere); // names of shapes
|
||||||
diameters (0.003 0.005); // diameter of shapes
|
diameters (0.003 0.005); // diameter of shapes
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName geometryDict;
|
objectName geometryDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// motion model: rotating object around an axis
|
// motion model: rotating object around an axis
|
||||||
motionModel rotatingAxisMotion;
|
motionModel rotatingAxisMotion;
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName particlesDict;
|
objectName particlesDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// positions particles
|
// positions particles
|
||||||
positionParticles
|
positionParticles
|
||||||
|
|
|
@ -3,7 +3,10 @@
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName settingsDict;
|
objectName settingsDict;
|
||||||
objectType dictionary;;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
run binarySystemofParticles;
|
run binarySystemofParticles;
|
||||||
|
|
||||||
|
@ -31,6 +34,8 @@ domain
|
||||||
|
|
||||||
integrationMethod AdamsBashforth2; // integration method
|
integrationMethod AdamsBashforth2; // integration method
|
||||||
|
|
||||||
|
writeFormat ascii;
|
||||||
|
|
||||||
timersReport Yes; // report timers?
|
timersReport Yes; // report timers?
|
||||||
|
|
||||||
timersReportInterval 0.01; // time interval for reporting timers
|
timersReportInterval 0.01; // time interval for reporting timers
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName interaction;
|
objectName interaction;
|
||||||
objectType dicrionary;
|
objectType dicrionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
materials (lightMat heavyMat wallMat); // a list of materials names
|
materials (lightMat heavyMat wallMat); // a list of materials names
|
||||||
densities (1000 1500.0 2500); // density of materials [kg/m3]
|
densities (1000 1500.0 2500); // density of materials [kg/m3]
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName particleInsertion;
|
objectName particleInsertion;
|
||||||
objectType dicrionary;
|
objectType dicrionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
active yes; // is insertion active?
|
active yes; // is insertion active?
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName sphereDict;
|
objectName sphereDict;
|
||||||
objectType sphereShape;
|
objectType sphereShape;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
names (lightSphere heavySphere); // names of shapes
|
names (lightSphere heavySphere); // names of shapes
|
||||||
diameters (0.007 0.007); // diameter of shapes
|
diameters (0.007 0.007); // diameter of shapes
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName geometryDict;
|
objectName geometryDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// motion model: all surfaces are fixed
|
// motion model: all surfaces are fixed
|
||||||
motionModel fixedWall;
|
motionModel fixedWall;
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName particlesDict;
|
objectName particlesDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
setFields
|
setFields
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName settingsDict;
|
objectName settingsDict;
|
||||||
objectType dictionary;;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
run layerdSiloFilling;
|
run layerdSiloFilling;
|
||||||
|
|
||||||
|
@ -31,6 +33,8 @@ domain
|
||||||
|
|
||||||
integrationMethod AdamsBashforth3; // integration method
|
integrationMethod AdamsBashforth3; // integration method
|
||||||
|
|
||||||
|
writeFormat ascii;
|
||||||
|
|
||||||
timersReport Yes; // report timers?
|
timersReport Yes; // report timers?
|
||||||
|
|
||||||
timersReportInterval 0.01; // time interval for reporting timers
|
timersReportInterval 0.01; // time interval for reporting timers
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName interaction;
|
objectName interaction;
|
||||||
objectType dicrionary;
|
objectType dicrionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
materials (glassMat wallMat); // a list of materials names
|
materials (glassMat wallMat); // a list of materials names
|
||||||
densities (2500.0 2500); // density of materials [kg/m3]
|
densities (2500.0 2500); // density of materials [kg/m3]
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName particleInsertion;
|
objectName particleInsertion;
|
||||||
objectType dicrionary;
|
objectType dicrionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
active no; // is insertion active?
|
active no; // is insertion active?
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName sphereDict;
|
objectName sphereDict;
|
||||||
objectType sphereShape;
|
objectType sphereShape;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
names (glassBead); // names of shapes
|
names (glassBead); // names of shapes
|
||||||
diameters (0.003); // diameter of shapes
|
diameters (0.003); // diameter of shapes
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName geometryDict;
|
objectName geometryDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// motion model: rotating object around an axis
|
// motion model: rotating object around an axis
|
||||||
motionModel rotatingAxisMotion;
|
motionModel rotatingAxisMotion;
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName particlesDict;
|
objectName particlesDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
setFields
|
setFields
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName settingsDict;
|
objectName settingsDict;
|
||||||
objectType dictionary;;
|
objectType dictionary;;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
run rotatingDrumMedium;
|
run rotatingDrumMedium;
|
||||||
|
|
||||||
|
@ -31,6 +33,8 @@ domain
|
||||||
|
|
||||||
integrationMethod AdamsBashforth3; // integration method
|
integrationMethod AdamsBashforth3; // integration method
|
||||||
|
|
||||||
|
writeFormat binary;
|
||||||
|
|
||||||
timersReport Yes; // report timers?
|
timersReport Yes; // report timers?
|
||||||
|
|
||||||
timersReportInterval 0.01; // time interval for reporting timers
|
timersReportInterval 0.01; // time interval for reporting timers
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName interaction;
|
objectName interaction;
|
||||||
objectType dicrionary;
|
objectType dicrionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
materials (prop1); // a list of materials names
|
materials (prop1); // a list of materials names
|
||||||
densities (1000.0); // density of materials [kg/m3]
|
densities (1000.0); // density of materials [kg/m3]
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName particleInsertion;
|
objectName particleInsertion;
|
||||||
objectType dicrionary;
|
objectType dicrionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
active no; // is insertion active?
|
active no; // is insertion active?
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName sphereDict;
|
objectName sphereDict;
|
||||||
objectType sphereShape;
|
objectType sphereShape;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
names (sphere1); // names of shapes
|
names (sphere1); // names of shapes
|
||||||
diameters (0.004); // diameter of shapes
|
diameters (0.004); // diameter of shapes
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName geometryDict;
|
objectName geometryDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// motion model: rotating object around an axis
|
// motion model: rotating object around an axis
|
||||||
motionModel rotatingAxisMotion;
|
motionModel rotatingAxisMotion;
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
| phasicFlow File |
|
| phasicFlow File |
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
objectName particlesDict;
|
objectName particlesDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
setFields
|
setFields
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
| copyright: www.cemf.ir |
|
| copyright: www.cemf.ir |
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName settingsDict;
|
objectName settingsDict;
|
||||||
objectType dictionary;;
|
objectType dictionary;
|
||||||
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
run rotatingDrumSmall;
|
run rotatingDrumSmall;
|
||||||
|
|
||||||
|
@ -31,6 +33,8 @@ domain
|
||||||
|
|
||||||
integrationMethod AdamsBashforth2; // integration method
|
integrationMethod AdamsBashforth2; // integration method
|
||||||
|
|
||||||
|
writeFormat ascii;
|
||||||
|
|
||||||
timersReport Yes; // report timers?
|
timersReport Yes; // report timers?
|
||||||
|
|
||||||
timersReportInterval 0.01; // time interval for reporting timers
|
timersReportInterval 0.01; // time interval for reporting timers
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName interaction;
|
objectName interaction;
|
||||||
objectType dicrionary;
|
objectType dicrionary;
|
||||||
/* ------------------------------------------------------------------------- */
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// a list of materials names
|
// a list of materials names
|
||||||
materials (solidProperty);
|
materials (solidProperty);
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName particleInsertion;
|
objectName particleInsertion;
|
||||||
objectType dicrionary;
|
objectType dicrionary;
|
||||||
/* ------------------------------------------------------------------------- */
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// is insertion active?
|
// is insertion active?
|
||||||
active no;
|
active no;
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName sphereDict;
|
objectName sphereDict;
|
||||||
objectType sphereShape;
|
objectType sphereShape;
|
||||||
/* ------------------------------------------------------------------------- */
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// name of shapes
|
// name of shapes
|
||||||
names (sphere1);
|
names (sphere1);
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName geometryDict;
|
objectName geometryDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
/* ------------------------------------------------------------------------- */
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// motion model: rotating object around an axis
|
// motion model: rotating object around an axis
|
||||||
motionModel rotatingAxisMotion;
|
motionModel rotatingAxisMotion;
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName particlesDict;
|
objectName particlesDict;
|
||||||
objectType dictionary;
|
objectType dictionary;
|
||||||
/* ------------------------------------------------------------------------- */
|
fileFormat ASCII;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
setFields
|
setFields
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------- */
|
||||||
objectName settingsDict;
|
objectName settingsDict;
|
||||||
objectType dictionary;;
|
objectType dictionary;;
|
||||||
|
fileFormat ASCII;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
run toteBlender;
|
run toteBlender;
|
||||||
|
|
||||||
// time step for integration (s)
|
// time step for integration (s)
|
||||||
|
@ -36,6 +38,8 @@ domain
|
||||||
// integration method
|
// integration method
|
||||||
integrationMethod AdamsMoulton4;
|
integrationMethod AdamsMoulton4;
|
||||||
|
|
||||||
|
writeFormat ascii;
|
||||||
|
|
||||||
// report timers?
|
// report timers?
|
||||||
timersReport Yes;
|
timersReport Yes;
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue