# PhasicFlow: src/phasicFlow/containers/pointField/boundaryField/boundaryField/boundaryField.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.

boundaryField.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 __boundaryField_hpp__
#define __boundaryField_hpp__
#include "generalBoundary.hpp"
#include "internalField.hpp"
namespace pFlow
{
// forward
template< class T, class MemorySpace>
class boundaryFieldList;
enum class DataDirection
{
MasterToSlave,
SlaveToMaster,
TwoWay
};
template< class T, class MemorySpace = void>
class boundaryField
:
public generalBoundary
{
public:
using BoundaryFieldType = boundaryField<T, MemorySpace>;
using InternalFieldType = internalField<T, MemorySpace>;
using memory_space = typename InternalFieldType::memory_space;
using execution_space = typename InternalFieldType::execution_space;
using FieldAccessType = scatteredFieldAccess<T, memory_space>;
using ProcVectorType = VectorSingle<T,MemorySpace>;
private:
friend class boundaryFieldList<T,MemorySpace>;
InternalFieldType& internal_;
virtual
bool updateBoundary(int step, DataDirection direction)
{
return true;
}
public:
TypeInfoTemplate211("boundaryField","none" ,T, memory_space::name());
boundaryField(
const boundaryBase& boundary,
const pointStructure& pStruct,
InternalFieldType& internal);
create_vCtor
(
boundaryField,
boundaryBase,
(
const boundaryBase& boundary,
const pointStructure& pStruct,
InternalFieldType& internal
),
(boundary, pStruct, internal)
);
add_vCtor
(
BoundaryFieldType,
BoundaryFieldType,
boundaryBase
);
bool hearChanges
(
real t,
real dt,
uint32 iter,
const message& msg,
const anyList& varList
) override
{
if(msg.equivalentTo(message::BNDR_REARRANGE))
{
// do nothing
}
if(msg.equivalentTo(message::BNDR_RESET))
{
//do nothing
}
return true;
}
inline
InternalFieldType& internal()
{
return internal_;
}
inline
const InternalFieldType& internal()const
{
return internal_;
}
word fieldName()const
{
return internal_.name();
}
word name()const
{
return groupNames(fieldName(),boundaryName());
}
FieldAccessType thisField()const
{
if constexpr(isDeviceAccessible<execution_space>())
return FieldAccessType(
this->size(),
this->indexList().deviceViewAll(),
internal_.deviceViewAll());
else
return FieldAccessType(
this->size(),
this->boundary().indexListHost().deviceViewAll(),
internal_.deviceViewAll());
}
FieldAccessType mirrorField()const
{
if constexpr(isDeviceAccessible<execution_space>())
return FieldAccessType(
this->mirrorBoundary().size(),
this->mirrorBoundary().indexList().deviceViewAll(),
internal_.deviceViewAll());
else
return FieldAccessType(
this->mirrorBoundary().size(),
this->mirrorBoundary().indexListHost().deviceViewAll(),
internal_.deviceViewAll());
}
virtual
ProcVectorType& neighborProcField();
virtual
const ProcVectorType& neighborProcField()const;
virtual
void fill(const T& val)
{
return;
}
static
uniquePtr<boundaryField> create(
const boundaryBase& boundary,
const pointStructure& pStruct,
InternalFieldType& internal);
};
}
#include "boundaryField.cpp"
#endif
pFlow::boundaryField< T, void >::execution_space
typename InternalFieldType::execution_space execution_space
Definition: boundaryField.hpp:54
pFlow::message::equivalentTo
bool equivalentTo(EVENT evnt) const
Definition: message.hpp:131
pFlow::boundaryField::create
static uniquePtr< boundaryField > create(const boundaryBase &boundary, const pointStructure &pStruct, InternalFieldType &internal)
Definition: boundaryField.cpp:62
pFlow::DataDirection::SlaveToMaster
@ SlaveToMaster
pFlow::generalBoundary::indexList
const auto & indexList() const
Definition: generalBoundary.hpp:114
pFlow::boundaryField::fill
virtual void fill(const T &val)
Definition: boundaryField.hpp:182
pFlow::boundaryField
Definition: boundaryField.hpp:42
pFlow::scatteredFieldAccess
Definition: scatteredFieldAccess.hpp:32
pFlow::message
Definition: message.hpp:33
boundaryField.cpp
pFlow::real
float real
Definition: builtinTypes.hpp:45
pFlow::boundaryField::TypeInfoTemplate211
TypeInfoTemplate211("boundaryField","none", T, memory_space::name())
pFlow::boundaryField::updateBoundary
virtual bool updateBoundary(int step, DataDirection direction)
Definition: boundaryField.hpp:69
pFlow::boundaryField::ProcVectorType
VectorSingle< T, MemorySpace > ProcVectorType
Definition: boundaryField.hpp:58
pFlow::boundaryField::InternalFieldType
internalField< T, MemorySpace > InternalFieldType
Definition: boundaryField.hpp:50
pFlow::boundaryField::create_vCtor
create_vCtor(boundaryField, boundaryBase,(const boundaryBase &boundary, const pointStructure &pStruct, InternalFieldType &internal),(boundary, pStruct, internal))
pFlow::internalField::deviceViewAll
const auto & deviceViewAll() const
Definition: internalField.hpp:92
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::boundaryField::BoundaryFieldType
boundaryField< T, MemorySpace > BoundaryFieldType
Definition: boundaryField.hpp:48
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::internalField::memory_space
typename FieldType::memory_space memory_space
Definition: internalField.hpp:49
pFlow::generalBoundary::pStruct
const auto & pStruct() const
Definition: generalBoundary.hpp:138
pFlow::message::BNDR_REARRANGE
@ BNDR_REARRANGE
Definition: message.hpp:46
pFlow::boundaryField::name
word name() const
Definition: boundaryField.hpp:141
pFlow
Definition: demGeometry.hpp:27
pFlow::boundaryFieldList
Definition: boundaryField.hpp:32
pFlow::DataDirection::TwoWay
@ TwoWay
pFlow::message::BNDR_RESET
@ BNDR_RESET
Definition: message.hpp:48
pFlow::boundaryField< T, void >::memory_space
typename InternalFieldType::memory_space memory_space
Definition: boundaryField.hpp:52
pFlow::boundaryField::mirrorField
FieldAccessType mirrorField() const
Definition: boundaryField.hpp:160
pFlow::pointStructure
Definition: pointStructure.hpp:34
pFlow::anyList
Definition: anyList.hpp:35
pFlow::boundaryField::add_vCtor
add_vCtor(BoundaryFieldType, BoundaryFieldType, boundaryBase)
pFlow::boundaryField::internal_
InternalFieldType & internal_
a ref to the internal field
Definition: boundaryField.hpp:66
pFlow::internalField::execution_space
typename FieldType::execution_space execution_space
Definition: internalField.hpp:51
pFlow::boundaryBase
Definition: boundaryBase.hpp:42
pFlow::VectorSingle< T, void >
pFlow::boundaryField::boundaryField
boundaryField(const boundaryBase &boundary, const pointStructure &pStruct, InternalFieldType &internal)
Definition: boundaryField.cpp:23
pFlow::internalField< T, void >
pFlow::boundaryField::thisField
FieldAccessType thisField() const
Definition: boundaryField.hpp:146
pFlow::boundaryField::hearChanges
bool hearChanges(real t, real dt, uint32 iter, const message &msg, const anyList &varList) override
Definition: boundaryField.hpp:104
internalField.hpp
pFlow::DataDirection
DataDirection
Definition: boundaryField.hpp:34
pFlow::uniquePtr
Definition: uniquePtr.hpp:42
generalBoundary.hpp
pFlow::generalBoundary::boundary
const auto & boundary() const
Definition: generalBoundary.hpp:108
pFlow::groupNames
word groupNames(const word &bw, const word &tw, char sep='.')
Group words and output bw.tw.
Definition: bTypesFunctions.cpp:179
pFlow::boundaryField::neighborProcField
virtual ProcVectorType & neighborProcField()
Definition: boundaryField.cpp:41
pFlow::DataDirection::MasterToSlave
@ MasterToSlave
pFlow::boundaryField::fieldName
word fieldName() const
Definition: boundaryField.hpp:136
pFlow::generalBoundary::size
auto size() const
Definition: generalBoundary.hpp:78
pFlow::generalBoundary::mirrorBoundary
const auto & mirrorBoundary() const
Definition: generalBoundary.hpp:120
pFlow::generalBoundary
Definition: generalBoundary.hpp:38
pFlow::internalField::name
word name() const
Definition: internalField.hpp:145
pFlow::generalBoundary::boundaryName
const word & boundaryName() const
Definition: generalBoundary.hpp:126
pFlow::boundaryField::FieldAccessType
scatteredFieldAccess< T, memory_space > FieldAccessType
Definition: boundaryField.hpp:56