OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
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,double> 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;
}
This class represent an N-dimensional box.
Definition Box.hpp:61
static PointIterator< dim, T, typename vd_type::Decomposition_type > DrawBox(vd_type &vd, size_t(&sz)[dim], Box< dim, T > &domain, Box< dim, T > &sub)
Draw particles in a box.
Distributed vector.

Definition at line 22 of file DrawParticles.hpp.

#include <DrawParticles.hpp>

Static Public Member Functions

template<unsigned int dim, typename T , typename vd_type >
static PointIteratorSkin< dim, T, typename vd_type::Decomposition_type > DrawSkin (vd_type &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)
 
template<unsigned int dim, typename T , typename vd_type >
static PointIteratorSkin< dim, T, typename vd_type::Decomposition_type > DrawSkin (vd_type &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.
 
template<unsigned int dim, typename T , typename vd_type >
static PointIterator< dim, T, typename vd_type::Decomposition_type > DrawBox (vd_type &vd, size_t(&sz)[dim], Box< dim, T > &domain, Box< dim, T > &sub)
 Draw particles in a box.
 

Member Function Documentation

◆ DrawBox()

template<unsigned int dim, typename T , typename vd_type >
static PointIterator< dim, T, typename vd_type::Decomposition_type > DrawParticles::DrawBox ( vd_type &  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 123 of file DrawParticles.hpp.

◆ DrawSkin() [1/2]

template<unsigned int dim, typename T , typename vd_type >
static PointIteratorSkin< dim, T, typename vd_type::Decomposition_type > DrawParticles::DrawSkin ( vd_type &  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 48 of file DrawParticles.hpp.

◆ DrawSkin() [2/2]

template<unsigned int dim, typename T , typename vd_type >
static PointIteratorSkin< dim, T, typename vd_type::Decomposition_type > DrawParticles::DrawSkin ( vd_type &  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 85 of file DrawParticles.hpp.


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