@@ -34,6 +34,7 @@ DEALINGS IN THE SOFTWARE.
3434#include < Core/Datatypes/Legacy/Field/Field.h>
3535#include < Core/Datatypes/Legacy/Field/FieldInformation.h>
3636#include < Core/Datatypes/Legacy/Field/VMesh.h>
37+ #include < Core/Datatypes/Legacy/Field/LatVolMesh.h>
3738#include < Core/Datatypes/Mesh/VirtualMeshFacade.h>
3839#include < Core/Algorithms/Base/AlgorithmVariableNames.h>
3940#include < Core/Algorithms/Base/AlgorithmPreconditions.h>
@@ -339,16 +340,31 @@ OsprayGeometryObjectHandle OsprayDataAlgorithm::addVol(FieldHandle field, ColorM
339340
340341 auto facade (field->mesh ()->getFacade ());
341342 auto vfield = field->vfield ();
343+
344+ // //cast mesh to latvol and fill dim, space, origin
345+ // auto latVolM = (boost::shared_ptr<LatVolMesh<Core::Basis::HexTrilinearLgn<Core::Geometry::Point> > >) field->mesh();
346+ // std::vector<int> dim; latVolM->get_dim(dim);
347+ // std::vector<float> min; latVolM.get_min(min);
348+ /* fieldData.origin_x = latVolM->get_min_i();
349+ fieldData.origin_y = latVolM->get_min_j();
350+ fieldData.origin_z = latVolM->get_min_k();
351+ fieldData.dim_x = latVolM->get_ni();
352+ fieldData.dim_y = latVolM->get_nj();
353+ fieldData.dim_z = latVolM->get_nk();*/
354+ // get_ni
355+ fieldData.dim_x = 100 ; fieldData.dim_y = 100 ; fieldData.dim_z = 100 ;
356+ fieldData.origin_x = -1 ; fieldData.origin_y = -1 ; fieldData.origin_z = -1 ;
357+ fieldData.spacing_x = 0.02 ; fieldData.spacing_y = 0.02 ; fieldData.spacing_z = 0.02 ;
358+
342359 double value;
360+ // std::cout << "mname:" << field->mesh()->type_name << std::endl;
343361
344362 for (const auto & node : facade->nodes ())
345363 {
346364 auto point = node.point ();
347365 if (vfield->num_values () > 0 )
348366 {
349367 vfield->get_value (value, node.index ());
350-
351-
352368 voxels.push_back (value);
353369 }
354370 vertex_new.push_back (static_cast <float >(point.x ()));
@@ -357,32 +373,14 @@ OsprayGeometryObjectHandle OsprayDataAlgorithm::addVol(FieldHandle field, ColorM
357373
358374 }
359375
360- // if (colorMap)
376+ if (colorMap)
361377 {
362- obj->tfn .colors .push_back (0 );
363- obj->tfn .colors .push_back (0 );
364- obj->tfn .colors .push_back (1 );
365- // obj->tfn.colors.push_back(0);
366- // obj->tfn.colors.push_back(.75);
367- // obj->tfn.colors.push_back(.75);
368-
369- obj->tfn .colors .push_back (0 );
370- obj->tfn .colors .push_back (1 );
371- obj->tfn .colors .push_back (0 );
372-
373- // obj->tfn.colors.push_back(1);
374- // obj->tfn.colors.push_back(.5);
375- // obj->tfn.colors.push_back(0);
376- obj->tfn .colors .push_back (1 );
377- obj->tfn .colors .push_back (0 );
378- obj->tfn .colors .push_back (0 );
379-
380- obj->tfn .opacities .push_back (0.5 );
381- obj->tfn .opacities .push_back (0.5 );
378+ ColorMap_OSP_helper cmp (colorMap->getColorMapName ());
379+ obj->tfn .colors = cmp.colorList ;
380+ obj->tfn .opacities = cmp.opacityList ;
382381 }
383382 fieldData.color = voxels;
384383 fieldData.vertex = vertex_new;
385-
386384 return obj;
387385}
388386
@@ -567,9 +565,15 @@ AlgorithmOutput OsprayDataAlgorithm::run(const AlgorithmInput& input) const
567565 }
568566 else if (info.is_volume ())
569567 {
570- if (info.is_latvol ())
571- renderable = addVol (field, colorMap);
572- // THROW_ALGORITHM_INPUT_ERROR("field type vol.");
568+ if (info.is_latvol ()){
569+ renderable = addVol (field, colorMap);
570+ }else if (info.is_tetvol ()){
571+ THROW_ALGORITHM_INPUT_ERROR (" Tet vol not supported. LatVol only at this point" );
572+ }else if (info.is_hexvol ()){
573+ THROW_ALGORITHM_INPUT_ERROR (" Hex vol not supported. LatVol only at this point" );
574+ }else {
575+ THROW_ALGORITHM_INPUT_ERROR (" Unknown vol type. LatVol only at this point" );
576+ }
573577 }
574578 else if (info.is_pointcloudmesh ())
575579 {
0 commit comments