Skip to content

Particle updates from learning things at scale #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: advectionOfParticles
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d9141d8
particle advection filter and unittest.
dpugmire Feb 4, 2019
80126c2
Particle advection filter.
dpugmire Feb 4, 2019
82ddf3c
Merge branch 'develop' of https://github.com/Alpine-DAV/vtk-h into pa…
dpugmire Mar 21, 2019
2c6a9b5
Merge branch 'develop' of https://github.com/dpugmire/vtk-h into part…
dpugmire Mar 21, 2019
f071f8f
Fix failing tests. use _Float32 field names and add ghost array to te…
dpugmire Mar 22, 2019
eb8be6d
Compile with new communication code.
dpugmire Mar 28, 2019
87a68cf
trying to get ostream overloads to work
dpugmire Mar 29, 2019
8264179
Fixes to compile issues and get things working in parallel.
dpugmire Mar 29, 2019
c253c4e
Create a threaded and multi-threaded version of particle advection fi…
dpugmire Apr 11, 2019
45b133b
Add timer and counter class. Make use of the timer and counter class …
dpugmire Apr 15, 2019
4b0a263
Cleanup any requests when the Messenger class destructs. This fixes a…
dpugmire Apr 17, 2019
12310b6
Support for non-axis aligned domains.
dpugmire May 15, 2019
3d88ba7
Adding some timers to vtkh.
jameskress May 16, 2019
bc911ac
Merge remote-tracking branch 'upstream/particleAdvection'
jameskress May 16, 2019
1d266b0
Merge remote-tracking branch 'upstream/develop'
jameskress May 16, 2019
6bb8468
Changes/fixes for particle advection.
jameskress Jun 11, 2019
6c1019d
Adding barrier to advection execute method to ensure nothing spooky h…
jameskress Jun 11, 2019
ce5ba23
Updates for particle advection.
jameskress Jun 27, 2019
28d975c
Merge remote-tracking branch 'upstream/develop'
jameskress Jul 1, 2019
241ae68
Updating.
jameskress Sep 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/blt
Submodule blt updated 114 files
22 changes: 12 additions & 10 deletions src/tests/vtkh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,25 @@ set(BASIC_TESTS t_vtk-h_smoke

set(CUDA_TESTS t_vtk-h_cuda)

set(MPI_TESTS t_vtk-h_smoke_par
t_vtk-h_dataset_par
t_vtk-h_no_op_par
t_vtk-h_marching_cubes_par
t_vtk-h_multi_render_par
t_vtk-h_raytracer_par
t_vtk-h_volume_renderer_par
set(MPI_TESTS
# t_vtk-h_smoke_par
# t_vtk-h_dataset_par
# t_vtk-h_no_op_par
# t_vtk-h_marching_cubes_par
# t_vtk-h_multi_render_par
t_vtk-h_particle_advection_par
# t_vtk-h_raytracer_par
# t_vtk-h_volume_renderer_par
)


################################
# Add main tests
################################
message(STATUS "Adding vtk-h lib unit tests")
foreach(TEST ${BASIC_TESTS})
add_cpp_test(TEST ${TEST} DEPENDS_ON vtkh)
endforeach()
#foreach(TEST ${BASIC_TESTS})
# add_cpp_test(TEST ${TEST} DEPENDS_ON vtkh)
#endforeach()

if(CUDA_FOUND)
foreach(TEST ${CUDA_TESTS})
Expand Down
103 changes: 85 additions & 18 deletions src/tests/vtkh/t_test_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <assert.h>
#include <vtkm/VectorAnalysis.h>
#include <vtkm/cont/DataSet.h>
#include <vtkm/cont/DataSetBuilderRectilinear.h>

#define BASE_SIZE 32
typedef vtkm::cont::ArrayHandleUniformPointCoordinates UniformCoords;
Expand Down Expand Up @@ -101,18 +102,20 @@ SpatialDivision GetBlock(int block, int num_blocks, SpatialDivision total_size)
return divs.at(block);
}

vtkm::cont::Field CreateCellScalarField(int size)
template <typename FieldType>
vtkm::cont::Field CreateCellScalarField(int size, const char* fieldName)
{
vtkm::cont::ArrayHandle<vtkm::Float32> data;
vtkm::cont::ArrayHandle<FieldType> data;
data.Allocate(size);

for(int i = 0; i < size; ++i)
{
vtkm::Float32 val = i / vtkm::Float32(size);
FieldType val = i / FieldType(size);
data.GetPortalControl().Set(i, val);
}

vtkm::cont::Field field("cell_data",

vtkm::cont::Field field(fieldName,
vtkm::cont::Field::Association::CELL_SET,
"cells",
data);
Expand Down Expand Up @@ -144,42 +147,44 @@ vtkm::cont::Field CreateGhostScalarField(vtkm::Id3 dims)
return field;
}

vtkm::cont::Field CreatePointScalarField(UniformCoords coords)
template <typename FieldType>
vtkm::cont::Field CreatePointScalarField(UniformCoords coords, const char* fieldName)

{
const int size = coords.GetPortalConstControl().GetNumberOfValues();
vtkm::cont::ArrayHandle<vtkm::Float32> data;
vtkm::cont::ArrayHandle<FieldType> data;
data.Allocate(size);
auto portal = coords.GetPortalConstControl();
for(int i = 0; i < size; ++i)
{
vtkm::Vec<vtkm::FloatDefault,3> point = portal.Get(i);

vtkm::Float32 val = vtkm::Magnitude(point) + 1.f;
vtkm::Vec<FieldType,3> point = portal.Get(i);

FieldType val = vtkm::Magnitude(point);
data.GetPortalControl().Set(i, val);
}

vtkm::cont::Field field("point_data",
vtkm::cont::Field field(fieldName,
vtkm::cont::Field::Association::POINTS,
data);
return field;
}

vtkm::cont::Field CreatePointVecField(int size)
template <typename FieldType>
vtkm::cont::Field CreatePointVecField(int size, const char* fieldName)
{
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32,3>> data;
vtkm::cont::ArrayHandle<vtkm::Vec<FieldType,3>> data;
data.Allocate(size);

for(int i = 0; i < size; ++i)
{
vtkm::Float32 val = i / vtkm::Float32(size);
FieldType val = i / FieldType(size);

vtkm::Vec<vtkm::Float32, 3> vec(val, -val, val);
vtkm::Vec<FieldType, 3> vec(val, -val, val);

data.GetPortalControl().Set(i, vec);
}

vtkm::cont::Field field("vector_data",
vtkm::cont::Field field(fieldName,
vtkm::cont::Field::Association::POINTS,
data);
return field;
Expand Down Expand Up @@ -233,10 +238,72 @@ vtkm::cont::DataSet CreateTestData(int block, int num_blocks, int base_size)
int num_points = point_dims[0] * point_dims[1] * point_dims[2];
int num_cells = cell_dims[0] * cell_dims[1] * cell_dims[2];

data_set.AddField(CreatePointScalarField(point_handle));
data_set.AddField(CreatePointVecField(num_points));
data_set.AddField(CreateCellScalarField(num_cells));
data_set.AddField(CreatePointScalarField<vtkm::Float32>(point_handle, "point_data_Float32"));
data_set.AddField(CreatePointVecField<vtkm::Float32>(num_points, "vector_data_Float32"));
data_set.AddField(CreateCellScalarField<vtkm::Float32>(num_cells, "cell_data_Float32"));
data_set.AddField(CreatePointScalarField<vtkm::Float64>(point_handle, "point_data_Float64"));
data_set.AddField(CreatePointVecField<vtkm::Float64>(num_points, "vector_data_Float64"));
data_set.AddField(CreateCellScalarField<vtkm::Float64>(num_cells, "cell_data_Float64"));
data_set.AddField(CreateGhostScalarField(cell_dims));
return data_set;
}

vtkm::cont::DataSet CreateTestDataRectilinear(int block, int num_blocks, int base_size)
{
SpatialDivision mesh_size;

mesh_size.m_mins[0] = 0;
mesh_size.m_mins[1] = 0;
mesh_size.m_mins[2] = 0;

mesh_size.m_maxs[0] = num_blocks * base_size - 1;
mesh_size.m_maxs[1] = num_blocks * base_size - 1;
mesh_size.m_maxs[2] = num_blocks * base_size - 1;

SpatialDivision local_block = GetBlock(block, num_blocks, mesh_size);

vtkm::Vec<vtkm::Float32,3> origin;
origin[0] = local_block.m_mins[0];
origin[1] = local_block.m_mins[1];
origin[2] = local_block.m_mins[2];

vtkm::Vec<vtkm::Float32,3> spacing(1.f, 1.f, 1.f);

vtkm::Id3 point_dims;
point_dims[0] = local_block.m_maxs[0] - local_block.m_mins[0] + 2;
point_dims[1] = local_block.m_maxs[1] - local_block.m_mins[1] + 2;
point_dims[2] = local_block.m_maxs[2] - local_block.m_mins[2] + 2;


vtkm::Id3 cell_dims;
cell_dims[0] = point_dims[0] - 1;
cell_dims[1] = point_dims[1] - 1;
cell_dims[2] = point_dims[2] - 1;

std::vector<vtkm::Float64> xvals, yvals, zvals;
xvals.resize((size_t)point_dims[0]);
xvals[0] = static_cast<vtkm::Float64>(local_block.m_mins[0]);
for (size_t i = 1; i < (size_t)point_dims[0]; i++)
xvals[i] = xvals[i - 1] + spacing[0];

yvals.resize((size_t)point_dims[1]);
yvals[0] = static_cast<vtkm::Float64>(local_block.m_mins[1]);
for (size_t i = 1; i < (size_t)point_dims[1]; i++)
yvals[i] = yvals[i - 1] + spacing[1];

zvals.resize((size_t)point_dims[2]);
zvals[0] = static_cast<vtkm::Float64>(local_block.m_mins[2]);
for (size_t i = 1; i < (size_t)point_dims[2]; i++)
zvals[i] = zvals[i - 1] + spacing[2];

vtkm::cont::DataSetBuilderRectilinear dataSetBuilder;
vtkm::cont::DataSet data_set = dataSetBuilder.Create(xvals, yvals, zvals);

int num_points = point_dims[0] * point_dims[1] * point_dims[2];
int num_cells = cell_dims[0] * cell_dims[1] * cell_dims[2];

data_set.AddField(CreatePointVecField<vtkm::Float32>(num_points, "vector_data_Float32"));
data_set.AddField(CreatePointVecField<vtkm::Float64>(num_points, "vector_data_Float64"));

return data_set;
}
Expand Down
13 changes: 7 additions & 6 deletions src/tests/vtkh/t_vtk-h_clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ TEST(vtkh_clip, vtkh_box_clip)

clipper.SetBoxClip(clip_bounds);
clipper.SetInput(&data_set);
clipper.AddMapField("point_data");
//clipper.AddMapField("cell_data");
clipper.AddMapField("point_data_Float32");
clipper.AddMapField("cell_data_Float32");
clipper.Update();

vtkh::DataSet *clip_output = clipper.GetOutput();
Expand All @@ -69,13 +69,14 @@ TEST(vtkh_clip, vtkh_box_clip)

vtkh::RayTracer tracer;
tracer.SetInput(clip_output);
tracer.SetField("point_data");
tracer.SetField("point_data_Float32");

scene.AddRenderer(&tracer);
scene.Render();

delete clip_output;
}

#if 0
TEST(vtkh_clip, vtkh_sphere_clip)
{
Expand All @@ -101,8 +102,8 @@ TEST(vtkh_clip, vtkh_sphere_clip)

clipper.SetSphereClip(center, radius);
clipper.SetInput(&data_set);
clipper.AddMapField("point_data");
clipper.AddMapField("cell_data");
clipper.AddMapField("point_data_Float32");
clipper.AddMapField("cell_data_Float32");
clipper.Update();

vtkh::DataSet *clip_output = clipper.GetOutput();
Expand All @@ -124,7 +125,7 @@ TEST(vtkh_clip, vtkh_sphere_clip)

vtkh::RayTracer tracer;
tracer.SetInput(clip_output);
tracer.SetField("point_data");
tracer.SetField("point_data_Float32");

scene.AddRenderer(&tracer);
scene.Render();
Expand Down
65 changes: 32 additions & 33 deletions src/tests/vtkh/t_vtk-h_clip_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
TEST(vtkh_clip_field, vtkh_clip)
{
vtkh::DataSet data_set;

const int base_size = 32;
const int num_blocks = 1;
const int num_blocks = 1;

for(int i = 0; i < num_blocks; ++i)
{
data_set.AddDomain(CreateTestData(i, num_blocks, base_size), i);
}

vtkh::ClipField clipper;

clipper.SetClipValue(10.);
clipper.SetField("point_data");
clipper.SetField("point_data_Float32");
clipper.SetInput(&data_set);
clipper.Update();

Expand All @@ -47,43 +47,43 @@ TEST(vtkh_clip_field, vtkh_clip)
camera.ResetToBounds(bounds);
camera.SetPosition(vtkm::Vec<vtkm::Float64,3>(16,-32,-32));
float bg_color[4] = { 0.f, 0.f, 0.f, 1.f};
vtkh::Render render = vtkh::MakeRender(512,
512,
camera,
*clip_output,
vtkh::Render render = vtkh::MakeRender(512,
512,
camera,
*clip_output,
"clip_field",
bg_color);
bg_color);

vtkh::Scene scene;
scene.AddRender(render);

vtkh::RayTracer tracer;
tracer.SetInput(clip_output);
tracer.SetField("point_data");
tracer.SetField("point_data_Float32");

scene.AddRenderer(&tracer);
scene.AddRenderer(&tracer);
scene.Render();
delete clip_output;

delete clip_output;
}

//----------------------------------------------------------------------------
TEST(vtkh_clip_field, vtkh_clip_cell_centered)
{
vtkh::DataSet data_set;

const int base_size = 32;
const int num_blocks = 1;
const int num_blocks = 1;

for(int i = 0; i < num_blocks; ++i)
{
data_set.AddDomain(CreateTestData(i, num_blocks, base_size), i);
}

vtkh::ClipField clipper;

clipper.SetClipValue(.5);
clipper.SetField("cell_data");
clipper.SetField("cell_data_Float32");
clipper.SetInput(&data_set);
clipper.Update();

Expand All @@ -95,23 +95,22 @@ TEST(vtkh_clip_field, vtkh_clip_cell_centered)
camera.ResetToBounds(bounds);
camera.SetPosition(vtkm::Vec<vtkm::Float64,3>(16,-32,-32));
float bg_color[4] = { 0.f, 0.f, 0.f, 1.f};
vtkh::Render render = vtkh::MakeRender(512,
512,
camera,
*clip_output,
vtkh::Render render = vtkh::MakeRender(512,
512,
camera,
*clip_output,
"clip_field_cell",
bg_color);
bg_color);

vtkh::Scene scene;
scene.AddRender(render);

vtkh::RayTracer tracer;
tracer.SetInput(clip_output);
tracer.SetField("point_data");
tracer.SetField("point_data_Float32");

scene.AddRenderer(&tracer);
scene.AddRenderer(&tracer);
scene.Render();

delete clip_output;
}

delete clip_output;
}
Loading