Commit c430a22c authored by Pietro Incardona's avatar Pietro Incardona

Adding images for decomposition

parent c80d984d
LINKLIBS = $(METIS_LIB) $(PARMETIS_LIB) $(PTHREAD_LIBS) $(OPT_LIBS) $(BOOST_LDFLAGS) $(BOOST_IOSTREAMS_LIB) $(CUDA_LIBS)
noinst_PROGRAMS = cart_dec metis_dec dom_box
noinst_PROGRAMS = cart_dec metis_dec dom_box vector_dist
cart_dec_SOURCES = CartDecomposition_gen_vtk.cpp ../src/lib/pdata.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
cart_dec_CXXFLAGS = $(PARMETIS_INCLUDE) $(CUDA_CFLAGS) $(INCLUDES_PATH) $(METIS_INCLUDE) $(BOOST_CPPFLAGS) -I../src -Wno-unused-function -Wno-unused-local-typedefs
cart_dec_CFLAGS = $(CUDA_CFLAGS)
......@@ -17,6 +17,11 @@ dom_box_CXXFLAGS = $(CUDA_CFLAGS) $(INCLUDES_PATH) $(METIS_INCLUDE) $(BOOST_CPPF
dom_box_CFLAGS = $(CUDA_CFLAGS)
dom_box_LDADD = $(LINKLIBS)
vector_dist_SOURCES = vector.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_vcluster/src/VCluster.cpp ../openfpm_devices/src/memory/PtrMemory.cpp
vector_dist_CXXFLAGS = $(CUDA_CFLAGS) $(INCLUDES_PATH) $(HDF5_CPPFLAGS) $(PARMETIS_INCLUDE) $(METIS_INCLUDE) $(BOOST_CPPFLAGS) -I../src -Wno-unused-function -Wno-unused-local-typedefs
vector_dist_CFLAGS = $(CUDA_CFLAGS)
vector_dist_LDADD = $(LINKLIBS) -lparmetis -lmetis
.cu.o :
$(NVCC) $(NVCCFLAGS) -o $@ -c $<
......@@ -26,12 +31,17 @@ dom_box_LDADD = $(LINKLIBS)
images : cart_dec metis_dec dom_box
rm -rf CartDecomposition
rm -rf Metis
rm -rf Vector
mkdir CartDecomposition
mkdir Metis
mkdir Vector
mpirun -np 4 ./cart_dec
mpirun -np 3 ./vector_dist
./dom_box
./metis_dec
mkdir -p generated
mkdir -p static
pvbatch Domain_decomposition.py
pvbatch Vector_dist.py
dot -Tsvg openfpm.dot -o generated/openfpm.svg
#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
# create a new 'CSV Reader'
vector_before_map0csv = CSVReader(FileName=['/home/i-bird/Desktop/MOSAIC/OpenFPM_project/openfpm_pdata/images/Vector/vector_before_map0.csv'])
# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# uncomment following to set a specific view size
# renderView1.ViewSize = [1020, 495]
# set active view
SetActiveView(renderView1)
# create a new 'Table To Points'
tableToPoints1 = TableToPoints(Input=vector_before_map0csv)
tableToPoints1.XColumn = 'x[0]'
tableToPoints1.YColumn = 'x[1]'
tableToPoints1.a2DPoints = 1
# show data in view
tableToPoints1Display = Show(tableToPoints1, renderView1)
# trace defaults for the display properties.
tableToPoints1Display.ColorArrayName = [None, '']
# change representation type
tableToPoints1Display.SetRepresentationType('Points')
# create a new 'CSV Reader'
vector_before_map1csv = CSVReader(FileName=['/home/i-bird/Desktop/MOSAIC/OpenFPM_project/openfpm_pdata/images/Vector/vector_before_map1.csv'])
# set active view
SetActiveView(renderView1)
# create a new 'Table To Points'
tableToPoints2 = TableToPoints(Input=vector_before_map1csv)
tableToPoints2.XColumn = 'x[0]'
tableToPoints2.YColumn = 'x[1]'
tableToPoints2.a2DPoints = 1
# show data in view
tableToPoints2Display = Show(tableToPoints2, renderView1)
# trace defaults for the display properties.
tableToPoints2Display.ColorArrayName = [None, '']
# change representation type
tableToPoints2Display.SetRepresentationType('Points')
# change solid color
tableToPoints2Display.AmbientColor = [0.0, 1.0, 0.0]
# create a new 'CSV Reader'
vector_before_map2csv = CSVReader(FileName=['/home/i-bird/Desktop/MOSAIC/OpenFPM_project/openfpm_pdata/images/Vector/vector_before_map2.csv'])
# set active view
SetActiveView(renderView1)
# create a new 'Table To Points'
tableToPoints3 = TableToPoints(Input=vector_before_map2csv)
tableToPoints3.XColumn = 'x[0]'
tableToPoints3.YColumn = 'x[1]'
tableToPoints3.a2DPoints = 1
# show data in view
tableToPoints3Display = Show(tableToPoints3, renderView1)
# trace defaults for the display properties.
tableToPoints3Display.ColorArrayName = [None, '']
# change representation type
tableToPoints3Display.SetRepresentationType('Points')
# change solid color
tableToPoints3Display.AmbientColor = [1.0, 0.35294117647058826, 0.35294117647058826]
#### saving camera placements for all active views
# current camera placement for renderView1
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.50000391295, 0.499549132735, 10000.0]
renderView1.CameraFocalPoint = [0.50000391295, 0.499549132735, 0.0]
renderView1.CameraParallelScale = 0.7067808453124975
#### uncomment the following to render all views
# RenderAllViews()
# alternatively, if you want to write images, you can use SaveScreenshot(...).
WriteImage("generated/non_geometrical_decomposition.jpg")
# destroy tableToPoints1
Delete(tableToPoints1)
del tableToPoints1
Delete(tableToPoints2)
del tableToPoints2
Delete(tableToPoints3)
del tableToPoints3
# destroy vector_before_map0csv
Delete(vector_before_map0csv)
del vector_before_map0csv
Delete(vector_before_map1csv)
del vector_before_map1csv
Delete(vector_before_map2csv)
del vector_before_map2csv
# create a new 'CSV Reader'
vector_before_map0csv = CSVReader(FileName=['/home/i-bird/Desktop/MOSAIC/OpenFPM_project/openfpm_pdata/images/Vector/vector_after_map0.csv'])
# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# uncomment following to set a specific view size
# renderView1.ViewSize = [1020, 495]
# set active view
SetActiveView(renderView1)
# create a new 'Table To Points'
tableToPoints1 = TableToPoints(Input=vector_before_map0csv)
tableToPoints1.XColumn = 'x[0]'
tableToPoints1.YColumn = 'x[1]'
tableToPoints1.a2DPoints = 1
# show data in view
tableToPoints1Display = Show(tableToPoints1, renderView1)
# trace defaults for the display properties.
tableToPoints1Display.ColorArrayName = [None, '']
# change representation type
tableToPoints1Display.SetRepresentationType('Points')
# create a new 'CSV Reader'
vector_before_map1csv = CSVReader(FileName=['/home/i-bird/Desktop/MOSAIC/OpenFPM_project/openfpm_pdata/images/Vector/vector_after_map1.csv'])
# set active view
SetActiveView(renderView1)
# create a new 'Table To Points'
tableToPoints2 = TableToPoints(Input=vector_before_map1csv)
tableToPoints2.XColumn = 'x[0]'
tableToPoints2.YColumn = 'x[1]'
tableToPoints2.a2DPoints = 1
# show data in view
tableToPoints2Display = Show(tableToPoints2, renderView1)
# trace defaults for the display properties.
tableToPoints2Display.ColorArrayName = [None, '']
# change representation type
tableToPoints2Display.SetRepresentationType('Points')
# change solid color
tableToPoints2Display.AmbientColor = [0.0, 1.0, 0.0]
# create a new 'CSV Reader'
vector_before_map2csv = CSVReader(FileName=['/home/i-bird/Desktop/MOSAIC/OpenFPM_project/openfpm_pdata/images/Vector/vector_after_map2.csv'])
# set active view
SetActiveView(renderView1)
# create a new 'Table To Points'
tableToPoints3 = TableToPoints(Input=vector_before_map2csv)
tableToPoints3.XColumn = 'x[0]'
tableToPoints3.YColumn = 'x[1]'
tableToPoints3.a2DPoints = 1
# show data in view
tableToPoints3Display = Show(tableToPoints3, renderView1)
# trace defaults for the display properties.
tableToPoints3Display.ColorArrayName = [None, '']
# change representation type
tableToPoints3Display.SetRepresentationType('Points')
# change solid color
tableToPoints3Display.AmbientColor = [1.0, 0.35294117647058826, 0.35294117647058826]
#### saving camera placements for all active views
# current camera placement for renderView1
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.50000391295, 0.499549132735, 10000.0]
renderView1.CameraFocalPoint = [0.50000391295, 0.499549132735, 0.0]
renderView1.CameraParallelScale = 0.7067808453124975
#### uncomment the following to render all views
# RenderAllViews()
# alternatively, if you want to write images, you can use SaveScreenshot(...).
WriteImage("generated/geometrical_decomposition.jpg")
digraph openfpm {
ratio = fill;
node [ shape = box color = blue ];
API;
node [ shape = oval color=red ] Core pdata data Vcluster "devices (Memory)";
node [ color=black ] Numerics IO;
API -> Core [ arrowhead=crow color=blue ]
Core -> pdata
Numerics -> Core
Numerics -> pdata
Numerics -> data
pdata -> Vcluster
pdata -> data
Vcluster -> data
data -> "devices (Memory)"
IO -> data
IO -> pdata
IO -> Core
Vcluster -> "devices (Memory)"
}
#include "Vector/vector_dist.hpp"
#include "Decomposition/CartDecomposition.hpp"
template<typename T> class Particle
{
public:
typedef boost::fusion::vector<T,T[3],T[3][3]> type;
type data;
static const unsigned int s = 0;
static const unsigned int v = 1;
static const unsigned int t = 2;
static const unsigned int max_prop = 3;
};
int main(int argc, char* argv[])
{
//
// ### WIKI 2 ###
//
// Here we Initialize the library, than we create a uniform random generator between 0 and 1 to to generate particles
// randomly in the domain, we create a Box that define our domain, boundary conditions, and ghost
//
init_global_v_cluster(&argc,&argv);
Vcluster & v_cl = *global_v_cluster;
typedef Point<2,float> s;
// set the seed
// create the random generator engine
std::default_random_engine eg(v_cl.getProcessUnitID()*100);
std::uniform_real_distribution<float> ud(0.0f, 1.0f);
Box<2,float> domain({0.0,0.0},{1.0,1.0});
size_t bc[2]={PERIODIC,PERIODIC};
Ghost<2,float> g(0.01);
vector_dist<2,float, Particle<float>, CartDecomposition<2,float> > vd(4096,domain,bc,g);
auto it = vd.getIterator();
while (it.isNext())
{
auto key = it.get();
vd.template getPos<s::x>(key)[0] = ud(eg);
vd.template getPos<s::x>(key)[1] = ud(eg);
++it;
}
vd.write("Vector/vector_before_map");
vd.map();
vd.write("Vector/vector_after_map");
vd.ghost_get<0,1,2>();
delete_global_v_cluster();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment