# PhasicFlow: src/phasicFlow/containers/pointField/pointField/pointField.hpp Source File
PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.

pointField.hpp
Go to the documentation of this file.
/*------------------------------- 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 __pointField_hpp__
#define __pointField_hpp__
#include "pointStructure.hpp"
#include "internalField.hpp"
#include "boundaryFieldList.hpp"
#include "Time.hpp"
namespace pFlow
{
template<class T, class MemorySpace=void>
class pointField
:
public IOobject,
public internalField<T, MemorySpace>
{
public:
using PointFieldType = pointField<T, MemorySpace>;
using InternalFieldType = internalField<T, MemorySpace>;
using boundaryFieldListType = boundaryFieldList<T, MemorySpace>;
using FieldType = typename InternalFieldType::FieldType;
using VectorType = typename InternalFieldType::VectorType;
using memory_space = typename InternalFieldType::memory_space;
using execution_space = typename InternalFieldType::execution_space;
private:
boundaryFieldListType boundaryFieldList_;
const pointStructure& pStruct_;
public:
// - type info
TypeInfoTemplate111("pointField", T, VectorType::memoerySpaceName());
// - construct a field from pointStructure and set defaultValue_ and field value to defVal
pointField(
const objectFile& objf,
pointStructure& pStruct,
const T& defVal);
pointField(
const objectFile& objf,
repository* owner,
pointStructure& pStruct,
const T& defVal);
pointField(
const objectFile& objf,
pointStructure& pStruct,
const T& defVal,
const T& val);
const word& name() const final
{
return IOobject::name();
}
const auto& internal()const
{
return static_cast<const InternalFieldType&>(*this);
}
void updateBoundaries(DataDirection direction)const
{
uint32 iter = this->time().currentIter();
auto& bList = const_cast< boundaryFieldListType&>(boundaryFieldList_);
bList.updateBoundaries(iter, direction);
}
void updateBoundariesSlaveToMasterIfRequested()
{
if(boundaryFieldList_.slaveToMasterUpdateRequested())
{
updateBoundaries(DataDirection::SlaveToMaster);
}
}
const auto& boundaryFields()const
{
return boundaryFieldList_;
}
const auto& BoundaryField(uint32 i)const
{
return boundaryFieldList_[i];
}
// - reference to pointStructure
inline const pointStructure& pStruct()const {
return pStruct_;
}
void fill(const T& val)
{
InternalFieldType::fillInternal(val);
boundaryFieldList_.fill(val);
}
bool readPointField(iIstream& is, const IOPattern& iop);
bool writePointField(iOstream& os, const IOPattern& iop)const;
bool read(iIstream& is, const IOPattern& iop)override
{
return readPointField(is, iop);
}
bool write(iOstream& os, const IOPattern& iop)const override
{
return writePointField(os, iop);
}
};
/*template<template<class, class> class VectorField, class T, class MemorySpace>
iIstream& operator >> (iIstream & is, pointField<VectorField, T, MemorySpace> & pF )
{
if( !pF.read(is))
{
ioErrorInFile( is.name(), is.lineNumber() ) <<
"error in reading pointField from file. \n";
fatalExit;
}
return is;
}*/
template<class T, class MemorySpace>
iOstream& operator << (iOstream& os, const pointField<T, MemorySpace>& pF )
{
if(! pF.write(os, IOPattern::AllProcessorsDifferent) )
{
ioErrorInFile( os.name(), os.lineNumber() )<<
"error in writing pointField into file. \n";
fatalExit;
}
return os;
}
}
#include "pointField.cpp"
//#include "pointFieldAlgorithms.hpp"
#endif // __pointField_hpp__
pFlow::pointField::boundaryFieldList_
boundaryFieldListType boundaryFieldList_
list of boundaries
Definition: pointField.hpp:59
pFlow::internalField::FieldType
Field< T, MemorySpace > FieldType
Definition: internalField.hpp:43
pFlow::DataDirection::SlaveToMaster
@ SlaveToMaster
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
pFlow::pointField::pStruct
const pointStructure & pStruct() const
Definition: pointField.hpp:134
pFlow::boundaryFieldList::updateBoundaries
void updateBoundaries(uint32 iter, DataDirection direction)
Definition: boundaryFieldList.hpp:66
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::pointField::pStruct_
const pointStructure & pStruct_
refrence to point structure
Definition: pointField.hpp:62
pFlow::internalField< pFlow::VectorSingle, pFlow::AB3History >::memory_space
typename FieldType::memory_space memory_space
Definition: internalField.hpp:49
pFlow::pointField::TypeInfoTemplate111
TypeInfoTemplate111("pointField", T, VectorType::memoerySpaceName())
pFlow::pointField::BoundaryField
const auto & BoundaryField(uint32 i) const
Definition: pointField.hpp:128
pFlow::pointField::pointField
pointField(const objectFile &objf, pointStructure &pStruct, const T &defVal)
Definition: pointField.cpp:22
pFlow::Field< pFlow::VectorSingle, pFlow::AB3History >
pFlow::boundaryFieldList::slaveToMasterUpdateRequested
bool slaveToMasterUpdateRequested() const
Definition: boundaryFieldList.hpp:105
pFlow
Definition: demGeometry.hpp:27
pFlow::IOobject
Definition: IOobject.hpp:35
pFlow::boundaryFieldList< VectorField, pFlow::VectorSingle, pFlow::AB3History >
pFlow::internalField::fillInternal
void fillInternal(const T &val)
Definition: internalField.hpp:175
pFlow::pointField
Definition: pointField.hpp:33
pFlow::boundaryFieldList::fill
void fill(const T &val)
Definition: boundaryFieldList.hpp:97
pFlow::pointStructure
Definition: pointStructure.hpp:34
pFlow::pointField::writePointField
bool writePointField(iOstream &os, const IOPattern &iop) const
Definition: pointField.cpp:283
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
pFlow::IOPattern::AllProcessorsDifferent
@ AllProcessorsDifferent
Definition: IOPattern.hpp:57
pFlow::internalField< pFlow::VectorSingle, pFlow::AB3History >::VectorType
typename FieldType::VectorType VectorType
Definition: internalField.hpp:47
pFlow::objectFile::name
virtual const word & name() const
Definition: objectFile.hpp:101
pFlow::internalField< pFlow::VectorSingle, pFlow::AB3History >::execution_space
typename FieldType::execution_space execution_space
Definition: internalField.hpp:51
pFlow::internalField< T, void >::time
const Time & time() const
Definition: internalField.hpp:186
pFlow::IOPattern
Definition: IOPattern.hpp:32
pFlow::pointField::name
const word & name() const final
Definition: pointField.hpp:96
Time.hpp
pFlow::IOobject::owner
const repository * owner() const override
Definition: IOobject.hpp:76
pFlow::operator<<
INLINE_FUNCTION iOstream & operator<<(iOstream &str, const AB3History &ab3)
Definition: AdamsBashforth3.hpp:57
pFlow::pointField::boundaryFields
const auto & boundaryFields() const
Definition: pointField.hpp:123
pFlow::objectFile
Definition: objectFile.hpp:30
pFlow::pointField::fill
void fill(const T &val)
Definition: pointField.hpp:138
pFlow::IOstream::name
virtual const word & name() const
Return the name of the stream.
Definition: IOstream.cpp:31
pFlow::internalField
Definition: internalField.hpp:34
pFlow::timeControl::currentIter
int32 currentIter() const
Definition: timeControl.hpp:148
internalField.hpp
pFlow::pointField::updateBoundariesSlaveToMasterIfRequested
void updateBoundariesSlaveToMasterIfRequested()
update boundaries if it is requested previousely (slave to master).
Definition: pointField.hpp:115
pFlow::DataDirection
DataDirection
Definition: boundaryField.hpp:34
pFlow::pointField::readPointField
bool readPointField(iIstream &is, const IOPattern &iop)
Definition: pointField.cpp:236
ioErrorInFile
#define ioErrorInFile(fileName, lineNumber)
Report an error in file operation with supplied fileName and lineNumber.
Definition: error.hpp:87
pFlow::repository
Definition: repository.hpp:34
pFlow::IOstream::lineNumber
int32 lineNumber() const
Const access to the current stream line number.
Definition: IOstream.hpp:223
pFlow::pointField::read
bool read(iIstream &is, const IOPattern &iop) override
Definition: pointField.hpp:150
pointField.cpp
pointStructure.hpp
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59
pFlow::pointField::updateBoundaries
void updateBoundaries(DataDirection direction) const
Definition: pointField.hpp:106
boundaryFieldList.hpp
pFlow::pointField::write
bool write(iOstream &os, const IOPattern &iop) const override
Definition: pointField.hpp:155