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

boundaryFieldList.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 __boundaryFieldList_hpp__
#define __boundaryFieldList_hpp__
#include "boundaryField.hpp"
#include "boundaryList.hpp"
#include "ListPtr.hpp"
namespace pFlow
{
template< class T, class MemorySpace = void >
class boundaryFieldList
:
public ListPtr< boundaryField<T, MemorySpace> >
{
public:
using BoundaryFieldType = boundaryField<T, MemorySpace>;
using InternalFieldType = typename BoundaryFieldType::InternalFieldType;
protected:
const boundaryList& boundaries_;
uint32 slaveToMasterUpdateIter_ = static_cast< uint32 >(-1);
public:
boundaryFieldList(const boundaryList& boundaries, InternalFieldType& internal)
:
ListPtr<BoundaryFieldType>(boundaries.size()),
boundaries_(boundaries)
{
for(auto i=0; i<boundaries.size(); i++)
{
this->set
(
i,
BoundaryFieldType::create(boundaries_[i], boundaries_.pStruct() ,internal)
);
}
}
void updateBoundaries(uint32 iter, DataDirection direction)
{
if( direction == DataDirection::SlaveToMaster
&& slaveToMasterUpdateIter_ == iter) return;
// first step
uint32 i=0;
for(auto b:*this)
{
if(i==0 )
{
//pOutput<<"request for update boundaries for field "<< b->name()<<endl;
i++;
}
b->updateBoundary(1, direction);
}
// second step
for(auto b:*this)
{
b->updateBoundary(2, direction);
}
if(direction == DataDirection::SlaveToMaster)
{
slaveToMasterUpdateIter_ = iter;
}
}
void fill(const T& val)
{
for(auto& bf: *this)
{
bf->fill(val);
}
}
bool slaveToMasterUpdateRequested()const
{
return slaveToMasterUpdateIter_ != static_cast< uint32 >(-1);
}
};
}
#endif
pFlow::boundaryField::create
static uniquePtr< boundaryField > create(const boundaryBase &boundary, const pointStructure &pStruct, InternalFieldType &internal)
Definition: boundaryField.cpp:62
pFlow::ListPtr::size
size_t size() const
Definition: ListPtrI.hpp:266
pFlow::DataDirection::SlaveToMaster
@ SlaveToMaster
pFlow::boundaryField
Definition: boundaryField.hpp:42
pFlow::ListPtr
Definition: ListPtr.hpp:37
ListPtr.hpp
boundaryField.hpp
pFlow::boundaryField::InternalFieldType
internalField< T, MemorySpace > InternalFieldType
Definition: boundaryField.hpp:50
pFlow::boundaryFieldList::slaveToMasterUpdateIter_
uint32 slaveToMasterUpdateIter_
Definition: boundaryFieldList.hpp:47
pFlow::boundaryList::pStruct
const pointStructure & pStruct() const
Definition: boundaryList.hpp:89
pFlow::boundaryFieldList::updateBoundaries
void updateBoundaries(uint32 iter, DataDirection direction)
Definition: boundaryFieldList.hpp:66
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::boundaryList
Definition: boundaryList.hpp:35
pFlow::boundaryFieldList::slaveToMasterUpdateRequested
bool slaveToMasterUpdateRequested() const
Definition: boundaryFieldList.hpp:105
pFlow
Definition: demGeometry.hpp:27
boundaryList.hpp
pFlow::boundaryFieldList::fill
void fill(const T &val)
Definition: boundaryFieldList.hpp:97
pFlow::boundaryFieldList< VectorField, realx3, void >::InternalFieldType
typename BoundaryFieldType::InternalFieldType InternalFieldType
Definition: boundaryFieldList.hpp:40
pFlow::boundaryFieldList::boundaries_
const boundaryList & boundaries_
Definition: boundaryFieldList.hpp:45
pFlow::DataDirection
DataDirection
Definition: boundaryField.hpp:34
pFlow::boundaryFieldList::boundaryFieldList
boundaryFieldList(const boundaryList &boundaries, InternalFieldType &internal)
Definition: boundaryFieldList.hpp:51