OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
DrawParticles Class Reference

A class to draw/create particles based on simple shaped. More...

Detailed Description

A class to draw/create particles based on simple shaped.

Draw box example

size_t sz[] = {23,27,20};
Box<3,double> domain({-1.2,0.5,-0.6},{1.0,3.1,1.3});
Box<3,double> sub_domain({-0.15,0.75,0.15},{1.05,1.15,1.05});
Box<3,double> sub_real({-0.1,0.80,0.2},{1.0,1.1,1.0});
size_t sz_sub[] = {12,4,9};
// Boundary conditions
size_t bc[3]={NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
// ghost, big enough to contain the interaction radius
Ghost<3,float> ghost(0.01);
auto p = DrawParticles::DrawBox(vd,sz,domain,sub_domain);
size_t cnt = 0;
bool good = true;
while (p.isNext())
{
vd.add();
vd.getLastPos()[0] = p.get().get(0);
vd.getLastPos()[1] = p.get().get(1);
vd.getLastPos()[2] = p.get().get(2);
good &= sub_domain.isInside(p.get());
cnt++;
++p;
}

Definition at line 22 of file DrawParticles.hpp.

#include <DrawParticles.hpp>

Static Public Member Functions

template<unsigned int dim, typename T , typename aggr , typename layout , template< typename > class layout_base, typename Decomposition >
static PointIteratorSkin< dim,
T, Decomposition
DrawSkin (vector_dist< dim, T, aggr, layout, layout_base, Decomposition > &vd, size_t(&sz)[dim], Box< dim, T > &domain, Box< dim, T > &sub_A, Box< dim, T > &sub_B)
 Draw particles in a box B excluding the area of a second box A (B - A) More...
 
template<unsigned int dim, typename T , typename aggr , typename layout , template< typename > class layout_base, typename Decomposition >
static PointIteratorSkin< dim,
T, Decomposition
DrawSkin (vector_dist< dim, T, aggr, layout, layout_base, Decomposition > &vd, size_t(&sz)[dim], Box< dim, T > &domain, openfpm::vector< Box< dim, T >> &sub_A, Box< dim, T > &sub_B)
 Draw particles in a box B excluding the areas of an array of boxes A_n. More...
 
template<unsigned int dim, typename T , typename aggr , typename layout , template< typename > class layout_base, typename Decomposition >
static PointIterator< dim, T,
Decomposition
DrawBox (vector_dist< dim, T, aggr, layout, layout_base, Decomposition > &vd, size_t(&sz)[dim], Box< dim, T > &domain, Box< dim, T > &sub)
 Draw particles in a box. More...
 

Member Function Documentation

template<unsigned int dim, typename T , typename aggr , typename layout , template< typename > class layout_base, typename Decomposition >
static PointIterator<dim,T,Decomposition> DrawParticles::DrawBox ( vector_dist< dim, T, aggr, layout, layout_base, Decomposition > &  vd,
size_t(&)  sz[dim],
Box< dim, T > &  domain,
Box< dim, T > &  sub 
)
inlinestatic

Draw particles in a box.

The function return an iterator over particles defined on a virtual grid in the simulation domain.

Parameters
vdparticles where we are creating the particles
szindicate the grid size of the virtual grid.
domainDomain where the virtual grid is defined (Must match the domain of vd)
subbox contained in domain that define where the particle iterator must iterate, particles are placed strictly inside this box
Note
Suppose to have a simulation domain of 1.5 on x and we use sz = 16. Consider now to have particles with spacing 0.1 on x. if we define a sub box that on extend from 0.65 to 0.95 the first fluid particle is at 0.70 and the last is at 0.90
Returns
an iterator to the selected particles

Definition at line 121 of file DrawParticles.hpp.

template<unsigned int dim, typename T , typename aggr , typename layout , template< typename > class layout_base, typename Decomposition >
static PointIteratorSkin<dim,T,Decomposition> DrawParticles::DrawSkin ( vector_dist< dim, T, aggr, layout, layout_base, Decomposition > &  vd,
size_t(&)  sz[dim],
Box< dim, T > &  domain,
Box< dim, T > &  sub_A,
Box< dim, T > &  sub_B 
)
inlinestatic

Draw particles in a box B excluding the area of a second box A (B - A)

The function return an iterator over particles defined on a virtual grid in the simulation domain.

Parameters
vdparticles where we are creating the particles
szindicate the grid size of the virtual grid.
domainDomain where the virtual grid is defined (Must match the domain of vd)
sub_Bbox contained in domain that define where the particle iterator must iterate, particles are placed strictly inside this box
sub_Abox contained in the domain that define where the particle iterator should not iterate (excluding area)
Note
Suppose to have a simulation domain of 1.5 on x and we use sz = 16. Consider now to have particles with spacing 0.1 on x. if we define a sub_A that on extend from 0.65 to 0.95 the first fluid particle is at 0.70 and the last is at 0.90
Returns
an iterator to the selected particles

Definition at line 47 of file DrawParticles.hpp.

template<unsigned int dim, typename T , typename aggr , typename layout , template< typename > class layout_base, typename Decomposition >
static PointIteratorSkin<dim,T,Decomposition> DrawParticles::DrawSkin ( vector_dist< dim, T, aggr, layout, layout_base, Decomposition > &  vd,
size_t(&)  sz[dim],
Box< dim, T > &  domain,
openfpm::vector< Box< dim, T >> &  sub_A,
Box< dim, T > &  sub_B 
)
inlinestatic

Draw particles in a box B excluding the areas of an array of boxes A_n.

The function return an iterator over particles defined on a virtual grid in the simulation domain.

Parameters
vdparticles where we are creating the particles
szindicate the grid size of the virtual grid.
domainDomain where the virtual grid is defined (Must match the domain of vd)
sub_Bbox contained in domain that define where the particle iterator must iterate, particles are placed strictly inside this box
sub_Aarray of boxes contained in the domain that define where the particle iterator should not iterate (excluding areas)
Note
Suppose to have a simulation domain of 1.5 on x and we use sz = 16. Consider now to have particles with spacing 0.1 on x. if we define a sub_A that on extend from 0.65 to 0.95 the first fluid particle is at 0.70 and the last is at 0.90
Returns
an iterator to the selected particles

Definition at line 83 of file DrawParticles.hpp.


The documentation for this class was generated from the following file: