11#include " AMReX_AmrDataAdaptor.H"
22
3+ #include " senseiConfig.h"
34#include " MPIUtils.h"
45#include " STLUtils.h"
5- #include " VTKUtils .h"
6+ #include " SVTKUtils .h"
67#include " Profiler.h"
78#include " Error.h"
89
9- #include < vtkObjectFactory.h>
10- #include < vtkOverlappingAMR.h>
11- #include < vtkAMRBox.h>
12- #include < vtkUniformGrid.h>
13- #include < vtkXMLUniformGridAMRWriter.h>
14- #include < vtkDataSetAttributes.h>
15- #include < vtkUnsignedCharArray.h>
16- #include < vtkFloatArray.h>
17- #include < vtkDoubleArray.h>
18- #include < vtkCellData.h>
19- #include < vtkPointData.h>
10+ #include < svtkObjectFactory.h>
11+ #include < svtkOverlappingAMR.h>
12+ #include < svtkAMRBox.h>
13+ #include < svtkUniformGrid.h>
14+ #include < svtkDataSetAttributes.h>
15+ #include < svtkUnsignedCharArray.h>
16+ #include < svtkFloatArray.h>
17+ #include < svtkDoubleArray.h>
18+ #include < svtkCellData.h>
19+ #include < svtkPointData.h>
2020
2121#include < AMReX_AmrLevel.H>
2222#include < AMReX_BoxArray.H>
@@ -62,15 +62,15 @@ int DescriptorMap::Initialize(const DescriptorList &descriptors)
6262
6363 if (itype.cellCentered ())
6464 {
65- this ->Map [vtkDataObject ::CELL][arrayName] = std::make_pair (i,j);
65+ this ->Map [svtkDataObject ::CELL][arrayName] = std::make_pair (i,j);
6666 }
6767 else if (itype.nodeCentered ())
6868 {
69- this ->Map [vtkDataObject ::POINT][arrayName] = std::make_pair (i,j);
69+ this ->Map [svtkDataObject ::POINT][arrayName] = std::make_pair (i,j);
7070 }
7171 else
7272 {
73- this ->Map [vtkDataObject ::FIELD][arrayName] = std::make_pair (i,j);
73+ this ->Map [svtkDataObject ::FIELD][arrayName] = std::make_pair (i,j);
7474 }
7575 }
7676 }
@@ -156,7 +156,7 @@ struct AmrDataAdaptor::InternalsType
156156 int PinMesh;
157157 amrex::InSituUtils::DescriptorMap SimMetadata;
158158#if SENSEI_VERSION_MAJOR < 3
159- std::vector<vtkDataObject *> ManagedObjects;
159+ std::vector<svtkDataObject *> ManagedObjects;
160160#endif
161161 std::vector<std::vector<unsigned char *>> Masks;
162162};
@@ -225,11 +225,11 @@ int AmrDataAdaptor::GetMeshMetadata(unsigned int id,
225225 metadata->GlobalView = true ;
226226
227227 metadata->MeshName = " mesh" ;
228- metadata->MeshType = VTK_OVERLAPPING_AMR ;
229- metadata->BlockType = VTK_UNIFORM_GRID ;
228+ metadata->MeshType = SVTK_OVERLAPPING_AMR ;
229+ metadata->BlockType = SVTK_UNIFORM_GRID ;
230230 metadata->NumBlocks = 0 ;
231231 metadata->NumBlocksLocal = {-1 };
232- metadata->CoordinateType = InSituUtils::amrex_tt<amrex_real>::vtk_type_enum ();
232+ metadata->CoordinateType = InSituUtils::amrex_tt<amrex_real>::svtk_type_enum ();
233233 metadata->StaticMesh = 0 ;
234234
235235 // TODO
@@ -318,14 +318,14 @@ int AmrDataAdaptor::GetMeshMetadata(unsigned int id,
318318 std::string arrayName = desc.name (j);
319319 metadata->ArrayName .push_back (arrayName);
320320 metadata->ArrayComponents .push_back (1 );
321- metadata->ArrayType .push_back (InSituUtils::amrex_tt<amrex_real>::vtk_type_enum ());
321+ metadata->ArrayType .push_back (InSituUtils::amrex_tt<amrex_real>::svtk_type_enum ());
322322
323323 if (itype.cellCentered ())
324- metadata->ArrayCentering .push_back (vtkDataObject ::CELL);
324+ metadata->ArrayCentering .push_back (svtkDataObject ::CELL);
325325 else if (itype.nodeCentered ())
326- metadata->ArrayCentering .push_back (vtkDataObject ::POINT);
326+ metadata->ArrayCentering .push_back (svtkDataObject ::POINT);
327327 else
328- metadata->ArrayCentering .push_back (vtkDataObject ::FIELD);
328+ metadata->ArrayCentering .push_back (svtkDataObject ::FIELD);
329329 }
330330
331331 }
@@ -557,8 +557,8 @@ int AmrDataAdaptor::GetNumberOfArrays(const std::string &meshName,
557557 return -1 ;
558558 }
559559
560- if ((association != vtkDataObject ::POINT) &&
561- (association != vtkDataObject ::CELL))
560+ if ((association != svtkDataObject ::POINT) &&
561+ (association != svtkDataObject ::CELL))
562562 {
563563 SENSEI_ERROR (" Invalid association " << association)
564564 return -1 ;
@@ -590,7 +590,7 @@ int AmrDataAdaptor::GetArrayName(const std::string &meshName,
590590 if (this ->Internals ->SimMetadata .GetName (association, index, arrayName))
591591 {
592592 SENSEI_ERROR (" No array named \" " << arrayName << " \" in "
593- << sensei::VTKUtils ::GetAttributesName (association)
593+ << sensei::SVTKUtils ::GetAttributesName (association)
594594 << " data" )
595595 return -1 ;
596596 }
@@ -603,7 +603,7 @@ int AmrDataAdaptor::GetArrayName(const std::string &meshName,
603603
604604// -----------------------------------------------------------------------------
605605int AmrDataAdaptor::GetMesh (const std::string &meshName,
606- bool structureOnly, vtkDataObject *&mesh)
606+ bool structureOnly, svtkDataObject *&mesh)
607607{
608608 amrex::ignore_unused (structureOnly);
609609
@@ -626,8 +626,8 @@ int AmrDataAdaptor::GetMesh(const std::string &meshName,
626626
627627 unsigned int nLevels = InSituUtils::NumActiveLevels (levels);
628628
629- // initialize new vtk datasets
630- vtkOverlappingAMR *amrMesh = vtkOverlappingAMR ::New ();
629+ // initialize new svtk datasets
630+ svtkOverlappingAMR *amrMesh = svtkOverlappingAMR ::New ();
631631#if SENSEI_VERSION_MAJOR < 3
632632 Internals->ManagedObjects .push_back (amrMesh);
633633#endif
@@ -685,12 +685,12 @@ int AmrDataAdaptor::GetMesh(const std::string &meshName,
685685 int cboxLo[3 ] = {AMREX_ARLIM (cbox.loVect ())};
686686 int cboxHi[3 ] = {AMREX_ARLIM (cbox.hiVect ())};
687687
688- // vtk 's representation of box metadata
689- vtkAMRBox block (cboxLo, cboxHi);
688+ // svtk 's representation of box metadata
689+ svtkAMRBox block (cboxLo, cboxHi);
690690 amrMesh->SetAMRBox (i, j, block);
691691 amrMesh->SetAMRBlockSourceIndex (i, j, gid++);
692692
693- // skip building a vtk amrMesh for the non local boxes
693+ // skip building a svtk amrMesh for the non local boxes
694694 if (dmap[j] != rank)
695695 continue ;
696696
@@ -705,14 +705,14 @@ int AmrDataAdaptor::GetMesh(const std::string &meshName,
705705 int nboxLo[3 ] = {AMREX_ARLIM (nbox.loVect ())};
706706 int nboxHi[3 ] = {AMREX_ARLIM (nbox.hiVect ())};
707707
708- // new vtk uniform amrMesh, node centered
709- vtkUniformGrid *ug = vtkUniformGrid ::New ();
708+ // new svtk uniform amrMesh, node centered
709+ svtkUniformGrid *ug = svtkUniformGrid ::New ();
710710 ug->SetOrigin (origin);
711711 ug->SetSpacing (spacing);
712712 ug->SetExtent (nboxLo[0 ], nboxHi[0 ],
713713 nboxLo[1 ], nboxHi[1 ], nboxLo[2 ], nboxHi[2 ]);
714714
715- // pass the block into vtk
715+ // pass the block into svtk
716716 amrMesh->SetDataSet (i, j, ug);
717717 ug->Delete ();
718718 }
@@ -722,7 +722,7 @@ int AmrDataAdaptor::GetMesh(const std::string &meshName,
722722}
723723
724724// -----------------------------------------------------------------------------
725- int AmrDataAdaptor::AddGhostCellsArray (vtkDataObject * mesh,
725+ int AmrDataAdaptor::AddGhostCellsArray (svtkDataObject * mesh,
726726 const std::string &meshName)
727727{
728728 sensei::TimeEvent<64 > event (" AmrDataAdaptor::AddGhostCellsArray" );
@@ -733,7 +733,7 @@ int AmrDataAdaptor::AddGhostCellsArray(vtkDataObject* mesh,
733733 return -1 ;
734734 }
735735
736- vtkOverlappingAMR *amrMesh = dynamic_cast <vtkOverlappingAMR *>(mesh);
736+ svtkOverlappingAMR *amrMesh = dynamic_cast <svtkOverlappingAMR *>(mesh);
737737 if (!amrMesh)
738738 {
739739 SENSEI_ERROR (" Invalid mesh type "
@@ -780,7 +780,7 @@ int AmrDataAdaptor::AddGhostCellsArray(vtkDataObject* mesh,
780780 if (dMap[j] != rank)
781781 continue ;
782782
783- vtkUniformGrid *blockMesh = amrMesh->GetDataSet (i, j);
783+ svtkUniformGrid *blockMesh = amrMesh->GetDataSet (i, j);
784784
785785 if (!blockMesh)
786786 {
@@ -790,24 +790,24 @@ int AmrDataAdaptor::AddGhostCellsArray(vtkDataObject* mesh,
790790
791791 long nCells = blockMesh->GetNumberOfCells ();
792792
793- // transfer mask array into vtk
794- vtkUnsignedCharArray *ga = vtkUnsignedCharArray ::New ();
795- ga->SetName (" vtkGhostType " );
793+ // transfer mask array into svtk
794+ svtkUnsignedCharArray *ga = svtkUnsignedCharArray ::New ();
795+ ga->SetName (" svtkGhostType " );
796796 ga->SetArray (mask[j], nCells, 0 );
797797 blockMesh->GetCellData ()->AddArray (ga);
798798 ga->Delete ();
799799
800800 // for debug can visualize the ghost cells
801801 // FIXME -- a bug in Catalyst ignores internal ghost zones
802- // when using the VTK writrer. Until that bug gets fixed, one
802+ // when using the SVTK writrer. Until that bug gets fixed, one
803803 // can manually inject this copy using a PV Python filter
804- ga = vtkUnsignedCharArray ::New ();
804+ ga = svtkUnsignedCharArray ::New ();
805805 ga->SetName (" GhostType" );
806806 ga->SetArray (mask[j], nCells, 1 );
807807 blockMesh->GetCellData ()->AddArray (ga);
808808 ga->Delete ();
809809
810- // because VTK takes ownership
810+ // because SVTK takes ownership
811811 mask[j] = nullptr ;
812812 }
813813 }
@@ -816,7 +816,7 @@ int AmrDataAdaptor::AddGhostCellsArray(vtkDataObject* mesh,
816816}
817817
818818// -----------------------------------------------------------------------------
819- int AmrDataAdaptor::AddGhostNodesArray (vtkDataObject *mesh,
819+ int AmrDataAdaptor::AddGhostNodesArray (svtkDataObject *mesh,
820820 const std::string &meshName)
821821{
822822 amrex::ignore_unused (mesh);
@@ -834,7 +834,7 @@ int AmrDataAdaptor::AddGhostNodesArray(vtkDataObject *mesh,
834834}
835835
836836// -----------------------------------------------------------------------------
837- int AmrDataAdaptor::AddArray (vtkDataObject * mesh, const std::string &meshName,
837+ int AmrDataAdaptor::AddArray (svtkDataObject * mesh, const std::string &meshName,
838838 int association, const std::string &arrayName)
839839{
840840 sensei::TimeEvent<64 > event (" AmrDataAdaptor::AddArray" );
@@ -848,7 +848,7 @@ int AmrDataAdaptor::AddArray(vtkDataObject* mesh, const std::string &meshName,
848848 return -1 ;
849849 }
850850
851- vtkOverlappingAMR *amrMesh = dynamic_cast <vtkOverlappingAMR *>(mesh);
851+ svtkOverlappingAMR *amrMesh = dynamic_cast <svtkOverlappingAMR *>(mesh);
852852 if (!amrMesh)
853853 {
854854 SENSEI_ERROR (" Invalid mesh type "
@@ -861,8 +861,8 @@ int AmrDataAdaptor::AddArray(vtkDataObject* mesh, const std::string &meshName,
861861 return -1 ;
862862 }
863863
864- if ((association != vtkDataObject ::CELL) &&
865- (association != vtkDataObject ::POINT))
864+ if ((association != svtkDataObject ::CELL) &&
865+ (association != svtkDataObject ::POINT))
866866 {
867867 SENSEI_ERROR (" Invalid association " << association)
868868 return -1 ;
@@ -878,7 +878,7 @@ int AmrDataAdaptor::AddArray(vtkDataObject* mesh, const std::string &meshName,
878878 if (this ->Internals ->SimMetadata .GetIndex (arrayName, association, fab, comp))
879879 {
880880 SENSEI_ERROR (" Failed to locate descriptor for "
881- << sensei::VTKUtils ::GetAttributesName (association)
881+ << sensei::SVTKUtils ::GetAttributesName (association)
882882 << " data array \" " << arrayName << " \" " )
883883 return -1 ;
884884 }
@@ -894,8 +894,8 @@ int AmrDataAdaptor::AddArray(vtkDataObject* mesh, const std::string &meshName,
894894 amrex::MultiFab& state = levels[i]->get_new_data (fab);
895895 unsigned int ng = state.nGrow ();
896896
897- if (!((association == vtkDataObject ::CELL) && state.is_cell_centered ()) &&
898- !((association == vtkDataObject ::POINT) && state.is_nodal ()))
897+ if (!((association == svtkDataObject ::CELL) && state.is_cell_centered ()) &&
898+ !((association == svtkDataObject ::POINT) && state.is_nodal ()))
899899 {
900900 SENSEI_ERROR (" association does not match MultiFAB centering" )
901901 return -1 ;
@@ -926,7 +926,7 @@ int AmrDataAdaptor::AddArray(vtkDataObject* mesh, const std::string &meshName,
926926 int cboxLo[3 ] = {AMREX_ARLIM (cbox.loVect ())};
927927 int cboxHi[3 ] = {AMREX_ARLIM (cbox.hiVect ())};
928928
929- // skip building a vtk mesh for the non local boxes
929+ // skip building a svtk mesh for the non local boxes
930930 if (dmap[j] != rank)
931931 continue ;
932932
@@ -938,7 +938,7 @@ int AmrDataAdaptor::AddArray(vtkDataObject* mesh, const std::string &meshName,
938938 int nboxHi[3 ] = {AMREX_ARLIM (nbox.hiVect ())};
939939
940940 // get the block mesh
941- vtkUniformGrid *ug = amrMesh->GetDataSet (i, j);
941+ svtkUniformGrid *ug = amrMesh->GetDataSet (i, j);
942942
943943 // node centered size
944944 long nlen = 1 ;
@@ -953,9 +953,9 @@ int AmrDataAdaptor::AddArray(vtkDataObject* mesh, const std::string &meshName,
953953 // pointer to the data
954954 amrex_real *pcd = state[j].dataPtr (comp);
955955
956- // allocate vtk array
957- InSituUtils::amrex_tt<amrex_real>::vtk_type *da =
958- InSituUtils::amrex_tt<amrex_real>::vtk_type ::New ();
956+ // allocate svtk array
957+ InSituUtils::amrex_tt<amrex_real>::svtk_type *da =
958+ InSituUtils::amrex_tt<amrex_real>::svtk_type ::New ();
959959
960960 // set component name
961961 da->SetName (arrayName.c_str ());
@@ -981,15 +981,15 @@ int AmrDataAdaptor::AddArray(vtkDataObject* mesh, const std::string &meshName,
981981
982982#if defined(SENSEI_DEBUG)
983983 // mark level id
984- vtkFloatArray *la = vtkFloatArray ::New ();
984+ svtkFloatArray *la = svtkFloatArray ::New ();
985985 la->SetName (" amrex_level_id" );
986986 la->SetNumberOfTuples (clen);
987987 la->Fill (i);
988988 ug->GetCellData ()->AddArray (la);
989989 la->Delete ();
990990
991991 // mark mpi rank
992- vtkFloatArray *ra = vtkFloatArray ::New ();
992+ svtkFloatArray *ra = svtkFloatArray ::New ();
993993 ra->SetName (" amrex_mpi_rank" );
994994 ra->SetNumberOfTuples (clen);
995995 ra->Fill (rank);
0 commit comments