8 #ifndef SRC_GRID_STAGGERED_DIST_GRID_HPP_ 9 #define SRC_GRID_STAGGERED_DIST_GRID_HPP_ 11 #include "Grid/grid_dist_id.hpp" 12 #include "staggered_dist_grid_util.hpp" 13 #include "VTKWriter/VTKWriter.hpp" 14 #include "staggered_dist_grid_copy.hpp" 15 #include <boost/mpl/vector_c.hpp> 62 template<
unsigned int dim,
typename St,
typename T,
typename Decomposition=CartDecomposition<dim,St>,
typename Memory=HeapMemory ,
typename device_gr
id=gr
id_cpu<dim,T>>
76 static const unsigned int dims = dim;
161 const size_t (&
g_sz)[dim],
176 if (
extends<
typename boost::mpl::at<
typename T::type,boost::mpl::int_<p> >::type >::
mul() > cmb.size())
177 std::cerr << __FILE__ <<
":" << __LINE__ <<
" error properties has " <<
extends<
typename boost::mpl::at<
typename T::type,boost::mpl::int_<p> >::type >::
mul() <<
" components, but " << cmb.size() <<
"has been defined \n";
191 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop_real> >(ssp);
206 template<
typename Grid_dst ,
unsigned int ... pos>
bool to_normal(Grid_dst & g_dst,
const Padding<dim> & pd,
const long int (& start)[dim],
const long int (& stop)[dim])
211 typedef boost::mpl::vector_c<
unsigned int,pos ... > v_pos_type;
214 boost::mpl::for_each_ref<v_pos_type>(itp);
224 auto g_dst_it = g_dst.getDomainIterator();
227 checkIterator<Grid_dst,decltype(g_map_it),decltype(g_dst_it)>(g_map_it,g_dst_it);
229 while (g_map_it.isNext() ==
true)
232 typedef boost::mpl::size<vid> v_size;
234 auto key_src = g_map_it.get();
237 auto key_dst = g_dst_it.get();
241 interp_ele<vid,Grid_dst,
typename std::remove_reference<decltype(*
this)>::type,
sizeof...(pos)> cp(key_dst,g_dst,*
this,key_src,interp_pos);
244 boost::mpl::for_each_ref<boost::mpl::range_c<int,0,v_size::value>>(cp);
273 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(sgw);
size_t g_sz[dim]
Size of the grid on each dimension.
void setDefaultStagPosition()
It set all the properties defined to be staggered on the default location.
void write(std::string str)
Write a vtk file with the information of the staggered grid.
Decomposition dec
Space Decomposition.
Position of the element of dimension d in the hyper-cube of dimension dim.
this class is a functor for "for_each" algorithm
Ghost< dim, St > ghost
Ghost expansion.
T value_type
Properties for each grid point.
staggered_grid_dist(const size_t(&g_sz)[dim], const Box< dim, St > &domain, const Ghost< dim, St > &ghost)
Constructor.
openfpm::vector< comb< dim > > c_prp[T::max_prop_real]
position of the properties in the grid cell
Class that contain Padding information on each direction positive and Negative direction.
It create separated grid for each properties to write them into a file.
staggered_grid_dist(const Decomposition &dec, const size_t(&g_sz)[dim], const Ghost< dim, St > &ghost)
staggered_grid_dist(const Decomposition &dec, const size_t(&g_sz)[dim], const Ghost< dim, long int > &g)
this class is a functor for "for_each" algorithm
static const unsigned int dims
Number of dimensions.
This class define the domain decomposition interface.
staggered_grid_dist(const size_t(&g_sz)[dim], const Box< dim, St > &domain, const Ghost< dim, long int > &g, const periodicity< dim > &p)
grid_dist_iterator_sub< dim, device_grid > getSubDomainIterator(const grid_key_dx< dim > &start, const grid_key_dx< dim > &stop) const
It return an iterator that span the grid domain only in the specified part.
It model an expression expr1 * expr2.
This is a distributed grid.
Implementation of the staggered grid.
bool is_staggered() const
Return if the grid is staggered.
this class is a functor for "for_each" algorithm
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data
Box< dim, St > domain
Domain.
void setStagPosition(openfpm::vector< comb< dim >> &cmb)
set the staggered positions of the properties
bool to_normal(Grid_dst &g_dst, const Padding< dim > &pd, const long int(&start)[dim], const long int(&stop)[dim])
Copy the staggered grid into a normal one.
bool is_staggered_prop(size_t prp)
Return if the properties is a staggered property or not.
Classes to get the number of components of the properties.
staggered_grid_dist(const grid_dist_id< dim, St, H, typename Decomposition::base_type, Memory, grid_cpu< dim, H >> &g, const Ghost< dim, long int > &gh, Box< dim, size_t > ext)
This constructor is special, it construct an expanded grid that perfectly overlap with the previous.
Implementation of 1-D std::vector like structure.
staggered_grid_dist(const size_t(&g_sz)[dim], const Box< dim, St > &domain, const Ghost< dim, long int > &ghost)
Constructor.
Vcluster & getVC()
Get the Virtual Cluster machine.