# PhasicFlow: src/Interaction/contactSearch/wallMappings/multiGridMapping.hpp Source File

multiGridMapping.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 __multiGridMapping_hpp__
#define __multiGridMapping_hpp__
#include "cellsWallLevels.hpp"
#include "dictionary.hpp"
namespace pFlow
{
template<
typename executionSpace
>
class multiGridMapping
{
public:
using CellsWallLevelType = cellsWallLevels<executionSpace>;
using IdType = typename CellsWallLevelType::IdType;
using IndexType = typename CellsWallLevelType::IndexType;
using Cells = typename CellsWallLevelType::Cells;
using CellType = typename Cells::CellType;
using execution_space = typename CellsWallLevelType::execution_space;
using memory_space = typename CellsWallLevelType::memory_space;
using iBoxType = iBox<IndexType>;
protected:
// - update frequency
int32 updateFrequency_=1;
real cellExtent_;
int32 currentIter_ = 0;
bool performedSearch_ = false;
CellsWallLevelType cellsWallLevle_;
private:
bool performSearch()
{
if(currentIter_ % updateFrequency_ == 0)
{
currentIter_++;
return true;
}else
{
currentIter_++;
return false;
}
}
public:
TypeInfoNV("multiGridMapping");
multiGridMapping(
const dictionary& dict,
int32 numLevels,
const Vector<Cells>& ppCells,
int32 numPoints,
int32 numElements,
const ViewType1D<realx3,memory_space>& points,
const ViewType1D<int32x3,memory_space>& vertices
)
:
updateFrequency_(
max(
dict.getVal<int32>("updateFrequency"),
1)),
cellExtent_(
max(
dict.getVal<real>("cellExtent"),
0.5)),
cellsWallLevle_(
numLevels,
ppCells,
cellExtent_,
numPoints,
numElements,
points,
vertices
)
{
REPORT(3)<<"Multi-grid wall mapping with "<<
yellowText(numLevels)<<" levels has been created."<<endREPORT;
}
bool enterBoadSearch()const
{
return currentIter_%updateFrequency_==0;
}
bool performedSearch()const
{
return performedSearch_;
}
template<typename PairsContainer, typename particleMapType>
bool broadSearch(PairsContainer& pairs, particleMapType& particleMap, bool force=false)
{
if(force) currentIter_ = 0;
performedSearch_= false;
if(!performSearch())return true;
cellsWallLevle_.broadSearch(pairs, particleMap);
performedSearch_ = true;
return true;
}
}; // multiGridMapping
} // pFlow
#endif
pFlow::cellsWallLevels::Cells
typename cellsWallLevel0Type::Cells Cells
Definition: cellsWallLevels.hpp:42
pFlow::multiGridMapping::performSearch
bool performSearch()
Definition: multiGridMapping.hpp:71
endREPORT
#define endREPORT
Definition: streams.hpp:41
pFlow::multiGridMapping::multiGridMapping
multiGridMapping(const dictionary &dict, int32 numLevels, const Vector< Cells > &ppCells, int32 numPoints, int32 numElements, const ViewType1D< realx3, memory_space > &points, const ViewType1D< int32x3, memory_space > &vertices)
Definition: multiGridMapping.hpp:89
pFlow::real
float real
Definition: builtinTypes.hpp:46
pFlow::multiGridMapping::execution_space
typename CellsWallLevelType::execution_space execution_space
Definition: multiGridMapping.hpp:48
REPORT
#define REPORT(n)
Definition: streams.hpp:40
pFlow::multiGridMapping::CellType
typename Cells::CellType CellType
Definition: multiGridMapping.hpp:46
pFlow::multiGridMapping::updateFrequency_
int32 updateFrequency_
Definition: multiGridMapping.hpp:58
pFlow::multiGridMapping::performedSearch_
bool performedSearch_
a broad search has been occured during last pass?
Definition: multiGridMapping.hpp:65
pFlow::multiGridMapping::IndexType
typename CellsWallLevelType::IndexType IndexType
Definition: multiGridMapping.hpp:42
pFlow::multiGridMapping::TypeInfoNV
TypeInfoNV("multiGridMapping")
pFlow::cellsWallLevels
Definition: cellsWallLevels.hpp:32
pFlow::multiGridMapping::cellsWallLevle_
CellsWallLevelType cellsWallLevle_
Definition: multiGridMapping.hpp:67
pFlow
Definition: demComponent.hpp:28
pFlow::multiGridMapping::performedSearch
bool performedSearch() const
Definition: multiGridMapping.hpp:128
cellsWallLevels.hpp
pFlow::cellsWallLevels::IndexType
typename cellsWallLevel0Type::IndexType IndexType
Definition: cellsWallLevels.hpp:40
pFlow::cellsWallLevels::IdType
typename cellsWallLevel0Type::IdType IdType
Definition: cellsWallLevels.hpp:38
pFlow::multiGridMapping::currentIter_
int32 currentIter_
Definition: multiGridMapping.hpp:62
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::multiGridMapping::cellExtent_
real cellExtent_
Definition: multiGridMapping.hpp:60
dictionary.hpp
pFlow::multiGridMapping::IdType
typename CellsWallLevelType::IdType IdType
Definition: multiGridMapping.hpp:40
pFlow::multiGridMapping::Cells
typename CellsWallLevelType::Cells Cells
Definition: multiGridMapping.hpp:44
pFlow::max
T max(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:164
pFlow::multiGridMapping::memory_space
typename CellsWallLevelType::memory_space memory_space
Definition: multiGridMapping.hpp:50
pFlow::cellsWallLevels::broadSearch
bool broadSearch(PairsContainer &pairs, particleMapType &particleMap)
Definition: cellsWallLevels.hpp:96
pFlow::cellsWallLevels::memory_space
typename cellsWallLevel0Type::memory_space memory_space
Definition: cellsWallLevels.hpp:48
pFlow::multiGridMapping::enterBoadSearch
bool enterBoadSearch() const
Definition: multiGridMapping.hpp:123
pFlow::multiGridMapping
Definition: multiGridMapping.hpp:34
pFlow::ViewType1D
Kokkos::View< T *, properties... > ViewType1D
Definition: KokkosTypes.hpp:62
pFlow::cellsWallLevels::execution_space
typename cellsWallLevel0Type::execution_space execution_space
Definition: cellsWallLevels.hpp:46
pFlow::multiGridMapping::broadSearch
bool broadSearch(PairsContainer &pairs, particleMapType &particleMap, bool force=false)
Definition: multiGridMapping.hpp:134
pFlow::iBox
Definition: iBox.hpp:33
yellowText
#define yellowText(text)
Definition: streams.hpp:30
pFlow::Vector
Definition: Vector.hpp:46
pFlow::dictionary
Definition: dictionary.hpp:38