Skip to content
Snippets Groups Projects
Commit 118a7c2b authored by Pietro Incardona's avatar Pietro Incardona
Browse files

Latest modules

parent a9125107
No related branches found
No related tags found
No related merge requests found
Pipeline #2175 failed
Showing
with 0 additions and 2007 deletions
...@@ -221,7 +221,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config/config_cmake.h.in ${CMAKE_ ...@@ -221,7 +221,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config/config_cmake.h.in ${CMAKE_
add_subdirectory (src) add_subdirectory (src)
add_subdirectory (openfpm_devices) add_subdirectory (openfpm_devices)
add_subdirectory (images)
add_subdirectory (openfpm_data) add_subdirectory (openfpm_data)
add_subdirectory (openfpm_io) add_subdirectory (openfpm_io)
add_subdirectory (openfpm_vcluster) add_subdirectory (openfpm_vcluster)
......
include ../../example.mk
CC=mpic++
LDIR =
OBJ = main.o
%.o: %.cpp
$(CC) -O3 -g3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
se_classes: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS_SE2)
all: se_classes
run: all
.PHONY: clean all run
clean:
rm -f *.o *~ core se_classes
[pack]
files = main.cpp Makefile
/*
* ### WIKI 1 ###
*
* ## Security enhancement example
*
* This example show several basic functionalities of Security Enhancements
*
*/
#define SE_CLASS1
#define SE_CLASS2
// SE_CLASS2 only is unsupported, without SE_CLASS2_ONLY_TRACK
#define SE_CLASS2_ONLY_TRACK
#define SE_CLASS3
#define THROW_ON_ERROR
#define PRINT_STACKTRACE
#include "Memleak_check.hpp"
#include "Vector/vector_dist.hpp"
#include "Decomposition/CartDecomposition.hpp"
#include "Point_test.hpp"
/*
* ### WIKI END ###
*/
int main(int argc, char* argv[])
{
//
// ### WIKI 2 ###
//
// With print_unalloc we can check how much memory has been allocated and which structure
// has been allocated, initially there are not
//
std::cout << "Allocated memory before initializing \n";
print_alloc();
std::cout << "\n";
std::cout << "\n";
std::cout << "\n";
//
// ### WIKI 3 ###
//
// 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
//
openfpm_init(&argc,&argv);
Vcluster<> & v_cl = create_vcluster();
typedef Point<2,float> s;
Box<2,float> box({0.0,0.0},{1.0,1.0});
size_t bc[2]={NON_PERIODIC,NON_PERIODIC};
Ghost<2,float> g(0.01);
//
// ### WIKI 4 ###
//
// Here we ask again for the used memory, as we can see Vcluster and several other structures encapsulated inside
// Vcluster register itself
//
if (v_cl.getProcessUnitID() == 0)
{
std::cout << "Allocated memory after initialization \n";
print_alloc();
std::cout << "\n";
std::cout << "\n";
std::cout << "\n";
}
//
// ### WIKI 5 ###
//
// Here we are creating a distributed vector defined by the following parameters
//
// * Dimensionality of the space where the objects live 2D (1° template parameters)
// * Type of the space, float (2° template parameters)
// * Information stored by each object (3* template parameters), in this case a Point_test store 4 scalars
// 1 vector and an asymmetric tensor of rank 2
// * Strategy used to decompose the space
//
// The Constructor instead require:
//
// * Number of particles 4096 in this case
// * Domain where is defined this structure
//
// The following construct a vector where each processor has 4096 / N_proc (N_proc = number of processor)
// objects with an undefined position in space. This non-space decomposition is also called data-driven
// decomposition
//
{
vector_dist<2,float, Point_test<float> > vd(4096,box,bc,g);
//
// ### WIKI 6 ###
//
// we create a key that for sure overflow the local datastructure, 2048 with this program is started with more than 3
// processors, try and catch are optionals in case you want to recover from a buffer overflow
//
try
{
vect_dist_key_dx vt(5048);
auto it = vd.getPos(vt);
}
catch (std::exception e)
{
std::cerr << "Error notification of overflow \n";
}
}
//
// ### WIKI 7 ###
//
// At this point the vector went out of the scope and if destroyed
// we create, now two of them using new
//
vector_dist<2,float, Point_test<float> > * vd1 = new vector_dist<2,float, Point_test<float>, CartDecomposition<2,float> >(4096,box,bc,g);
vector_dist<2,float, Point_test<float> > * vd2 = new vector_dist<2,float, Point_test<float>, CartDecomposition<2,float> >(4096,box,bc,g);
//
// ### WIKI 8 ###
//
// we can check that these two structure produce an explicit allocation checking
// for registered pointers and structures with print_alloc, in the list we see 2 additional
// entry for distributed vector in yellow, pdata to work use the data structures that register
// itself in magenta, the same things happen for the real memory allocation from devices in
// fully green
//
if (v_cl.getProcessUnitID() == 0)
{
std::cout << "Allocated memory with 2 vectors \n";
print_alloc();
std::cout << "\n";
std::cout << "\n";
std::cout << "\n";
}
//
// ### WIKI 9 ###
//
// we can also ask to the structure to identify their-self in the list
//
std::cout << "Vector id: " << vd1->who() << "\n";
std::cout << "Vector id: " << vd2->who() << "\n";
//
// ### WIKI 10 ###
//
// delete vd1 and print allocated memory, one distributed vector disappear
//
delete vd1;
if (v_cl.getProcessUnitID() == 0)
{
std::cout << "Allocated memory with 1 vector \n";
print_alloc();
std::cout << "\n";
std::cout << "\n";
std::cout << "\n";
}
//
// ### WIKI 11 ###
//
// delete vd2 and print allocated memory, all distributed vector de-register
//
delete vd2;
if (v_cl.getProcessUnitID() == 0)
{
std::cout << "Allocated memory with 1 vector \n";
print_alloc();
std::cout << "\n";
std::cout << "\n";
std::cout << "\n";
}
//
// ### WIKI 12 ###
//
// Try to use a deleted object
//
try
{
vect_dist_key_dx vt(0);
auto it = vd1->getPos(vt);
}
catch (std::exception & e)
{
std::cerr << "Error notification of invalid usage of deleted object \n";
}
//
// ### WIKI 13 ###
//
// Deinitialize the library
//
openfpm_finalize();
}
include ../../example.mk
CC=mpic++
LDIR =
OBJ = main.o
%.o: %.cpp
$(CC) -O0 -g3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
se_classes: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS_SE2)
all: se_classes
run: all
.PHONY: clean all run
clean:
rm -f *.o *~ core se_classes
[pack]
files = main.cpp Makefile
/*
* ### WIKI 1 ###
*
* ## Security enhancement example
*
* This example show how to see where an allocation or corruption happen offline and online.
* Every time an error occur, the library output where the detection happen filename and line,
* in order to debug, there is an online option and an offline option
*
* * online: put a breakpoint on the indicated line with your preferred debugger
* * offline: set ulimit -c unlimited to activate the core dump file and open the core dump with your debugger
*
*/
#define SE_CLASS1
#define SE_CLASS2
// SE_CLASS2 is unsupported if not used in combination with SE_CLASS2_TRACK_ONLY
#define SE_CLASS2_ONLY_TRACK
#define SE_CLASS3
#define PRINT_STACKTRACE
#define THROW_ON_ERROR
#include "Memleak_check.hpp"
#include "Grid/grid_dist_id.hpp"
#include "Decomposition/CartDecomposition.hpp"
#include "Point_test.hpp"
/*
* ### WIKI END ###
*/
int main(int argc, char* argv[])
{
//
// ### WIKI 2 ###
//
// Here we Initialize the library,
// * message_on_allocation set a message to print when one allocation is reached, the filename and line number can be used to set a breakpoint and analyze the stacktrace.
// * throw_on_allocation throw when one allocation is reached, producing the termination of the program and a core dump (if no try catch is set-up)
//
openfpm_init(&argc,&argv);
Vcluster<> & v_cl = create_vcluster();
throw_on_alloc(10);
// message_on_alloc(10);
//
// ### WIKI 3 ###
//
// Create several object needed later, in particular
// * A 3D box that define the domain
// * an array of 3 unsigned integer that define the size of the grid on each dimension
// * A Ghost object that will define the extension of the ghost part for each sub-domain in physical units
Box<3,float> domain({0.0,0.0,0.0},{1.0,1.0,1.0});
size_t sz[3];
sz[0] = 100;
sz[1] = 100;
sz[2] = 100;
// Ghost
Ghost<3,float> g(0.01);
//
// ### WIKI 4 ###
//
// Create a distributed grid in 3D (1° template parameter) defined in R^3 with float precision (2° template parameter)
// using a CartesianDecomposition strategy (3° parameter) (the parameter 1° and 2° inside CartDecomposition must match 1° and 2°
// of grid_dist_id)
//
// Constructor parameters:
//
// * sz: size of the grid on each dimension
// * domain: where the grid is defined
// * g: ghost extension
//
//
grid_dist_id<3, float, aggregate<float[3]>, CartDecomposition<3,float>> * g_dist = new grid_dist_id<3, float, aggregate<float[3]> >(sz,domain,g);
//
// ### WIKI 6 ###
//
// print allocated structures
//
if (v_cl.getProcessUnitID() == 0)
{print_alloc();}
//
// ### WIKI 5 ###
//
// delete g_dist
//
delete g_dist;
//
// ### WIKI 6 ###
//
// On purpose we try to access a deleted object
//
g_dist->getGridInfo();
//
// ### WIKI 13 ###
//
// Deinitialize the library
//
openfpm_finalize();
}
SUBDIRS := $(wildcard */.)
all clean run: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@ $(MAKECMDGOALS)
.PHONY: all clean $(SUBDIRS)
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
########################### Executables
if(CUDA_FOUND)
set(CUDA_SOURCES ../openfpm_devices/src/memory/CudaMemory.cu)
endif()
add_executable(cart_dec CartDecomposition_gen_vtk.cpp ../src/lib/pdata.cpp ${CUDA_SOURCES} ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp)
add_executable(metis_dec Metis_gen_vtk.cpp ../src/lib/pdata.cpp ${CUDA_SOURCES} ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp)
add_executable(dom_box domain_gen_vtk.cpp ../src/lib/pdata.cpp ${CUDA_SOURCES} ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp)
add_executable(vector_dist vector.cpp ${CUDA_SOURCES} ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_devices/src/Memleak_check.cpp)
###########################
include_directories (${CUDA_INCLUDE_DIRS})
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../src/)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../openfpm_devices/src/)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../openfpm_vcluster/src/)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../openfpm_data/src/)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../openfpm_io/src/)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../src/config)
if (PETSC_FOUND)
include_directories (${PETSC_INCLUDES})
endif()
include_directories (${PARMETIS_ROOT}/include)
include_directories (${METIS_ROOT}/include)
include_directories (${Boost_INCLUDE_DIRS})
#include_directories (${HDF5_INCLUDE_DIRS})
include_directories(${HDF5_ROOT}/include)
include_directories (${LIBHILBERT_INCLUDE_DIRS})
target_link_libraries(cart_dec ${Boost_LIBRARIES})
target_link_libraries(cart_dec -L${PARMETIS_ROOT}/lib parmetis)
target_link_libraries(cart_dec -L${METIS_ROOT}/lib metis)
#target_link_libraries(cart_dec -L${HDF5_ROOT}/lib hdf5 hdf5_hl)
target_link_libraries(cart_dec ${HDF5_LIBRARIES})
target_link_libraries(cart_dec -L${LIBHILBERT_LIBRARY_DIRS} ${LIBHILBERT_LIBRARIES})
target_link_libraries(cart_dec ${MPI_C_LIBRARIES})
target_link_libraries(metis_dec ${Boost_LIBRARIES})
target_link_libraries(metis_dec -L${PARMETIS_ROOT}/lib parmetis)
target_link_libraries(metis_dec -L${METIS_ROOT}/lib metis)
#target_link_libraries(metis_dec -L${HDF5_ROOT}/lib hdf5 hdf5_hl)
target_link_libraries(metis_dec ${HDF5_LIBRARIES})
target_link_libraries(metis_dec -L${LIBHILBERT_LIBRARY_DIRS} ${LIBHILBERT_LIBRARIES})
target_link_libraries(metis_dec ${MPI_C_LIBRARIES})
target_link_libraries(dom_box ${Boost_LIBRARIES})
target_link_libraries(dom_box -L${PARMETIS_ROOT}/lib parmetis)
target_link_libraries(dom_box -L${METIS_ROOT}/lib metis)
#target_link_libraries(dom_box -L${HDF5_ROOT}/lib hdf5 hdf5_hl)
target_link_libraries(dom_box ${HDF5_LIBRARIES})
target_link_libraries(dom_box -L${LIBHILBERT_LIBRARY_DIRS} ${LIBHILBERT_LIBRARIES})
target_link_libraries(dom_box ${MPI_C_LIBRARIES})
target_link_libraries(vector_dist ${Boost_LIBRARIES})
target_link_libraries(vector_dist -L${PARMETIS_ROOT}/lib parmetis)
target_link_libraries(vector_dist -L${METIS_ROOT}/lib metis)
#target_link_libraries(vector_dist -L${HDF5_ROOT}/lib hdf5 hdf5_hl)
target_link_libraries(vector_dist ${HDF5_LIBRARIES})
target_link_libraries(vector_dist -L${LIBHILBERT_LIBRARY_DIRS} ${LIBHILBERT_LIBRARIES})
target_link_libraries(vector_dist ${MPI_C_LIBRARIES})
if(PETSC_FOUND)
target_link_libraries(cart_dec ${PETSC_LIBRARIES})
target_link_libraries(metis_dec ${PETSC_LIBRARIES})
target_link_libraries(dom_box ${PETSC_LIBRARIES})
target_link_libraries(vector_dist ${PETSC_LIBRARIES})
endif()
# Request that particles be built with -std=c++11
# As this is a public compile feature anything that links to particles
# will also build with -std=c++11
target_compile_features(cart_dec PUBLIC cxx_std_11)
target_compile_features(metis_dec PUBLIC cxx_std_11)
target_compile_features(dom_box PUBLIC cxx_std_11)
target_compile_features(vector_dist PUBLIC cxx_std_11)
#if(BUILD_TESTING)
# add_executable(particle_test test.cu)
# set_target_properties(particle_test PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
# target_link_libraries(particle_test PRIVATE particles)
# add_test(NAME particles_10k COMMAND particle_test 10000 )
# add_test(NAME particles_256k COMMAND particle_test 256000 )
# if(APPLE)
# We need to add the default path to the driver (libcuda.dylib) as an rpath,
# so that the static cuda runtime can find it at runtime.
# set_property(TARGET particle_test PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
# endif()
#endif()
/*
* CartDecomposition_gen_vtk.hpp
*
* Created on: Aug 28, 2015
* Author: i-bird
*/
#include "Decomposition/CartDecomposition.hpp"
int main(int argc, char ** argv)
{
// Initialize the global VCluster
openfpm_init(&argc,&argv);
// Vcluster
Vcluster<> & vcl = create_vcluster();
//! [Create CartDecomposition vtk gen]
CartDecomposition<2,float> dec(vcl);
// Physical domain
Box<2,float> box({0.0,0.0},{1.0,1.0});
// division on each direction
size_t div[2] = {20,20};
// Define ghost
Ghost<2,float> g(0.01);
// boundary conditions
size_t bc[2] = {PERIODIC,PERIODIC};
// Decompose and write the decomposed graph
dec.setParameters(div,box,bc,g);
dec.decompose();
// create a ghost border
dec.calculateGhostBoxes();
// Write the decomposition
dec.write("CartDecomposition/out_");
//! [Create CartDecomposition]
// deinitialize the library
openfpm_finalize();
}
#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
# create a new 'Legacy VTK Reader'
dom_boxvtk = LegacyVTKReader(FileNames=['CartDecomposition/dom_box.vtk'])
# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
renderView1.ViewSize = [1000, 500]
renderView1.CameraPosition = [0.5, 0.5, 2.7320508075688776]
renderView1.CameraFocalPoint = [0.5, 0.5, 0.0]
renderView1.CameraParallelScale = 0.5843857695756589
# show data in view
dom_boxvtkDisplay = Show(dom_boxvtk, renderView1)
WriteImage("generated/domain.jpg")
# change representation type
dom_boxvtkDisplay.SetRepresentationType('Surface With Edges')
WriteImage("generated/domain_decomposed.jpg")
# create a new 'Legacy VTK Reader'
vtk_partitionvtk = LegacyVTKReader(FileNames=['Metis/vtk_partition.vtk'])
idLUT = GetColorTransferFunction('id')
idLUT.RGBPoints = [0.0, 0.231373, 0.298039, 0.752941, 1.5, 0.865003, 0.865003, 0.865003, 3.0, 0.705882, 0.0156863, 0.14902]
idLUT.ScalarRangeInitialized = 1.0
# show data in view
vtk_partitionvtkDisplay = Show(vtk_partitionvtk, renderView1)
# trace defaults for the display properties.
vtk_partitionvtkDisplay.ColorArrayName = ['POINTS', 'id']
vtk_partitionvtkDisplay.LookupTable = idLUT
#changing interaction mode based on data extents
renderView1.CameraPosition = [0.5, 0.5, 2.7320508075688776]
renderView1.CameraFocalPoint = [0.5, 0.5, 0.0]
renderView1.CameraParallelScale = 0.5843857695756589
# show color bar/color legend
vtk_partitionvtkDisplay.SetScalarBarVisibility(renderView1, False)
# create a new 'Transform'
transform1 = Transform(Input=vtk_partitionvtk)
transform1.Transform = 'Transform'
# Properties modified on transform1.Transform
transform1.Transform.Translate = [0.025, 0.025, 0.0]
transform1.Transform.Scale = [1.0, 1.0, 0.0]
# show data in view
transform1Display = Show(transform1, renderView1)
# hide data in view
Hide(vtk_partitionvtk, renderView1)
# set scalar coloring
ColorBy(transform1Display, ('POINTS', 'computation'))
# change representation type
transform1Display.SetRepresentationType('Points')
# Properties modified on transform1Display
transform1Display.PointSize = 5.0
# set active source
SetActiveSource(vtk_partitionvtk)
# write decomposed
WriteImage("generated/domain_graph.jpg")
# set scalar coloring
ColorBy(transform1Display, ('POINTS', 'id'))
# change representation type
dom_boxvtkDisplay.SetRepresentationType('Surface')
# write decomposed
WriteImage("generated/domain_graph_decomposed.jpg")
# create a new 'Legacy VTK Reader'
out_subdomains_0vtk = LegacyVTKReader(FileNames=['CartDecomposition/out_subdomains_0.vtk'])
# create a new 'Legacy VTK Reader'
out_subdomains_1vtk = LegacyVTKReader(FileNames=['CartDecomposition/out_subdomains_1.vtk'])
# create a new 'Legacy VTK Reader'
out_subdomains_2vtk = LegacyVTKReader(FileNames=['CartDecomposition/out_subdomains_2.vtk'])
# create a new 'Legacy VTK Reader'
out_subdomains_3vtk = LegacyVTKReader(FileNames=['CartDecomposition/out_subdomains_3.vtk'])
# show data in view
out_subdomains_3vtkDisplay = Show(out_subdomains_3vtk, renderView1)
# show data in view
out_subdomains_1vtkDisplay = Show(out_subdomains_1vtk, renderView1)
# show data in view
out_subdomains_2vtkDisplay = Show(out_subdomains_2vtk, renderView1)
# show data in view
out_subdomains_0vtkDisplay = Show(out_subdomains_0vtk, renderView1)
# turn off scalar coloring
ColorBy(out_subdomains_0vtkDisplay, None)
# turn off scalar coloring
ColorBy(out_subdomains_1vtkDisplay, None)
# turn off scalar coloring
ColorBy(out_subdomains_2vtkDisplay, None)
# turn off scalar coloring
ColorBy(out_subdomains_3vtkDisplay, None)
# change representation type
out_subdomains_3vtkDisplay.SetRepresentationType('Surface With Edges')
# change representation type
out_subdomains_2vtkDisplay.SetRepresentationType('Surface With Edges')
# change representation type
out_subdomains_1vtkDisplay.SetRepresentationType('Surface With Edges')
# change representation type
out_subdomains_0vtkDisplay.SetRepresentationType('Surface With Edges')
# change solid color
out_subdomains_0vtkDisplay.DiffuseColor = [1.0, 0.3333333333333333, 0.0]
# change solid color
out_subdomains_1vtkDisplay.DiffuseColor = [0.6666666666666666, 1.0, 0.0]
# change solid color
out_subdomains_2vtkDisplay.DiffuseColor = [0.0, 0.3333333333333333, 1.0]
# change solid color
out_subdomains_3vtkDisplay.DiffuseColor = [1.0, 1.0, 0.0]
# Properties modified on out_subdomains_0vtkDisplay
out_subdomains_0vtkDisplay.LineWidth = 4.0
# change representation type
out_subdomains_0vtkDisplay.SetRepresentationType('Surface With Edges')
# Properties modified on out_subdomains_1vtkDisplay
out_subdomains_1vtkDisplay.LineWidth = 4.0
# change representation type
out_subdomains_1vtkDisplay.SetRepresentationType('Surface With Edges')
# Properties modified on out_subdomains_2vtkDisplay
out_subdomains_2vtkDisplay.LineWidth = 4.0
# change representation type
out_subdomains_2vtkDisplay.SetRepresentationType('Surface With Edges')
# Properties modified on out_subdomains_3vtkDisplay
out_subdomains_3vtkDisplay.LineWidth = 4.0
# change representation type
out_subdomains_3vtkDisplay.SetRepresentationType('Surface With Edges')
# hide data in view
Hide(dom_boxvtk, renderView1)
WriteImage("generated/domain_subdomain_decomposed.jpg")
# hide data in view
Hide(transform1, renderView1)
WriteImage("generated/domain_subdomain_decomposed_wg.jpg")
#Destroy everything
Delete(transform1)
del transform1
Delete(out_subdomains_3vtk)
del out_subdomains_3vtk
Delete(out_subdomains_2vtk)
del out_subdomains_2vtk
Delete(out_subdomains_1vtk)
del out_subdomains_1vtk
Delete(out_subdomains_0vtk)
del out_subdomains_0vtk
Delete(dom_boxvtk)
del dom_boxvtk
Delete(vtk_partitionvtk)
del vtk_partitionvtk
LINKLIBS = $(HDF5_LDFLAGS) $(HDF5_LIBS) $(OPENMP_LDFLAGS) $(LIBHILBERT_LIB) $(PETSC_LIB) $(SUITESPARSE_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) $(METIS_LIB) $(PARMETIS_LIB) $(PTHREAD_LIBS) $(OPT_LIBS) $(BOOST_LDFLAGS) $(BOOST_IOSTREAMS_LIB) $(CUDA_LIBS)
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/CudaMemory.cu ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
cart_dec_CXXFLAGS = -Wno-unknown-pragmas $(OPENMP_CFLAGS) $(AM_CXXFLAGS) $(PETSC_INCLUDE) $(METIS_INCLUDE) $(PARMETIS_INCLUDE) $(CUDA_CFLAGS) $(INCLUDES_PATH) $(BOOST_CPPFLAGS) -I../src -Wno-unused-function -Wno-unused-local-typedefs
cart_dec_CFLAGS = $(OPENMP_CFLAGS) $(CUDA_CFLAGS)
cart_dec_LDADD = $(LINKLIBS) -lparmetis -lmetis
metis_dec_SOURCES = Metis_gen_vtk.cpp ../src/lib/pdata.cpp ../openfpm_devices/src/memory/CudaMemory.cu ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
metis_dec_CXXFLAGS = -Wno-unknown-pragmas $(OPENMP_CFLAGS) $(AM_CXXFLAGS) $(PETSC_INCLUDE) $(METIS_INCLUDE) $(CUDA_CFLAGS) $(INCLUDES_PATH) $(BOOST_CPPFLAGS) -I../src -Wno-unused-function -Wno-unused-local-typedefs
metis_dec_CFLAGS = $(OPENMP_CFLAGS) $(CUDA_CFLAGS)
metis_dec_LDADD = $(LINKLIBS) -lmetis
dom_box_SOURCES = domain_gen_vtk.cpp ../src/lib/pdata.cpp ../openfpm_devices/src/memory/CudaMemory.cu ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
dom_box_CXXFLAGS = -Wno-unknown-pragmas $(OPENMP_CFLAGS) $(AM_CXXFLAGS) $(PETSC_INCLUDE) $(METIS_INCLUDE) $(CUDA_CFLAGS) $(INCLUDES_PATH) $(BOOST_CPPFLAGS) -I../src -Wno-unused-function -Wno-unused-local-typedefs
dom_box_CFLAGS = $(OPENMP_CFLAGS) $(CUDA_CFLAGS)
dom_box_LDADD = $(LINKLIBS)
vector_dist_SOURCES = vector.cpp ../openfpm_devices/src/memory/CudaMemory.cu ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_devices/src/Memleak_check.cpp
vector_dist_CXXFLAGS = -Wno-unknown-pragmas $(OPENMP_CFLAGS) $(AM_CXXFLAGS) $(LIBHILBERT_INCLUDE) $(PETSC_INCLUDE) $(PARMETIS_INCLUDE) $(METIS_INCLUDE) $(CUDA_CFLAGS) $(INCLUDES_PATH) $(HDF5_CPPFLAGS) $(BOOST_CPPFLAGS) -I../src -Wno-unused-function -Wno-unused-local-typedefs
vector_dist_CFLAGS = $(OPENMP_CFLAGS) $(CUDA_CFLAGS)
vector_dist_LDADD = $(LINKLIBS) -lparmetis -lmetis
.cu.o :
$(NVCC) $(NVCCFLAGS) -o $@ -c $<
#### Rule to make images
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 && \
pvbatch mooving_particles.py && \
pvbatch mooving_particles_prc.py && \
pvbatch vector_scal_vect.py && \
pvbatch vector_particles.py && \
pvbatch particles_maps.py && \
pvbatch vector_ghost.py && \
dot -Tsvg openfpm.dot -o generated/openfpm.svg && \
avconv -i generated/particles_mooving.ogv -f mp4 generated/particles_mooving.mp4 && \
avconv -i generated/particles_mooving_prc.ogv -f mp4 generated/particles_mooving_prc.mp4 && \
avconv -i generated/particles_mooving.ogv -f webm generated/particles_mooving.webm && \
avconv -i generated/particles_mooving_prc.ogv -f webm generated/particles_mooving_prc.webm
/*
* Metis_gen_vtk.hpp
*
* Created on: Aug 29, 2015
* Author: i-bird
*/
#ifndef VTK_METIS_GEN_VTK_CPP_
#define VTK_METIS_GEN_VTK_CPP_
#include <iostream>
#include "Graph/CartesianGraphFactory.hpp"
#include "Graph/map_graph.hpp"
#include "Decomposition/Distribution/metis_util.hpp"
#include "SubdomainGraphNodes.hpp"
int main(int argc, char ** argv)
{
CartesianGraphFactory<2,Graph_CSR<nm_v<2>,nm_e>> g_factory;
// Cartesian grid
size_t sz[2] = {20,20};
// Box
Box<2,float> box({0.0,0.0},{1.0,1.0});
const size_t bc[] = {NON_PERIODIC,NON_PERIODIC};
// Graph to decompose
Graph_CSR<nm_v<2>,nm_e> g = g_factory.construct<nm_e::communication,NO_VERTEX_ID,float,1,0,1>(sz,box,bc);
// Convert the graph to metis
Metis<Graph_CSR<nm_v<2>,nm_e>> met(g,4);
// decompose
met.decompose<nm_v_id>();
// Write the decomposition
VTKWriter<Graph_CSR<nm_v<2>,nm_e>,VTK_GRAPH> vtk(g);
vtk.write("Metis/vtk_partition.vtk");
}
#endif /* VTK_METIS_GEN_VTK_CPP_ */
/*
* domain_vtk_gen.cpp
*
* Created on: Aug 30, 2015
* Author: Pietro Incardona
*/
#include <iostream>
#include "Space/Shape/Box.hpp"
#include "Vector/map_vector.hpp"
#include "VTKWriter/VTKWriter.hpp"
int main(int argc, char ** argv)
{
//! [Output a vector of boxes]
// Physical domain
Box<2,float> box({0.0,0.0},{1.0,1.0});
// Cell
Box<2,float> cell = box;
// division on each direction
size_t div[2] = {20,20};
Point<2,float> p_div({20.0,20.0});
cell /= p_div;
// create 20 cell on each direction
openfpm::vector<Box<2,float>> v_box;
for (size_t i = 0; i <= div[0] ; i++)
{
for (size_t j = 0 ; j <= div[1] ; j++)
{
Point<2,float> p({(float)i,(float)j});
Box<2,float> box = cell * p;
v_box.add(box);
}
}
// write the vector of boxes
VTKWriter<openfpm::vector<Box<2,float>>,VECTOR_BOX> vtk_box1;
vtk_box1.add(v_box);
vtk_box1.write("CartDecomposition/dom_box.vtk");
//! [Output a vector of boxes]
}
#### 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_move0_ = CSVReader(FileName=['Vector/vector_move_0_0.csv', 'Vector/vector_move_0_1.csv', 'Vector/vector_move_0_2.csv', 'Vector/vector_move_0_3.csv', 'Vector/vector_move_0_4.csv', 'Vector/vector_move_0_5.csv', 'Vector/vector_move_0_6.csv', 'Vector/vector_move_0_7.csv', 'Vector/vector_move_0_8.csv', 'Vector/vector_move_0_9.csv', 'Vector/vector_move_0_10.csv', 'Vector/vector_move_0_11.csv', 'Vector/vector_move_0_12.csv', 'Vector/vector_move_0_13.csv', 'Vector/vector_move_0_14.csv', 'Vector/vector_move_0_15.csv', 'Vector/vector_move_0_16.csv', 'Vector/vector_move_0_17.csv', 'Vector/vector_move_0_18.csv', 'Vector/vector_move_0_19.csv', 'Vector/vector_move_0_20.csv', 'Vector/vector_move_0_21.csv', 'Vector/vector_move_0_22.csv', 'Vector/vector_move_0_23.csv', 'Vector/vector_move_0_24.csv', 'Vector/vector_move_0_25.csv', 'Vector/vector_move_0_26.csv', 'Vector/vector_move_0_27.csv', 'Vector/vector_move_0_28.csv', 'Vector/vector_move_0_29.csv', 'Vector/vector_move_0_30.csv', 'Vector/vector_move_0_31.csv', 'Vector/vector_move_0_32.csv', 'Vector/vector_move_0_33.csv', 'Vector/vector_move_0_34.csv', 'Vector/vector_move_0_35.csv', 'Vector/vector_move_0_36.csv', 'Vector/vector_move_0_37.csv', 'Vector/vector_move_0_38.csv', 'Vector/vector_move_0_39.csv', 'Vector/vector_move_0_40.csv', 'Vector/vector_move_0_41.csv', 'Vector/vector_move_0_42.csv', 'Vector/vector_move_0_43.csv', 'Vector/vector_move_0_44.csv', 'Vector/vector_move_0_45.csv', 'Vector/vector_move_0_46.csv', 'Vector/vector_move_0_47.csv', 'Vector/vector_move_0_48.csv', 'Vector/vector_move_0_49.csv', 'Vector/vector_move_0_50.csv', 'Vector/vector_move_0_51.csv', 'Vector/vector_move_0_52.csv', 'Vector/vector_move_0_53.csv', 'Vector/vector_move_0_54.csv', 'Vector/vector_move_0_55.csv', 'Vector/vector_move_0_56.csv', 'Vector/vector_move_0_57.csv', 'Vector/vector_move_0_58.csv', 'Vector/vector_move_0_59.csv', 'Vector/vector_move_0_60.csv', 'Vector/vector_move_0_61.csv', 'Vector/vector_move_0_62.csv', 'Vector/vector_move_0_63.csv', 'Vector/vector_move_0_64.csv', 'Vector/vector_move_0_65.csv', 'Vector/vector_move_0_66.csv', 'Vector/vector_move_0_67.csv', 'Vector/vector_move_0_68.csv', 'Vector/vector_move_0_69.csv', 'Vector/vector_move_0_70.csv', 'Vector/vector_move_0_71.csv', 'Vector/vector_move_0_72.csv', 'Vector/vector_move_0_73.csv', 'Vector/vector_move_0_74.csv', 'Vector/vector_move_0_75.csv', 'Vector/vector_move_0_76.csv', 'Vector/vector_move_0_77.csv', 'Vector/vector_move_0_78.csv', 'Vector/vector_move_0_79.csv', 'Vector/vector_move_0_80.csv', 'Vector/vector_move_0_81.csv', 'Vector/vector_move_0_82.csv', 'Vector/vector_move_0_83.csv', 'Vector/vector_move_0_84.csv', 'Vector/vector_move_0_85.csv', 'Vector/vector_move_0_86.csv', 'Vector/vector_move_0_87.csv', 'Vector/vector_move_0_88.csv', 'Vector/vector_move_0_89.csv', 'Vector/vector_move_0_90.csv', 'Vector/vector_move_0_91.csv', 'Vector/vector_move_0_92.csv', 'Vector/vector_move_0_93.csv', 'Vector/vector_move_0_94.csv', 'Vector/vector_move_0_95.csv', 'Vector/vector_move_0_96.csv', 'Vector/vector_move_0_97.csv', 'Vector/vector_move_0_98.csv', 'Vector/vector_move_0_99.csv'])
# get animation scene
animationScene1 = GetAnimationScene()
# update animation scene based on data timesteps
animationScene1.UpdateAnimationUsingDataTimeSteps()
# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# uncomment following to set a specific view size
# renderView1.ViewSize = [1020, 495]
# get layout
viewLayout1 = GetLayout()
# set active view
SetActiveView(renderView1)
# create a new 'Table To Points'
tableToPoints1 = TableToPoints(Input=vector_move0_)
# Properties modified on tableToPoints1
tableToPoints1.XColumn = 'x[0]'
tableToPoints1.YColumn = 'x[1]'
tableToPoints1.a2DPoints = 1
# show data in view
tableToPoints1Display = Show(tableToPoints1, renderView1)
# reset view to fit data
renderView1.ResetCamera()
#changing interaction mode based on data extents
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.500257785, 0.1870064525, 10000.0]
renderView1.CameraFocalPoint = [0.500257785, 0.1870064525, 0.0]
# create a new 'CSV Reader'
vector_move1_ = CSVReader(FileName=['Vector/vector_move_1_0.csv', 'Vector/vector_move_1_1.csv', 'Vector/vector_move_1_2.csv', 'Vector/vector_move_1_3.csv', 'Vector/vector_move_1_4.csv', 'Vector/vector_move_1_5.csv', 'Vector/vector_move_1_6.csv', 'Vector/vector_move_1_7.csv', 'Vector/vector_move_1_8.csv', 'Vector/vector_move_1_9.csv', 'Vector/vector_move_1_10.csv', 'Vector/vector_move_1_11.csv', 'Vector/vector_move_1_12.csv', 'Vector/vector_move_1_13.csv', 'Vector/vector_move_1_14.csv', 'Vector/vector_move_1_15.csv', 'Vector/vector_move_1_16.csv', 'Vector/vector_move_1_17.csv', 'Vector/vector_move_1_18.csv', 'Vector/vector_move_1_19.csv', 'Vector/vector_move_1_20.csv', 'Vector/vector_move_1_21.csv', 'Vector/vector_move_1_22.csv', 'Vector/vector_move_1_23.csv', 'Vector/vector_move_1_24.csv', 'Vector/vector_move_1_25.csv', 'Vector/vector_move_1_26.csv', 'Vector/vector_move_1_27.csv', 'Vector/vector_move_1_28.csv', 'Vector/vector_move_1_29.csv', 'Vector/vector_move_1_30.csv', 'Vector/vector_move_1_31.csv', 'Vector/vector_move_1_32.csv', 'Vector/vector_move_1_33.csv', 'Vector/vector_move_1_34.csv', 'Vector/vector_move_1_35.csv', 'Vector/vector_move_1_36.csv', 'Vector/vector_move_1_37.csv', 'Vector/vector_move_1_38.csv', 'Vector/vector_move_1_39.csv', 'Vector/vector_move_1_40.csv', 'Vector/vector_move_1_41.csv', 'Vector/vector_move_1_42.csv', 'Vector/vector_move_1_43.csv', 'Vector/vector_move_1_44.csv', 'Vector/vector_move_1_45.csv', 'Vector/vector_move_1_46.csv', 'Vector/vector_move_1_47.csv', 'Vector/vector_move_1_48.csv', 'Vector/vector_move_1_49.csv', 'Vector/vector_move_1_50.csv', 'Vector/vector_move_1_51.csv', 'Vector/vector_move_1_52.csv', 'Vector/vector_move_1_53.csv', 'Vector/vector_move_1_54.csv', 'Vector/vector_move_1_55.csv', 'Vector/vector_move_1_56.csv', 'Vector/vector_move_1_57.csv', 'Vector/vector_move_1_58.csv', 'Vector/vector_move_1_59.csv', 'Vector/vector_move_1_60.csv', 'Vector/vector_move_1_61.csv', 'Vector/vector_move_1_62.csv', 'Vector/vector_move_1_63.csv', 'Vector/vector_move_1_64.csv', 'Vector/vector_move_1_65.csv', 'Vector/vector_move_1_66.csv', 'Vector/vector_move_1_67.csv', 'Vector/vector_move_1_68.csv', 'Vector/vector_move_1_69.csv', 'Vector/vector_move_1_70.csv', 'Vector/vector_move_1_71.csv', 'Vector/vector_move_1_72.csv', 'Vector/vector_move_1_73.csv', 'Vector/vector_move_1_74.csv', 'Vector/vector_move_1_75.csv', 'Vector/vector_move_1_76.csv', 'Vector/vector_move_1_77.csv', 'Vector/vector_move_1_78.csv', 'Vector/vector_move_1_79.csv', 'Vector/vector_move_1_80.csv', 'Vector/vector_move_1_81.csv', 'Vector/vector_move_1_82.csv', 'Vector/vector_move_1_83.csv', 'Vector/vector_move_1_84.csv', 'Vector/vector_move_1_85.csv', 'Vector/vector_move_1_86.csv', 'Vector/vector_move_1_87.csv', 'Vector/vector_move_1_88.csv', 'Vector/vector_move_1_89.csv', 'Vector/vector_move_1_90.csv', 'Vector/vector_move_1_91.csv', 'Vector/vector_move_1_92.csv', 'Vector/vector_move_1_93.csv', 'Vector/vector_move_1_94.csv', 'Vector/vector_move_1_95.csv', 'Vector/vector_move_1_96.csv', 'Vector/vector_move_1_97.csv', 'Vector/vector_move_1_98.csv', 'Vector/vector_move_1_99.csv'])
# set active view
SetActiveView(renderView1)
# create a new 'Table To Points'
tableToPoints2 = TableToPoints(Input=vector_move1_)
# Properties modified on tableToPoints2
tableToPoints2.XColumn = 'x[0]'
tableToPoints2.YColumn = 'x[1]'
tableToPoints2.a2DPoints = 1
# show data in view
tableToPoints2Display = Show(tableToPoints2, renderView1)
# reset view to fit data
renderView1.ResetCamera()
# reset view to fit data
renderView1.ResetCamera()
# set active source
SetActiveSource(tableToPoints1)
# change representation type
tableToPoints1Display.SetRepresentationType('Points')
# set active source
SetActiveSource(tableToPoints2)
# change representation type
tableToPoints2Display.SetRepresentationType('Points')
# create a new 'CSV Reader'
vector_move2_ = CSVReader(FileName=['Vector/vector_move_2_0.csv', 'Vector/vector_move_2_1.csv', 'Vector/vector_move_2_2.csv', 'Vector/vector_move_2_3.csv', 'Vector/vector_move_2_4.csv', 'Vector/vector_move_2_5.csv', 'Vector/vector_move_2_6.csv', 'Vector/vector_move_2_7.csv', 'Vector/vector_move_2_8.csv', 'Vector/vector_move_2_9.csv', 'Vector/vector_move_2_10.csv', 'Vector/vector_move_2_11.csv', 'Vector/vector_move_2_12.csv', 'Vector/vector_move_2_13.csv', 'Vector/vector_move_2_14.csv', 'Vector/vector_move_2_15.csv', 'Vector/vector_move_2_16.csv', 'Vector/vector_move_2_17.csv', 'Vector/vector_move_2_18.csv', 'Vector/vector_move_2_19.csv', 'Vector/vector_move_2_20.csv', 'Vector/vector_move_2_21.csv', 'Vector/vector_move_2_22.csv', 'Vector/vector_move_2_23.csv', 'Vector/vector_move_2_24.csv', 'Vector/vector_move_2_25.csv', 'Vector/vector_move_2_26.csv', 'Vector/vector_move_2_27.csv', 'Vector/vector_move_2_28.csv', 'Vector/vector_move_2_29.csv', 'Vector/vector_move_2_30.csv', 'Vector/vector_move_2_31.csv', 'Vector/vector_move_2_32.csv', 'Vector/vector_move_2_33.csv', 'Vector/vector_move_2_34.csv', 'Vector/vector_move_2_35.csv', 'Vector/vector_move_2_36.csv', 'Vector/vector_move_2_37.csv', 'Vector/vector_move_2_38.csv', 'Vector/vector_move_2_39.csv', 'Vector/vector_move_2_40.csv', 'Vector/vector_move_2_41.csv', 'Vector/vector_move_2_42.csv', 'Vector/vector_move_2_43.csv', 'Vector/vector_move_2_44.csv', 'Vector/vector_move_2_45.csv', 'Vector/vector_move_2_46.csv', 'Vector/vector_move_2_47.csv', 'Vector/vector_move_2_48.csv', 'Vector/vector_move_2_49.csv', 'Vector/vector_move_2_50.csv', 'Vector/vector_move_2_51.csv', 'Vector/vector_move_2_52.csv', 'Vector/vector_move_2_53.csv', 'Vector/vector_move_2_54.csv', 'Vector/vector_move_2_55.csv', 'Vector/vector_move_2_56.csv', 'Vector/vector_move_2_57.csv', 'Vector/vector_move_2_58.csv', 'Vector/vector_move_2_59.csv', 'Vector/vector_move_2_60.csv', 'Vector/vector_move_2_61.csv', 'Vector/vector_move_2_62.csv', 'Vector/vector_move_2_63.csv', 'Vector/vector_move_2_64.csv', 'Vector/vector_move_2_65.csv', 'Vector/vector_move_2_66.csv', 'Vector/vector_move_2_67.csv', 'Vector/vector_move_2_68.csv', 'Vector/vector_move_2_69.csv', 'Vector/vector_move_2_70.csv', 'Vector/vector_move_2_71.csv', 'Vector/vector_move_2_72.csv', 'Vector/vector_move_2_73.csv', 'Vector/vector_move_2_74.csv', 'Vector/vector_move_2_75.csv', 'Vector/vector_move_2_76.csv', 'Vector/vector_move_2_77.csv', 'Vector/vector_move_2_78.csv', 'Vector/vector_move_2_79.csv', 'Vector/vector_move_2_80.csv', 'Vector/vector_move_2_81.csv', 'Vector/vector_move_2_82.csv', 'Vector/vector_move_2_83.csv', 'Vector/vector_move_2_84.csv', 'Vector/vector_move_2_85.csv', 'Vector/vector_move_2_86.csv', 'Vector/vector_move_2_87.csv', 'Vector/vector_move_2_88.csv', 'Vector/vector_move_2_89.csv', 'Vector/vector_move_2_90.csv', 'Vector/vector_move_2_91.csv', 'Vector/vector_move_2_92.csv', 'Vector/vector_move_2_93.csv', 'Vector/vector_move_2_94.csv', 'Vector/vector_move_2_95.csv', 'Vector/vector_move_2_96.csv', 'Vector/vector_move_2_97.csv', 'Vector/vector_move_2_98.csv', 'Vector/vector_move_2_99.csv'])
# set active view
SetActiveView(renderView1)
# create a new 'Table To Points'
tableToPoints3 = TableToPoints(Input=vector_move2_)
# Properties modified on tableToPoints3
tableToPoints3.XColumn = 'x[0]'
tableToPoints3.YColumn = 'x[1]'
tableToPoints3.a2DPoints = 1
# show data in view
tableToPoints3Display = Show(tableToPoints3, renderView1)
# current camera placement for renderView1
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.500684285, 0.49876095249999997, 2.7250155738876063]
renderView1.CameraFocalPoint = [0.500684285, 0.49876095249999997, 0.0]
renderView1.CameraParallelScale = 0.7052859287230878
# save animation images/movie
WriteAnimation('generated/particles_mooving.ogv', Magnification=1, FrameRate=25.0, Compression=True)
#### 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_move_0_ = CSVReader(FileName=['Vector/vector_move_0_0.csv', 'Vector/vector_move_0_1.csv', 'Vector/vector_move_0_2.csv', 'Vector/vector_move_0_3.csv', 'Vector/vector_move_0_4.csv', 'Vector/vector_move_0_5.csv', 'Vector/vector_move_0_6.csv', 'Vector/vector_move_0_7.csv', 'Vector/vector_move_0_8.csv', 'Vector/vector_move_0_9.csv', 'Vector/vector_move_0_10.csv', 'Vector/vector_move_0_11.csv', 'Vector/vector_move_0_12.csv', 'Vector/vector_move_0_13.csv', 'Vector/vector_move_0_14.csv', 'Vector/vector_move_0_15.csv', 'Vector/vector_move_0_16.csv', 'Vector/vector_move_0_17.csv', 'Vector/vector_move_0_18.csv', 'Vector/vector_move_0_19.csv', 'Vector/vector_move_0_20.csv', 'Vector/vector_move_0_21.csv', 'Vector/vector_move_0_22.csv', 'Vector/vector_move_0_23.csv', 'Vector/vector_move_0_24.csv', 'Vector/vector_move_0_25.csv', 'Vector/vector_move_0_26.csv', 'Vector/vector_move_0_27.csv', 'Vector/vector_move_0_28.csv', 'Vector/vector_move_0_29.csv', 'Vector/vector_move_0_30.csv', 'Vector/vector_move_0_31.csv', 'Vector/vector_move_0_32.csv', 'Vector/vector_move_0_33.csv', 'Vector/vector_move_0_34.csv', 'Vector/vector_move_0_35.csv', 'Vector/vector_move_0_36.csv', 'Vector/vector_move_0_37.csv', 'Vector/vector_move_0_38.csv', 'Vector/vector_move_0_39.csv', 'Vector/vector_move_0_40.csv', 'Vector/vector_move_0_41.csv', 'Vector/vector_move_0_42.csv', 'Vector/vector_move_0_43.csv', 'Vector/vector_move_0_44.csv', 'Vector/vector_move_0_45.csv', 'Vector/vector_move_0_46.csv', 'Vector/vector_move_0_47.csv', 'Vector/vector_move_0_48.csv', 'Vector/vector_move_0_49.csv', 'Vector/vector_move_0_50.csv', 'Vector/vector_move_0_51.csv', 'Vector/vector_move_0_52.csv', 'Vector/vector_move_0_53.csv', 'Vector/vector_move_0_54.csv', 'Vector/vector_move_0_55.csv', 'Vector/vector_move_0_56.csv', 'Vector/vector_move_0_57.csv', 'Vector/vector_move_0_58.csv', 'Vector/vector_move_0_59.csv', 'Vector/vector_move_0_60.csv', 'Vector/vector_move_0_61.csv', 'Vector/vector_move_0_62.csv', 'Vector/vector_move_0_63.csv', 'Vector/vector_move_0_64.csv', 'Vector/vector_move_0_65.csv', 'Vector/vector_move_0_66.csv', 'Vector/vector_move_0_67.csv', 'Vector/vector_move_0_68.csv', 'Vector/vector_move_0_69.csv', 'Vector/vector_move_0_70.csv', 'Vector/vector_move_0_71.csv', 'Vector/vector_move_0_72.csv', 'Vector/vector_move_0_73.csv', 'Vector/vector_move_0_74.csv', 'Vector/vector_move_0_75.csv', 'Vector/vector_move_0_76.csv', 'Vector/vector_move_0_77.csv', 'Vector/vector_move_0_78.csv', 'Vector/vector_move_0_79.csv', 'Vector/vector_move_0_80.csv', 'Vector/vector_move_0_81.csv', 'Vector/vector_move_0_82.csv', 'Vector/vector_move_0_83.csv', 'Vector/vector_move_0_84.csv', 'Vector/vector_move_0_85.csv', 'Vector/vector_move_0_86.csv', 'Vector/vector_move_0_87.csv', 'Vector/vector_move_0_88.csv', 'Vector/vector_move_0_89.csv', 'Vector/vector_move_0_90.csv', 'Vector/vector_move_0_91.csv', 'Vector/vector_move_0_92.csv', 'Vector/vector_move_0_93.csv', 'Vector/vector_move_0_94.csv', 'Vector/vector_move_0_95.csv', 'Vector/vector_move_0_96.csv', 'Vector/vector_move_0_97.csv', 'Vector/vector_move_0_98.csv', 'Vector/vector_move_0_99.csv'])
# get animation scene
animationScene1 = GetAnimationScene()
# update animation scene based on data timesteps
animationScene1.UpdateAnimationUsingDataTimeSteps()
# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# uncomment following to set a specific view size
# renderView1.ViewSize = [1020, 495]
# get layout
viewLayout1 = GetLayout()
# set active view
SetActiveView(renderView1)
# create a new 'Table To Points'
tableToPoints1 = TableToPoints(Input=vector_move_0_)
# Properties modified on tableToPoints1
tableToPoints1.XColumn = 'x[0]'
tableToPoints1.YColumn = 'x[1]'
tableToPoints1.a2DPoints = 1
# show data in view
tableToPoints1Display = Show(tableToPoints1, renderView1)
tableToPoints1Display.AmbientColor = [1.0, 1.0, 1.0]
# reset view to fit data
renderView1.ResetCamera()
#changing interaction mode based on data extents
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.500257785, 0.1870064525, 10000.0]
renderView1.CameraFocalPoint = [0.500257785, 0.1870064525, 0.0]
# create a new 'CSV Reader'
vector_move_1_ = CSVReader(FileName=['Vector/vector_move_1_0.csv', 'Vector/vector_move_1_1.csv', 'Vector/vector_move_1_2.csv', 'Vector/vector_move_1_3.csv', 'Vector/vector_move_1_4.csv', 'Vector/vector_move_1_5.csv', 'Vector/vector_move_1_6.csv', 'Vector/vector_move_1_7.csv', 'Vector/vector_move_1_8.csv', 'Vector/vector_move_1_9.csv', 'Vector/vector_move_1_10.csv', 'Vector/vector_move_1_11.csv', 'Vector/vector_move_1_12.csv', 'Vector/vector_move_1_13.csv', 'Vector/vector_move_1_14.csv', 'Vector/vector_move_1_15.csv', 'Vector/vector_move_1_16.csv', 'Vector/vector_move_1_17.csv', 'Vector/vector_move_1_18.csv', 'Vector/vector_move_1_19.csv', 'Vector/vector_move_1_20.csv', 'Vector/vector_move_1_21.csv', 'Vector/vector_move_1_22.csv', 'Vector/vector_move_1_23.csv', 'Vector/vector_move_1_24.csv', 'Vector/vector_move_1_25.csv', 'Vector/vector_move_1_26.csv', 'Vector/vector_move_1_27.csv', 'Vector/vector_move_1_28.csv', 'Vector/vector_move_1_29.csv', 'Vector/vector_move_1_30.csv', 'Vector/vector_move_1_31.csv', 'Vector/vector_move_1_32.csv', 'Vector/vector_move_1_33.csv', 'Vector/vector_move_1_34.csv', 'Vector/vector_move_1_35.csv', 'Vector/vector_move_1_36.csv', 'Vector/vector_move_1_37.csv', 'Vector/vector_move_1_38.csv', 'Vector/vector_move_1_39.csv', 'Vector/vector_move_1_40.csv', 'Vector/vector_move_1_41.csv', 'Vector/vector_move_1_42.csv', 'Vector/vector_move_1_43.csv', 'Vector/vector_move_1_44.csv', 'Vector/vector_move_1_45.csv', 'Vector/vector_move_1_46.csv', 'Vector/vector_move_1_47.csv', 'Vector/vector_move_1_48.csv', 'Vector/vector_move_1_49.csv', 'Vector/vector_move_1_50.csv', 'Vector/vector_move_1_51.csv', 'Vector/vector_move_1_52.csv', 'Vector/vector_move_1_53.csv', 'Vector/vector_move_1_54.csv', 'Vector/vector_move_1_55.csv', 'Vector/vector_move_1_56.csv', 'Vector/vector_move_1_57.csv', 'Vector/vector_move_1_58.csv', 'Vector/vector_move_1_59.csv', 'Vector/vector_move_1_60.csv', 'Vector/vector_move_1_61.csv', 'Vector/vector_move_1_62.csv', 'Vector/vector_move_1_63.csv', 'Vector/vector_move_1_64.csv', 'Vector/vector_move_1_65.csv', 'Vector/vector_move_1_66.csv', 'Vector/vector_move_1_67.csv', 'Vector/vector_move_1_68.csv', 'Vector/vector_move_1_69.csv', 'Vector/vector_move_1_70.csv', 'Vector/vector_move_1_71.csv', 'Vector/vector_move_1_72.csv', 'Vector/vector_move_1_73.csv', 'Vector/vector_move_1_74.csv', 'Vector/vector_move_1_75.csv', 'Vector/vector_move_1_76.csv', 'Vector/vector_move_1_77.csv', 'Vector/vector_move_1_78.csv', 'Vector/vector_move_1_79.csv', 'Vector/vector_move_1_80.csv', 'Vector/vector_move_1_81.csv', 'Vector/vector_move_1_82.csv', 'Vector/vector_move_1_83.csv', 'Vector/vector_move_1_84.csv', 'Vector/vector_move_1_85.csv', 'Vector/vector_move_1_86.csv', 'Vector/vector_move_1_87.csv', 'Vector/vector_move_1_88.csv', 'Vector/vector_move_1_89.csv', 'Vector/vector_move_1_90.csv', 'Vector/vector_move_1_91.csv', 'Vector/vector_move_1_92.csv', 'Vector/vector_move_1_93.csv', 'Vector/vector_move_1_94.csv', 'Vector/vector_move_1_95.csv', 'Vector/vector_move_1_96.csv', 'Vector/vector_move_1_97.csv', 'Vector/vector_move_1_98.csv', 'Vector/vector_move_1_99.csv'])
# set active view
SetActiveView(renderView1)
# create a new 'Table To Points'
tableToPoints2 = TableToPoints(Input=vector_move_1_)
# Properties modified on tableToPoints2
tableToPoints2.XColumn = 'x[0]'
tableToPoints2.YColumn = 'x[1]'
tableToPoints2.a2DPoints = 1
# show data in view
tableToPoints2Display = Show(tableToPoints2, renderView1)
# reset view to fit data
renderView1.ResetCamera()
# reset view to fit data
renderView1.ResetCamera()
# set active source
SetActiveSource(tableToPoints1)
# change representation type
tableToPoints1Display.SetRepresentationType('Points')
# set active source
SetActiveSource(tableToPoints2)
# change representation type
tableToPoints2Display.SetRepresentationType('Points')
tableToPoints2Display.AmbientColor = [0.0, 1.0, 0.0]
# create a new 'CSV Reader'
vector_move_2_ = CSVReader(FileName=['Vector/vector_move_2_0.csv', 'Vector/vector_move_2_1.csv', 'Vector/vector_move_2_2.csv', 'Vector/vector_move_2_3.csv', 'Vector/vector_move_2_4.csv', 'Vector/vector_move_2_5.csv', 'Vector/vector_move_2_6.csv', 'Vector/vector_move_2_7.csv', 'Vector/vector_move_2_8.csv', 'Vector/vector_move_2_9.csv', 'Vector/vector_move_2_10.csv', 'Vector/vector_move_2_11.csv', 'Vector/vector_move_2_12.csv', 'Vector/vector_move_2_13.csv', 'Vector/vector_move_2_14.csv', 'Vector/vector_move_2_15.csv', 'Vector/vector_move_2_16.csv', 'Vector/vector_move_2_17.csv', 'Vector/vector_move_2_18.csv', 'Vector/vector_move_2_19.csv', 'Vector/vector_move_2_20.csv', 'Vector/vector_move_2_21.csv', 'Vector/vector_move_2_22.csv', 'Vector/vector_move_2_23.csv', 'Vector/vector_move_2_24.csv', 'Vector/vector_move_2_25.csv', 'Vector/vector_move_2_26.csv', 'Vector/vector_move_2_27.csv', 'Vector/vector_move_2_28.csv', 'Vector/vector_move_2_29.csv', 'Vector/vector_move_2_30.csv', 'Vector/vector_move_2_31.csv', 'Vector/vector_move_2_32.csv', 'Vector/vector_move_2_33.csv', 'Vector/vector_move_2_34.csv', 'Vector/vector_move_2_35.csv', 'Vector/vector_move_2_36.csv', 'Vector/vector_move_2_37.csv', 'Vector/vector_move_2_38.csv', 'Vector/vector_move_2_39.csv', 'Vector/vector_move_2_40.csv', 'Vector/vector_move_2_41.csv', 'Vector/vector_move_2_42.csv', 'Vector/vector_move_2_43.csv', 'Vector/vector_move_2_44.csv', 'Vector/vector_move_2_45.csv', 'Vector/vector_move_2_46.csv', 'Vector/vector_move_2_47.csv', 'Vector/vector_move_2_48.csv', 'Vector/vector_move_2_49.csv', 'Vector/vector_move_2_50.csv', 'Vector/vector_move_2_51.csv', 'Vector/vector_move_2_52.csv', 'Vector/vector_move_2_53.csv', 'Vector/vector_move_2_54.csv', 'Vector/vector_move_2_55.csv', 'Vector/vector_move_2_56.csv', 'Vector/vector_move_2_57.csv', 'Vector/vector_move_2_58.csv', 'Vector/vector_move_2_59.csv', 'Vector/vector_move_2_60.csv', 'Vector/vector_move_2_61.csv', 'Vector/vector_move_2_62.csv', 'Vector/vector_move_2_63.csv', 'Vector/vector_move_2_64.csv', 'Vector/vector_move_2_65.csv', 'Vector/vector_move_2_66.csv', 'Vector/vector_move_2_67.csv', 'Vector/vector_move_2_68.csv', 'Vector/vector_move_2_69.csv', 'Vector/vector_move_2_70.csv', 'Vector/vector_move_2_71.csv', 'Vector/vector_move_2_72.csv', 'Vector/vector_move_2_73.csv', 'Vector/vector_move_2_74.csv', 'Vector/vector_move_2_75.csv', 'Vector/vector_move_2_76.csv', 'Vector/vector_move_2_77.csv', 'Vector/vector_move_2_78.csv', 'Vector/vector_move_2_79.csv', 'Vector/vector_move_2_80.csv', 'Vector/vector_move_2_81.csv', 'Vector/vector_move_2_82.csv', 'Vector/vector_move_2_83.csv', 'Vector/vector_move_2_84.csv', 'Vector/vector_move_2_85.csv', 'Vector/vector_move_2_86.csv', 'Vector/vector_move_2_87.csv', 'Vector/vector_move_2_88.csv', 'Vector/vector_move_2_89.csv', 'Vector/vector_move_2_90.csv', 'Vector/vector_move_2_91.csv', 'Vector/vector_move_2_92.csv', 'Vector/vector_move_2_93.csv', 'Vector/vector_move_2_94.csv', 'Vector/vector_move_2_95.csv', 'Vector/vector_move_2_96.csv', 'Vector/vector_move_2_97.csv', 'Vector/vector_move_2_98.csv', 'Vector/vector_move_2_99.csv'])
# set active view
SetActiveView(renderView1)
# create a new 'Table To Points'
tableToPoints3 = TableToPoints(Input=vector_move_2_)
# Properties modified on tableToPoints3
tableToPoints3.XColumn = 'x[0]'
tableToPoints3.YColumn = 'x[1]'
tableToPoints3.a2DPoints = 1
# show data in view
tableToPoints3Display = Show(tableToPoints3, renderView1)
tableToPoints3Display.SetRepresentationType('Points')
tableToPoints3Display.AmbientColor = [1.0, 0.0, 0.0]
# current camera placement for renderView1
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.500684285, 0.49876095249999997, 2.7250155738876063]
renderView1.CameraFocalPoint = [0.500684285, 0.49876095249999997, 0.0]
renderView1.CameraParallelScale = 0.7052859287230878
# save animation images/movie
WriteAnimation('generated/particles_mooving_prc.ogv', Magnification=1, FrameRate=25.0, Compression=True)
#### 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_move0_1csv = CSVReader(FileName=['Vector/vector_move_0_1.csv'])
# create a new 'CSV Reader'
vector_move1_1csv = CSVReader(FileName=['Vector/vector_move_1_1.csv'])
# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# uncomment following to set a specific view size
# renderView1.ViewSize = [982, 495]
# get layout
viewLayout1 = GetLayout()
# create a new 'Table To Points'
tableToPoints1 = TableToPoints(Input=vector_move0_1csv)
# Properties modified on tableToPoints1
tableToPoints1.XColumn = 'x[0]'
tableToPoints1.YColumn = 'x[1]'
tableToPoints1.a2DPoints = 1
# show data in view
tableToPoints1Display = Show(tableToPoints1, renderView1)
# create a new 'Table To Points'
tableToPoints2 = TableToPoints(Input=vector_move1_1csv)
# Properties modified on tableToPoints2
tableToPoints2.XColumn = 'x[0]'
tableToPoints2.YColumn = 'x[1]'
tableToPoints2.a2DPoints = 1
# show data in view
tableToPoints2Display = Show(tableToPoints2, renderView1)
# change solid color
tableToPoints2Display.DiffuseColor = [1.0, 0.0, 0.0]
# change representation type
tableToPoints2Display.SetRepresentationType('Points')
# change solid color
tableToPoints2Display.AmbientColor = [1.0, 0.0, 0.0]
# Properties modified on tableToPoints2Display
tableToPoints2Display.PointSize = 10.0
# change representation type
tableToPoints1Display.SetRepresentationType('Points')
# Properties modified on tableToPoints1Display
tableToPoints1Display.PointSize = 10.0
# current camera placement for renderView1
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.8363000195118148, 0.3097736377565421, 10000.0]
renderView1.CameraFocalPoint = [0.8363000195118148, 0.3097736377565421, 0.0]
renderView1.CameraParallelScale = 0.036959899933429505
WriteImage("generated/particle_map1.jpg")
# create a new 'Calculator'
calculator1 = Calculator(Input=tableToPoints1)
# Properties modified on calculator1
calculator1.Function = 'iHat*column_1_[0]+jHat*column_1_[1]'
# show data in view
calculator1Display = Show(calculator1, renderView1)
# create a new 'Glyph'
glyph1 = Glyph(Input=calculator1,
GlyphType='Arrow')
# show data in view
glyph1Display = Show(glyph1, renderView1)
# show color bar/color legend
glyph1Display.SetScalarBarVisibility(renderView1, True)
# get color transfer function/color map for 'column10'
column10LUT = GetColorTransferFunction('column10')
# get opacity transfer function/opacity map for 'column10'
column10PWF = GetOpacityTransferFunction('column10')
# Properties modified on glyph1
glyph1.ScaleFactor = 0.00800218604000001
# create a new 'Calculator'
calculator2 = Calculator(Input=tableToPoints2)
# Properties modified on calculator2
calculator2.Function = 'iHat*column_1_[0]+jHat*column_1_[1]'
# show data in view
calculator2Display = Show(calculator2, renderView1)
# create a new 'Glyph'
glyph2 = Glyph(Input=calculator2,
GlyphType='Arrow')
# Properties modified on glyph2
glyph2.ScaleFactor = 0.008
# show data in view
glyph2Display = Show(glyph2, renderView1)
# show color bar/color legend
glyph2Display.SetScalarBarVisibility(renderView1, True)
# hide data in view
Hide(glyph1, renderView1)
# hide data in view
Hide(calculator2, renderView1)
# hide data in view
Hide(calculator1, renderView1)
# hide data in view
Hide(glyph2, renderView1)
# show data in view
glyph2Display = Show(glyph2, renderView1)
# show color bar/color legend
glyph2Display.SetScalarBarVisibility(renderView1, True)
# set active source
SetActiveSource(glyph1)
# show data in view
glyph1Display = Show(glyph1, renderView1)
# show color bar/color legend
glyph1Display.SetScalarBarVisibility(renderView1, True)
# create a new 'CSV Reader'
vector_move_before_map0_2csv = CSVReader(FileName=['Vector/vector_move_before_map_0_2.csv'])
# create a new 'CSV Reader'
vector_move_before_map1_2csv = CSVReader(FileName=['Vector/vector_move_before_map_1_2.csv'])
# create a new 'Table To Points'
tableToPoints3 = TableToPoints(Input=vector_move_before_map0_2csv)
# Properties modified on tableToPoints3
tableToPoints3.XColumn = 'x[0]'
tableToPoints3.YColumn = 'x[1]'
tableToPoints3.a2DPoints = 1
# show data in view
tableToPoints3Display = Show(tableToPoints3, renderView1)
# change representation type
tableToPoints3Display.SetRepresentationType('Points')
# Properties modified on tableToPoints3Display
tableToPoints3Display.PointSize = 10.0
# set active source
SetActiveSource(glyph1)
# Properties modified on glyph1
glyph1.GlyphMode = 'All Points'
# hide data in view
Hide(tableToPoints3, renderView1)
# create a new 'Table To Points'
tableToPoints4 = TableToPoints(Input=vector_move_before_map1_2csv)
# Properties modified on tableToPoints4
tableToPoints4.XColumn = 'x[0]'
tableToPoints4.YColumn = 'x[1]'
tableToPoints4.a2DPoints = 1
# show data in view
tableToPoints4Display = Show(tableToPoints4, renderView1)
# change representation type
tableToPoints4Display.SetRepresentationType('Points')
# Properties modified on tableToPoints4Display
tableToPoints4Display.PointSize = 10.0
# change solid color
tableToPoints4Display.AmbientColor = [1.0, 0.0, 0.0]
# hide data in view
Hide(tableToPoints4, renderView1)
# set active source
SetActiveSource(glyph2)
# Properties modified on glyph2
glyph2.GlyphMode = 'All Points'
# create a new 'CSV Reader'
vector_move1_2csv = CSVReader(FileName=['Vector/vector_move_1_2.csv'])
# create a new 'CSV Reader'
vector_move0_2csv = CSVReader(FileName=['Vector/vector_move_0_2.csv'])
# create a new 'Table To Points'
tableToPoints5 = TableToPoints(Input=vector_move1_2csv)
# Properties modified on tableToPoints5
tableToPoints5.XColumn = 'x[0]'
tableToPoints5.YColumn = 'x[1]'
tableToPoints5.a2DPoints = 1
# show data in view
tableToPoints5Display = Show(tableToPoints5, renderView1)
# change representation type
tableToPoints5Display.SetRepresentationType('Points')
# change solid color
tableToPoints5Display.AmbientColor = [1.0, 0.0, 0.0]
# Properties modified on tableToPoints5Display
tableToPoints5Display.PointSize = 10.0
# hide data in view
Hide(glyph1, renderView1)
# hide data in view
Hide(glyph2, renderView1)
# hide data in view
Hide(tableToPoints5, renderView1)
# hide data in view
Hide(tableToPoints4, renderView1)
# current camera placement for renderView1
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.9223207232553731, 0.3210044613442961, 10000.0]
renderView1.CameraFocalPoint = [0.9223207232553731, 0.3210044613442961, 0.0]
renderView1.CameraParallelScale = 0.0305453718458095
WriteImage("generated/particle_map1.jpg")
# set active source
SetActiveSource(glyph1)
# show data in view
glyph1Display = Show(glyph1, renderView1)
# show color bar/color legend
glyph1Display.SetScalarBarVisibility(renderView1, True)
# set active source
SetActiveSource(glyph2)
# show data in view
glyph2Display = Show(glyph2, renderView1)
# show color bar/color legend
glyph2Display.SetScalarBarVisibility(renderView1, True)
# save screenshot
WriteImage("generated/particle_map2.jpg")
# set active source
SetActiveSource(tableToPoints3)
# show data in view
tableToPoints3Display = Show(tableToPoints3, renderView1)
# set active source
SetActiveSource(tableToPoints4)
# show data in view
tableToPoints4Display = Show(tableToPoints4, renderView1)
# hide data in view
Hide(glyph1, renderView1)
# hide data in view
Hide(glyph2, renderView1)
# hide data in view
Hide(tableToPoints1, renderView1)
# hide data in view
Hide(tableToPoints2, renderView1)
# save screenshot
WriteImage("generated/particle_map3.jpg")
# set active source
SetActiveSource(vector_move0_2csv)
# create a new 'Table To Points'
tableToPoints6 = TableToPoints(Input=vector_move0_2csv)
# Properties modified on tableToPoints6
tableToPoints6.XColumn = 'x[0]'
tableToPoints6.YColumn = 'x[1]'
tableToPoints6.a2DPoints = 1
# show data in view
tableToPoints6Display = Show(tableToPoints6, renderView1)
# change representation type
tableToPoints6Display.SetRepresentationType('Points')
# Properties modified on tableToPoints6Display
tableToPoints6Display.PointSize = 10.0
# hide data in view
Hide(tableToPoints6, renderView1)
# hide data in view
Hide(tableToPoints3, renderView1)
# hide data in view
Hide(tableToPoints4, renderView1)
# set active source
SetActiveSource(tableToPoints5)
# show data in view
tableToPoints5Display = Show(tableToPoints5, renderView1)
# set active source
SetActiveSource(tableToPoints6)
# show data in view
tableToPoints6Display = Show(tableToPoints6, renderView1)
# hide data in view
Hide(tableToPoints5, renderView1)
# hide data in view
Hide(tableToPoints6, renderView1)
# show data in view
tableToPoints5Display = Show(tableToPoints5, renderView1)
# show data in view
tableToPoints6Display = Show(tableToPoints6, renderView1)
# hide data in view
Hide(tableToPoints1, renderView1)
# hide data in view
Hide(tableToPoints2, renderView1)
# current camera placement for renderView1
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.9223207232553731, 0.3210044613442961, 10000.0]
renderView1.CameraFocalPoint = [0.9223207232553731, 0.3210044613442961, 0.0]
renderView1.CameraParallelScale = 0.0305453718458095
# save screenshot
WriteImage("generated/particle_map4.jpg")
# hide data in view
Hide(tableToPoints5, renderView1)
# hide data in view
Hide(tableToPoints6, renderView1)
# show data in view
tableToPoints1Display = Show(tableToPoints1, renderView1)
# show data in view
tableToPoints2Display = Show(tableToPoints2, renderView1)
#### saving camera placements for all active views
# current camera placement for renderView1
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.4989760698, 0.18753136299999998, 2.059347991872556]
renderView1.CameraFocalPoint = [0.4989760698, 0.18753136299999998, 0.0]
renderView1.CameraParallelScale = 0.5329984807902486
#### uncomment the following to render all views
# RenderAllViews()
# alternatively, if you want to write images, you can use SaveScreenshot(...).
#include "Vector/vector_dist.hpp"
#include "Decomposition/CartDecomposition.hpp"
template<typename T> class Particle
{
public:
#ifdef SE_CLASS3
typedef boost::fusion::vector<T,T[3],T[3][3],SE3_ADD_PROP(3)> type;
#else
typedef boost::fusion::vector<T,T[3],T[3][3]> type;
#endif
type data;
static const unsigned int s = 0;
static const unsigned int v = 1;
static const unsigned int t = 2;
#ifdef SE_CLASS3
static const unsigned int max_prop = SE3_MAX_PROP(3);
static const unsigned int max_prop_real = 3;
#else
static const unsigned int max_prop = 3;
static const unsigned int max_prop_real = 3;
#endif
static inline bool noPointers()
{
return true;
}
};
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
//
openfpm_init(&argc,&argv);
Vcluster<> & v_cl = create_vcluster();
// 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> > vd(4096,domain,bc,g);
auto it = vd.getIterator();
while (it.isNext())
{
auto key = it.get();
vd.getPos(key)[0] = ud(eg);
vd.getPos(key)[1] = ud(eg);
vd.template getProp<1>(key)[0] = sin(10.0*vd.getPos(key)[0]);
vd.template getProp<1>(key)[1] = sin(10.0*vd.getPos(key)[1]);
++it;
}
/* coverty[fun_call_w_exception] */
vd.write("Vector/vector_before_map",CSV_WRITER);
vd.map();
/* coverty[fun_call_w_exception] */
vd.write("Vector/vector_after_map",CSV_WRITER);
vd.ghost_get<0>();
/* coverty[fun_call_w_exception] */
vd.write("Vector/vector_ghost_fill",CSV_WRITER);
vd.getDecomposition().write("Vector/vect_decomposition");
// move the particles
for (size_t i = 0 ; i < 100 ; i++)
{
auto it = vd.getDomainIterator();
while (it.isNext())
{
auto key = it.get();
vd.getPos(key)[0] += 0.005;
vd.getPos(key)[1] += 0.005;
vd.template getProp<1>(key)[0] = 0.005;
vd.template getProp<1>(key)[1] = 0.005;
++it;
}
vd.write_frame("Vector/vector_move_before_map",i,CSV_WRITER);
vd.map();
vd.write_frame("Vector/vector_move",i,CSV_WRITER);
}
openfpm_finalize();
}
#### 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=['Vector/vector_before_map_0.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=['Vector/vector_before_map_1.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=['Vector/vector_before_map_2.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=['Vector/vector_after_map_0.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=['Vector/vector_after_map_1.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=['Vector/vector_after_map_2.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")
#### 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_ghost_fill = CSVReader(FileName=['Vector/vector_ghost_fill_0.csv'])
# get animation scene
animationScene1 = GetAnimationScene()
# update animation scene based on data timesteps
animationScene1.UpdateAnimationUsingDataTimeSteps()
# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# uncomment following to set a specific view size
renderView1.ViewSize = [400, 400]
# get layout
viewLayout1 = GetLayout()
# Create a new 'SpreadSheet View'
spreadSheetView1 = CreateView('SpreadSheetView')
spreadSheetView1.BlockSize = 1024L
# uncomment following to set a specific view size
# spreadSheetView1.ViewSize = [400, 400]
# place view in the layout
viewLayout1.AssignView(2, spreadSheetView1)
# show data in view
vector_ghost_fillDisplay = Show(vector_ghost_fill, spreadSheetView1)
# destroy spreadSheetView1
Delete(spreadSheetView1)
del spreadSheetView1
# close an empty frame
viewLayout1.Collapse(2)
# set active view
SetActiveView(renderView1)
# create a new 'Table To Points'
tableToPoints1 = TableToPoints(Input=vector_ghost_fill)
# Properties modified on tableToPoints1
tableToPoints1.XColumn = 'x[0]'
tableToPoints1.YColumn = 'x[1]'
tableToPoints1.a2DPoints = 1
# show data in view
#tableToPoints1Display = Show(tableToPoints1, renderView1)
# reset view to fit data
renderView1.ResetCamera()
#changing interaction mode based on data extents
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.499922575, 0.18749537000000002, 10000.0]
renderView1.CameraFocalPoint = [0.499922575, 0.18749537000000002, 0.0]
# create a new 'Legacy VTK Reader'
vect_decompositionexternal_ghost_0vtk = LegacyVTKReader(FileNames=['Vector/vect_decompositionexternal_ghost_0.vtk'])
# destroy vect_decompositionexternal_ghost_0vtk
Delete(vect_decompositionexternal_ghost_0vtk)
del vect_decompositionexternal_ghost_0vtk
# create a new 'CSV Reader'
vector_after_map0csv = CSVReader(FileName=['Vector/vector_after_map_0.csv'])
# Create a new 'SpreadSheet View'
spreadSheetView1 = CreateView('SpreadSheetView')
spreadSheetView1.BlockSize = 1024L
# uncomment following to set a specific view size
# spreadSheetView1.ViewSize = [400, 400]
# place view in the layout
viewLayout1.AssignView(2, spreadSheetView1)
# show data in view
vector_after_map0csvDisplay = Show(vector_after_map0csv, spreadSheetView1)
# destroy spreadSheetView1
Delete(spreadSheetView1)
del spreadSheetView1
# close an empty frame
viewLayout1.Collapse(2)
# set active view
SetActiveView(renderView1)
# create a new 'Table To Points'
tableToPoints2 = TableToPoints(Input=vector_after_map0csv)
# Properties modified on tableToPoints2
tableToPoints2.XColumn = 'x[0]'
tableToPoints2.YColumn = 'x[1]'
tableToPoints2.a2DPoints = 1
# show data in view
tableToPoints2Display = Show(tableToPoints2, renderView1)
tableToPoints2Display.PointSize = 4.0
# create a new 'Legacy VTK Reader'
vect_decompositionsubdomains_0vtk = LegacyVTKReader(FileNames=['Vector/vect_decompositionsubdomains_0.vtk'])
# show data in view
vect_decompositionsubdomains_0vtkDisplay = Show(vect_decompositionsubdomains_0vtk, renderView1)
# show color bar/color legend
vect_decompositionsubdomains_0vtkDisplay.SetScalarBarVisibility(renderView1, True)
# get color transfer function/color map for 'data'
dataLUT = GetColorTransferFunction('data')
# get opacity transfer function/opacity map for 'data'
dataPWF = GetOpacityTransferFunction('data')
# hide data in view
Hide(tableToPoints1, renderView1)
# change representation type
vect_decompositionsubdomains_0vtkDisplay.SetRepresentationType('Points')
# change representation type
vect_decompositionsubdomains_0vtkDisplay.SetRepresentationType('Wireframe')
# turn off scalar coloring
ColorBy(vect_decompositionsubdomains_0vtkDisplay, None)
# set active source
SetActiveSource(tableToPoints2)
# change representation type
tableToPoints2Display.SetRepresentationType('Points')
# current camera placement for renderView1
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.45889311126344623, 0.2866467748466169, 10000.0]
renderView1.CameraFocalPoint = [0.45889311126344623, 0.2866467748466169, 0.0]
renderView1.CameraParallelScale = 0.1742200032569875
# create a new 'Legacy VTK Reader'
vect_decompositionexternal_ghost_0vtk = LegacyVTKReader(FileNames=['Vector/vect_decompositionexternal_ghost_0.vtk'])
# show data in view
vect_decompositionexternal_ghost_0vtkDisplay = Show(vect_decompositionexternal_ghost_0vtk, renderView1)
# show color bar/color legend
vect_decompositionexternal_ghost_0vtkDisplay.SetScalarBarVisibility(renderView1, False)
# hide data in view
Hide(vect_decompositionexternal_ghost_0vtk, renderView1)
# current camera placement for renderView1
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.4322940474199577, 0.3362326839869475, 10000.0]
renderView1.CameraFocalPoint = [0.4322940474199577, 0.3362326839869475, 0.0]
renderView1.CameraParallelScale = 0.08127491729954842
# save screenshot
WriteImage('generated/vector_one_p_zoom.jpg')
# set active source
SetActiveSource(vect_decompositionexternal_ghost_0vtk)
# show data in view
vect_decompositionexternal_ghost_0vtkDisplay = Show(vect_decompositionexternal_ghost_0vtk, renderView1)
# show color bar/color legend
vect_decompositionexternal_ghost_0vtkDisplay.SetScalarBarVisibility(renderView1, True)
# current camera placement for renderView1
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.4322940474199577, 0.3362326839869475, 10000.0]
renderView1.CameraFocalPoint = [0.4322940474199577, 0.3362326839869475, 0.0]
renderView1.CameraParallelScale = 0.08127491729954842
# save screenshot
WriteImage('generated/vector_one_p_zoom_ghost.jpg')
# set active source
SetActiveSource(tableToPoints1)
# show data in view
tableToPoints1Display = Show(tableToPoints1, renderView1)
# change representation type
#tableToPoints1Display.SetRepresentationType('Points')
# Properties modified on tableToPoints1Display
tableToPoints1Display.PointSize = 4.0
# change solid color
tableToPoints1Display.AmbientColor = [1.0, 0.0, 0.0]
# current camera placement for renderView1
renderView1.InteractionMode = '2D'
renderView1.CameraPosition = [0.4322940474199577, 0.3362326839869475, 10000.0]
renderView1.CameraFocalPoint = [0.4322940474199577, 0.3362326839869475, 0.0]
renderView1.CameraParallelScale = 0.08127491729954842
#### saving camera placements for all active views
# save screenshot
WriteImage('generated/vector_one_p_zoom_ghost_part.jpg')
#### uncomment the following to render all views
# RenderAllViews()
# alternatively, if you want to write images, you can use SaveScreenshot(...).
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment