diff --git a/src/libs/ascent/runtimes/ascent_vtkh_data_adapter.cpp b/src/libs/ascent/runtimes/ascent_vtkh_data_adapter.cpp index 22b31cd06..3b2065512 100644 --- a/src/libs/ascent/runtimes/ascent_vtkh_data_adapter.cpp +++ b/src/libs/ascent/runtimes/ascent_vtkh_data_adapter.cpp @@ -232,6 +232,7 @@ GetExplicitCoordinateSystem(const conduit::Node &n_coords, } + template vtkm::cont::Field GetField(const conduit::Node &node, const std::string &field_name, @@ -280,9 +281,9 @@ vtkm::cont::Field GetField(const conduit::Node &node, // use ArrayHandleStride to create new field // - // NOTE: In this case, the num_vals, needs to be + // NOTE: In this case, the num_vals, needs to be // the full extent of the strided area3 - + int num_vals_expanded = num_vals * element_stride; vtkm::cont::ArrayHandle source_array = vtkm::cont::make_ArrayHandle(values_ptr, num_vals_expanded, @@ -1402,7 +1403,7 @@ VTKHDataAdapter::UnstructuredBlueprintToVTKmDataSet else { // convert to int32 - std::cerr << "INT32 unstructured conversion: non zero copy" << std::endl; + // std::cout << "INT32 unstructured conversion: non zero copy" << std::endl; connectivity.Allocate(conn_size); void *ptr = (void*) vtkh::GetVTKMPointer(connectivity); Node n_tmp; @@ -1420,7 +1421,7 @@ VTKHDataAdapter::UnstructuredBlueprintToVTKmDataSet else { // convert to int64 - std::cerr << "INT64 unstructured conversion: non zero copy" << std::endl; + // std::cout << "INT64 unstructured conversion: non zero copy" << std::endl; connectivity.Allocate(conn_size); void *ptr = (void*) vtkh::GetVTKMPointer(connectivity); Node n_tmp; @@ -1501,21 +1502,6 @@ VTKHDataAdapter::AddField(const std::string &field_name, { bool supported_type = false; - // if(n_vals.is_compact()) - // { - // // we compile vtk-h with fp types - // if(n_vals.dtype().is_float32()) - // { - // dset->AddField(detail::GetField(n_vals, field_name, assoc_str, topo_name, zero_copy)); - // supported_type = true; - // } - // else if(n_vals.dtype().is_float64()) - // { - // dset->AddField(detail::GetField(n_vals, field_name, assoc_str, topo_name, zero_copy)); - // supported_type = true; - // } - // } - // vtk-m can stride as long as the strides are a multiple of the native stride // we compile vtk-h with fp types @@ -1524,15 +1510,15 @@ VTKHDataAdapter::AddField(const std::string &field_name, // check that the byte stride is a multiple of native stride index_t stride = n_vals.dtype().stride(); index_t element_stride = stride / sizeof(float32); - + //std::cout << "field name: " << field_name << " " // << " byte stride: " << stride // << " element_stride: " << element_stride << std::endl; - // if element_stride is evenly divided by native, we are good to + // if element_stride is evenly divided by native, we are good to // use vtk m array handles if( stride % sizeof(float32) == 0 ) { - // in this case we can use a strided array handle + // in this case we can use a strided array handle dset->AddField(detail::GetField(n_vals, field_name, assoc_str, @@ -1543,18 +1529,18 @@ VTKHDataAdapter::AddField(const std::string &field_name, } } else if(n_vals.dtype().is_float64()) - { + { // check that the byte stride is a multiple of native stride index_t stride = n_vals.dtype().stride(); index_t element_stride = stride / sizeof(float64); //std::cout << "field name: " << field_name << " " // << " byte stride: " << stride // << " element_stride: " << element_stride << std::endl; - // if element_stride is evenly divided by native, we are good to + // if element_stride is evenly divided by native, we are good to // use vtk m array handles if( stride % sizeof(float64) == 0 ) { - // in this case we can use a strided array handle + // in this case we can use a strided array handle dset->AddField(detail::GetField(n_vals, field_name, assoc_str, @@ -1564,62 +1550,72 @@ VTKHDataAdapter::AddField(const std::string &field_name, supported_type = true; } } - else if(n_vals.dtype().is_int32()) - { - // check that the byte stride is a multiple of native stride - index_t stride = n_vals.dtype().stride(); - index_t element_stride = stride / sizeof(int32); - //std::cout << "field name: " << field_name << " " - // << " byte stride: " << stride - // << " element_stride: " << element_stride << std::endl; - // if element_stride is evenly divided by native, we are good to - // use vtk m array handles - if( stride % sizeof(int32) == 0 ) - { - // in this case we can use a strided array handle - dset->AddField(detail::GetField(n_vals, - field_name, - assoc_str, - topo_name, - element_stride, - zero_copy)); - supported_type = true; - } - } - else if(n_vals.dtype().is_int64()) - { - // check that the byte stride is a multiple of native stride - index_t stride = n_vals.dtype().stride(); - index_t element_stride = stride / sizeof(int64); - //std::cout << "field name: " << field_name << " " - // << " byte stride: " << stride - // << " element_stride: " << element_stride << std::endl; - // if element_stride is evenly divided by native, we are good to - // use vtk m array handles - if( stride % sizeof(int64) == 0 ) - { - // in this case we can use a strided array handle - dset->AddField(detail::GetField(n_vals, - field_name, - assoc_str, - topo_name, - element_stride, - zero_copy)); - supported_type = true; - } - } - - + // *********************************************************************** + // NOTE: TODO OUR VTK-M is not compiled with int32 and int64 support ... + // *********************************************************************** + // These cases fail and provide this error message: + // Execution failed with vtkm: Could not find appropriate cast for array in CastAndCall. + // Array: valueType=x storageType=N4vtkm4cont15StorageTagBasicE 27 values occupying 216 bytes [0 1 2 ... 24 25 26] + // TypeList: N4vtkm4ListIJfdEEE + // *********************************************************************** + // + // else if(n_vals.dtype().is_int32()) + // { + // // check that the byte stride is a multiple of native stride + // index_t stride = n_vals.dtype().stride(); + // index_t element_stride = stride / sizeof(int32); + // //std::cout << "field name: " << field_name << " " + // // << " byte stride: " << stride + // // << " element_stride: " << element_stride << std::endl; + // // if element_stride is evenly divided by native, we are good to + // // use vtk m array handles + // if( stride % sizeof(int32) == 0 ) + // { + // // in this case we can use a strided array handle + // dset->AddField(detail::GetField(n_vals, + // field_name, + // assoc_str, + // topo_name, + // element_stride, + // zero_copy)); + // supported_type = true; + // } + // } + // else if(n_vals.dtype().is_int64()) + // { + // // check that the byte stride is a multiple of native stride + // index_t stride = n_vals.dtype().stride(); + // index_t element_stride = stride / sizeof(int64); + // //std::cout << "field name: " << field_name << " " + // // << " byte stride: " << stride + // // << " element_stride: " << element_stride << std::endl; + // // if element_stride is evenly divided by native, we are good to + // // use vtk m array handles + // if( stride % sizeof(int64) == 0 ) + // { + // // in this case we can use a strided array handle + // dset->AddField(detail::GetField(n_vals, + // field_name, + // assoc_str, + // topo_name, + // element_stride, + // zero_copy)); + // supported_type = true; + // } + // } // vtk-m cant support zero copy for this layout or was not compiled to expose this datatype // use float64 by default if(!supported_type) { - std::cerr << "WE ARE IN UNSUPPORTED DATA TYPE" << std::endl; + // std::cout << "WE ARE IN UNSUPPORTED DATA TYPE: " + // << n_vals.dtype().name() << std::endl; + // convert to float64, we use this as a comprise to cover the widest range vtkm::cont::ArrayHandle vtkm_arr; vtkm_arr.Allocate(num_vals); + // TODO -- FUTURE: Do this conversion w/ device if on device void *ptr = (void*) vtkh::GetVTKMPointer(vtkm_arr); Node n_tmp; n_tmp.set_external(DataType::float64(num_vals),ptr); @@ -1639,6 +1635,11 @@ VTKHDataAdapter::AddField(const std::string &field_name, vtkm_arr)); } } + // else + // { + // std::cout << "SUPPORTED DATA TYPE: " + // << n_vals.dtype().name() << std::endl; + // } } catch (vtkm::cont::Error error) { diff --git a/src/tests/ascent/t_ascent_render_3d.cpp b/src/tests/ascent/t_ascent_render_3d.cpp index 502d766c9..21eddc332 100644 --- a/src/tests/ascent/t_ascent_render_3d.cpp +++ b/src/tests/ascent/t_ascent_render_3d.cpp @@ -141,7 +141,6 @@ TEST(ascent_render_3d, test_render_3d_original_bounds) // remove old images before rendering remove_test_image(output_file); - // // Create the actions. // @@ -2643,7 +2642,7 @@ TEST(ascent_render_3d, test_render_3d_extreme_extents) Ascent ascent; ascent.open(); ascent.publish(mesh); - + scenes["s1/image_prefix"] = output_file; ascent.execute(actions); // check that we created an image @@ -2679,11 +2678,11 @@ TEST(ascent_render_3d, test_render_3d_extreme_extents) // check that we created an image // TODO: We expect this to fail until we address float64 vs float32 issues EXPECT_FALSE(check_test_image(output_file)); - + //now with unstructured: Node mesh_unstruct; - + conduit::blueprint::mesh::topology::rectilinear::to_unstructured(mesh["topologies/topo"], mesh_unstruct["topologies/topo"], mesh_unstruct["coordsets/coords"]); @@ -2712,7 +2711,7 @@ TEST(ascent_render_3d, test_render_3d_extreme_extents) // TODO: We expect this to fail until we address float64 vs float32 issues EXPECT_FALSE(check_test_image(output_file)); - + }