Gitlab.kitware.com will be offline between 8am and midnight (EST/UTC-0500) on Saturday, December 15th.

Commit 239b8126 authored by Burlen Loring's avatar Burlen Loring

Merge branch 'request_specific_meshes' into 'master'

Request specific meshes

See merge request !55
parents 9417b0dc f56fe0f9
......@@ -15,7 +15,7 @@ endif()
if (NOT MSVC)
if (NOT CMAKE_CXX_FLAGS)
set(tmp "-fPIC -std=c++11 -Wall -Wextra")
set(tmp "-fPIC -std=c++11 -Wall -Wextra -fpermissive")
if (BUILD_STATIC_EXECS)
set(tmp "${tmp} -static -static-libgcc -static-libstdc++ -pthread -Wl,-Bstatic")
endif()
......
......@@ -64,7 +64,7 @@ if (ENABLE_PYTHON)
file(STRINGS ${depend_file} depends)
add_custom_command(
OUTPUT ${output_file}
COMMAND ${swig_cmd} -c++ -python -threads -w341,325,401,504
COMMAND ${swig_cmd} -c++ -python -w341,325,401,504
-DSWIG_TYPE_TABLE=senseiPython
-I${MPI4PY_INCLUDE_DIR} -I${CMAKE_BINARY_DIR}
-I${CMAKE_CURRENT_BINARY_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}
......
......@@ -2,9 +2,9 @@
set enabled="1" on analyses you wish to enable -->
<sensei>
<!-- Custom Analyses -->
<analysis type="histogram" array="pressure" association="cell" bins="10" enabled="1" />
<analysis type="histogram" array="density" association="cell" bins="10" enabled="1" />
<analysis type="histogram" array="temperature" association="cell" bins="10" enabled="1" />
<analysis type="histogram" mesh="mesh" array="pressure" association="cell" bins="10" enabled="1" />
<analysis type="histogram" mesh="mesh" array="density" association="cell" bins="10" enabled="1" />
<analysis type="histogram" mesh="mesh" array="temperature" association="cell" bins="10" enabled="1" />
<!-- ADIOS Analyses -->
<analysis type="adios" filename="3D_Grid.bp" method="MPI" enabled ="0"/>
......
<sensei>
<!-- Custom Analyses -->
<analysis type="histogram" array="v" association="point"
bins="10" enabled="1" />
<analysis type="histogram" mesh="bodies" array="v" association="point"
bins="10" enabled="0" />
<!-- Available with ENABLE_VTK_XMLP -->
<analysis type="PosthocIO" array="vx" association="point"
enabled="0" period="1" mode="vtkXmlP" output_dir="./" />
<analysis type="PosthocIO" mode="paraview" output_dir="./" enabled="0">
<mesh name="bodies">
<point_arrays> ids, m, v, f </point_arrays>
</mesh>
</analysis>
<!-- Avalailable with ENABLE_CATALYST -->
<analysis type="catalyst" pipeline="pythonscript"
filename="newton_catalyst.py" enabled="0" />
filename="../sensei/miniapps/newton/newton_catalyst.py" enabled="1" />
<!-- Available with ENABLE_LIBSIM -->
<analysis type="libsim" plots="Pseudocolor" plotvars="ids"
......
......@@ -2,13 +2,17 @@
set enabled="1" on analyses you wish to enable -->
<sensei>
<!-- Custom Analyses-->
<analysis type="PosthocIO" array="data" association="cell"
enabled="0" period="1" mode="vtkXmlP" output_dir="./" />
<analysis type="PosthocIO"
output_dir="./" file_name="output" mode="visit" enabled="1">
<mesh name="mesh">
<cell_arrays> data </cell_arrays>
</mesh>
</analysis>
<analysis type="histogram" array="data" association="cell"
<analysis type="histogram" mesh="mesh" array="data" association="cell"
bins="10" enabled="1" />
<analysis type="autocorrelation" array="data" association="cell" window="10"
<analysis type="autocorrelation" mesh="mesh" array="data" association="cell" window="10"
k-max="3" enabled="1" />
<!-- VTK-m Analyses -->
......
This diff is collapsed.
......@@ -120,6 +120,7 @@ int main(int argc, char **argv)
// close the ADIOS stream
dataAdaptor->Close();
analysisAdaptor->Finalize();
// we must force these to be destroyed before mpi finalize
// some of the adaptors make MPI calls in the destructor
......
......@@ -2,8 +2,3 @@ if(ENABLE_ADIOS)
add_executable(ADIOSAnalysisEndPoint ADIOSAnalysisEndPoint.cxx)
target_link_libraries(ADIOSAnalysisEndPoint PRIVATE opts mpi adios sensei timer)
endif()
if(ENABLE_ADIOS AND ENABLE_VTK_XMLP AND NOT ENABLE_LIBSIM)
add_executable(PosthocIOEndPoint PosthocIOEndPoint.cxx)
target_link_libraries(PosthocIOEndPoint PRIVATE opts mpi adios sensei timer)
endif()
......@@ -297,9 +297,146 @@ def check_arg(dic, arg, dfl=None, req=True):
return True
return True
class data_adaptor:
def __init__(self):
# data from sim
self.arrays = {}
self.points = None
self.cells = None
# connect all the callbacks
self.pda = sensei.ProgrammableDataAdaptor.New()
self.pda.SetGetNumberOfMeshesCallback(self.get_number_of_meshes())
self.pda.SetGetMeshNameCallback(self.get_mesh_name())
self.pda.SetGetNumberOfArraysCallback(self.get_number_of_arrays())
self.pda.SetGetArrayNameCallback(self.get_array_name())
self.pda.SetGetMeshCallback(self.get_mesh())
self.pda.SetAddArrayCallback(self.add_array())
self.pda.SetReleaseDataCallback(self.release_data())
def __getattr__(self, *args):
# forward calls to pda
return self.pda.__getattribute__(*args)
def base(self):
return self.pda
def update(self, i,t,ids,x,y,z,m,vx,vy,vz,fx,fy,fz):
# update the state arrays
self.set_array_1(ids, 'ids')
self.set_array_1(m, 'm')
self.set_array_3(vx,vy,vz, 'v')
self.set_array_3(fx,fy,fz, 'f')
self.set_geometry(x,y,z)
self.SetDataTime(t)
self.SetDataTimeStep(i)
def set_array_1(self, vals, name):
arr = vtknp.numpy_to_vtk(vals, 1)
arr.SetName(name)
self.arrays[name] = arr
def set_array_3(self, vx,vy,vz, name):
# vector
nx = len(x)
vxyz = np.zeros(3*nx, dtype=vx.dtype)
vxyz[::3] = vx
vxyz[1::3] = vy
vxyz[2::3] = vz
vtkv = vtknp.numpy_to_vtk(vxyz, deep=1)
vtkv.SetName(name)
self.arrays[name] = vtkv
# mag
mname = 'mag%s'%(name)
mv = np.sqrt(vx**2 + vy**2 + vz**2)
vtkmv = vtknp.numpy_to_vtk(mv, deep=1)
vtkmv.SetName(mname)
self.arrays[mname] = vtkmv
def set_geometry(self, x,y,z):
# points
nx = len(x)
xyz = np.zeros(3*nx, dtype=x.dtype)
xyz[::3] = x[:]
xyz[1::3] = y[:]
xyz[2::3] = z[:]
vxyz = vtknp.numpy_to_vtk(xyz, deep=1)
vxyz.SetNumberOfComponents(3)
vxyz.SetNumberOfTuples(nx)
pts = vtk.vtkPoints()
pts.SetData(vxyz)
self.points = pts
# cells
cids = np.empty(2*nx, dtype=np.int32)
cids[::2] = 1
cids[1::2] = np.arange(0,nx,dtype=np.int32)
cells = vtk.vtkCellArray()
cells.SetCells(nx, vtknp.numpy_to_vtk(cids, \
deep=1, array_type=vtk.VTK_ID_TYPE))
self.cells = cells
def validate_mesh_name(self, mesh_name):
if mesh_name != "bodies":
raise RuntimeError('no mesh named "%s"'%(mesh_name))
def get_number_of_meshes(self):
def callback():
return 1
return callback
def get_mesh_name(self):
def callback(idx):
if idx != 0: raise RuntimeError('no mesh %d'%(idx))
return 'bodies'
return callback
def get_number_of_arrays(self):
def callback(mesh_name, assoc):
self.validate_mesh_name(mesh_name)
return len(self.arrays.keys()) \
if assoc == vtk.vtkDataObject.POINT else 0
return callback
def get_array_name(self):
def callback(mesh_name, assoc, idx):
self.validate_mesh_name(mesh_name)
return self.arrays.keys()[idx] \
if assoc == vtk.vtkDataObject.POINT else 0
return callback
def get_mesh(self):
def callback(mesh_name, structure_only):
self.validate_mesh_name(mesh_name)
# local bodies
pd = vtk.vtkPolyData()
if not structure_only:
pd.SetPoints(self.points)
pd.SetVerts(self.cells)
# global dataset
mb = vtk.vtkMultiBlockDataSet()
mb.SetNumberOfBlocks(n_ranks)
mb.SetBlock(rank, pd)
return mb
return callback
def add_array(self):
def callback(mesh, mesh_name, assoc, array_name):
self.validate_mesh_name(mesh_name)
if assoc != vtk.vtkDataObject.POINT:
raise RuntimeError('no array named "%s" in cell data'%(array_name))
pd = mesh.GetBlock(rank)
pd.GetPointData().AddArray(self.arrays[array_name])
return callback
def release_data(self):
def callback():
self.arrays = {}
self.points = None
self.cells = None
return callback
class analysis_adaptor:
def __init__(self):
self.DataAdaptor = sensei.VTKDataAdaptor.New()
self.DataAdaptor = data_adaptor()
self.AnalysisAdaptor = None
def initialize(self, analysis, args=''):
......@@ -317,13 +454,14 @@ class analysis_adaptor:
self.AnalysisAdaptor = sensei.CatalystAnalysisAdaptor.New()
self.AnalysisAdaptor.AddPythonScriptPipeline(args['script'])
# VTK I/O
elif analysis == 'posthoc':
if check_arg(args,'file','newton') and check_arg(args,'dir','./') \
and check_arg(args,'mode','0') and check_arg(args,'freq','1'):
self.AnalysisAdaptor = sensei.VTKPosthocIO.New()
self.AnalysisAdaptor.Initialize(comm, args['dir'],args['file'],\
[], ['ids','fx','fy','fz','f','vx','vy','vz','v','m'], \
int(args['mode']), int(args['freq']))
#elif analysis == 'posthoc':
# if check_arg(args,'file','newton') and check_arg(args,'dir','./') \
# and check_arg(args,'mode','0') and check_arg(args,'freq','1'):
# # TODO -- mesh name API updates
# self.AnalysisAdaptor = sensei.VTKPosthocIO.New()
# self.AnalysisAdaptor.Initialize(comm, args['dir'],args['file'],\
# [], ['ids','fx','fy','fz','f','vx','vy','vz','v','m'], \
# int(args['mode']), int(args['freq']))
# Libisim, ADIOS, etc
elif analysis == 'configurable':
if check_arg(args,'config'):
......@@ -335,31 +473,31 @@ class analysis_adaptor:
sys.exit(-1)
def finalize(self):
if self.Analysis == 'posthoc':
self.AnalysisAdaptor.Finalize()
self.AnalysisAdaptor.Finalize()
def update(self, i,t,ids,x,y,z,m,vx,vy,vz,fx,fy,fz):
status('% 5d\n'%(i)) if i > 0 and i % 70 == 0 else None
status('.')
node = points_to_polydata(ids,x,y,z,m,vx,vy,vz,fx,fy,fz)
mb = vtk.vtkMultiBlockDataSet()
mb.SetNumberOfBlocks(n_ranks)
mb.SetBlock(rank, node)
#node = points_to_polydata(ids,x,y,z,m,vx,vy,vz,fx,fy,fz)
#
#mb = vtk.vtkMultiBlockDataSet()
#mb.SetNumberOfBlocks(n_ranks)
#mb.SetBlock(rank, node)
self.DataAdaptor.update(i,t,ids,x,y,z,m,vx,vy,vz,fx,fy,fz)
self.DataAdaptor.SetDataTime(t)
self.DataAdaptor.SetDataTimeStep(i)
self.DataAdaptor.SetDataObject(mb)
#self.DataAdaptor.SetDataObject(mb)
self.AnalysisAdaptor.Execute(self.DataAdaptor)
self.AnalysisAdaptor.Execute(self.DataAdaptor.base())
self.DataAdaptor.ReleaseData()
def status(msg):
sys.stderr.write(msg if rank == 0 else '')
if __name__ == '__main__':
# parse the command line
parser = argparse.ArgumentParser()
......
......@@ -6,6 +6,8 @@ from paraview import lookuptable
paraview.simple.lookuptable = lookuptable
paraview.simple._lutReader = lookuptable.vtkPVLUTReader()
import sys
#--------------------------------------------------------------
# Code generated from cpstate.py to create the CoProcessor.
# ParaView 5.3.0-78-gd6e7170 64 bits
......@@ -54,7 +56,7 @@ def CreateCoProcessor():
# create a new 'PVD Reader'
# create a producer from a simulation input
ptdatamasterpvd = coprocessor.CreateProducer(datadescription, 'input')
ptdatamasterpvd = coprocessor.CreateProducer(datadescription, 'bodies')
# create a new 'Threshold'
threshold1 = Threshold(Input=ptdatamasterpvd)
......@@ -177,7 +179,7 @@ def CreateCoProcessor():
coprocessor = CoProcessor()
# these are the frequencies at which the coprocessor updates.
freqs = {'input': [1, 1, 1, 1, 1]}
freqs = {'bodies': [1, 1, 1, 1, 1]}
coprocessor.SetUpdateFrequencies(freqs)
return coprocessor
......
......@@ -23,12 +23,13 @@ void initialize(MPI_Comm world,
int* gid,
int* from_x, int* from_y, int* from_z,
int* to_x, int* to_y, int* to_z,
int* shape, int ghostLevels,
const std::string& config_file)
{
(void)window;
timer::MarkEvent mark("oscillators::bridge::initialize");
GlobalDataAdaptor = vtkSmartPointer<oscillators::DataAdaptor>::New();
GlobalDataAdaptor->Initialize(nblocks);
GlobalDataAdaptor->Initialize(nblocks, shape, ghostLevels);
GlobalDataAdaptor->SetDataTimeStep(-1);
for (size_t cc=0; cc < n_local_blocks; ++cc)
......@@ -73,8 +74,12 @@ void finalize(size_t k_max, size_t nblocks)
(void)k_max;
(void)nblocks;
timer::MarkStartEvent("oscillators::bridge::finalize");
GlobalAnalysisAdaptor->Finalize();
GlobalAnalysisAdaptor = NULL;
GlobalDataAdaptor = NULL;
timer::MarkEndEvent("oscillators::bridge::finalize");
}
......
......@@ -14,6 +14,7 @@ namespace bridge
int* gid,
int* from_x, int* from_y, int* from_z,
int* to_x, int* to_y, int* to_z,
int* shape, int ghostLevels,
const std::string& config_file);
void set_data(int gid, float* data);
......
This diff is collapsed.
......@@ -3,6 +3,8 @@
#include <sensei/DataAdaptor.h>
class vtkDataArray;
namespace oscillators
{
......@@ -16,7 +18,7 @@ public:
///
/// This initializes the data adaptor. This must be called once per simulation run.
/// @param nblocks is the total number of blocks in the simulation run.
void Initialize(size_t nblocks);
void Initialize(size_t nblocks, const int *shape, int ghostLevels);
/// @brief Set the extents for local blocks.
void SetBlockExtent(int gid,
......@@ -28,18 +30,36 @@ public:
/// Set data for a specific block.
void SetBlockData(int gid, float* data);
vtkDataObject* GetMesh(bool structure_only=false) override;
bool AddArray(vtkDataObject* mesh, int association, const std::string& arrayname) override;
unsigned int GetNumberOfArrays(int) override { return 1; }
std::string GetArrayName(int, unsigned int index) override
{ return index==0? "data" : std::string(); }
void ReleaseData() override;
// SENSEI API
int GetNumberOfMeshes(unsigned int &numMeshes) override;
int GetMeshName(unsigned int id, std::string &meshName) override;
int GetMesh(const std::string &meshName, bool structureOnly,
vtkDataObject *&mesh) override;
int AddArray(vtkDataObject* mesh, const std::string &meshName,
int association, const std::string &arrayName) override;
int GetNumberOfArrays(const std::string &meshName, int association,
unsigned int &numberOfArrays) override;
int GetArrayName(const std::string &meshName, int association,
unsigned int index, std::string &arrayName) override;
int GetMeshHasGhostCells(const std::string &meshName, int &nLayers) override;
int AddGhostCellsArray(vtkDataObject* mesh, const std::string &meshName) override;
int ReleaseData() override;
protected:
DataAdaptor();
~DataAdaptor();
vtkDataObject* GetBlockMesh(int gid);
vtkDataObject* GetUnstructuredMesh(int gid, bool structureOnly);
vtkDataArray* CreateGhostCellsArray(int cc) const;
private:
DataAdaptor(const DataAdaptor&); // not implemented.
......
......@@ -96,6 +96,7 @@ int main(int argc, char** argv)
size_t window = 10;
size_t k_max = 3;
int threads = 1;
int ghostLevels = 0;
std::string config_file;
std::string out_prefix = "";
Options ops(argc, argv);
......@@ -112,6 +113,7 @@ int main(int argc, char** argv)
>> Option( "t-end", t_end, "end time")
>> Option('j', "jobs", threads, "number of threads to use")
>> Option('o', "output", out_prefix, "prefix to save output")
>> Option('g', "ghost levels", ghostLevels, "Number of ghost levels")
;
bool sync = ops >> Present("sync", "synchronize after each time step");
bool log = ops >> Present("log", "generate full time and memory usage log");
......@@ -176,6 +178,9 @@ int main(int argc, char** argv)
to_x, to_y, to_z;
diy::RegularDecomposer<Bounds>::BoolVector share_face, wrap;
diy::RegularDecomposer<Bounds>::CoordinateVector ghosts = {ghostLevels, ghostLevels, ghostLevels};
// decompose the domain
diy::decompose(3, world.rank(), domain, assigner,
[&](int gid, const Bounds&, const Bounds& bounds, const Bounds& domain, const Link& link)
......@@ -192,7 +197,8 @@ int main(int argc, char** argv)
to_x.push_back(bounds.max[0]);
to_y.push_back(bounds.max[1]);
to_z.push_back(bounds.max[2]);
});
},
share_face, wrap, ghosts);
timer::MarkEndEvent("oscillators::initialize");
......@@ -203,6 +209,7 @@ int main(int argc, char** argv)
&gids[0],
&from_x[0], &from_y[0], &from_z[0],
&to_x[0], &to_y[0], &to_z[0],
&shape[0], ghostLevels,
config_file);
#else
init_analysis(world, window, gids.size(),
......
......@@ -55,8 +55,10 @@ void bridge_update(int tstep, double time, double *pressure, double* temperature
//-----------------------------------------------------------------------------
void bridge_finalize()
{
BridgeInternals::GlobalAnalysisAdaptor->Finalize();
BridgeInternals::GlobalAnalysisAdaptor = NULL;
BridgeInternals::GlobalDataAdaptor = NULL;
timer::PrintLog(std::cout, BridgeInternals::comm);
}
#include "DataAdaptor.h"
#include "Error.h"
#include "vtkCellData.h"
#include "vtkDataObject.h"
#include "vtkDoubleArray.h"
#include "vtkImageData.h"
#include "vtkInformation.h"
#include "vtkObjectFactory.h"
#include <vtkCellData.h>
#include <vtkDataObject.h>
#include <vtkDoubleArray.h>
#include <vtkImageData.h>
#include <vtkInformation.h>
#include <vtkObjectFactory.h>
#include <limits>
namespace parallel3d
{
......@@ -15,6 +18,19 @@ senseiNewMacro(DataAdaptor);
//-----------------------------------------------------------------------------
DataAdaptor::DataAdaptor()
{
this->CellExtent[0] = std::numeric_limits<int>::max();
this->CellExtent[1] = std::numeric_limits<int>::min();
this->CellExtent[2] = std::numeric_limits<int>::max();
this->CellExtent[3] = std::numeric_limits<int>::min();
this->CellExtent[4] = std::numeric_limits<int>::max();
this->CellExtent[5] = std::numeric_limits<int>::min();
this->WholeExtent[0] = std::numeric_limits<int>::max();
this->WholeExtent[1] = std::numeric_limits<int>::min();
this->WholeExtent[2] = std::numeric_limits<int>::max();
this->WholeExtent[3] = std::numeric_limits<int>::min();
this->WholeExtent[4] = std::numeric_limits<int>::max();
this->WholeExtent[5] = std::numeric_limits<int>::min();
}
//-----------------------------------------------------------------------------
......@@ -23,12 +39,10 @@ DataAdaptor::~DataAdaptor()
}
//-----------------------------------------------------------------------------
void DataAdaptor::Initialize(
int g_x, int g_y, int g_z,
int l_x, int l_y, int l_z,
void DataAdaptor::Initialize(int g_x, int g_y, int g_z, int l_x, int l_y, int l_z,
uint64_t start_extents_x, uint64_t start_extents_y, uint64_t start_extents_z,
int tot_blocks_x, int tot_blocks_y, int tot_blocks_z,
int block_id_x, int block_id_y, int block_id_z)
int tot_blocks_x, int tot_blocks_y, int tot_blocks_z, int block_id_x,
int block_id_y, int block_id_z)
{
(void)tot_blocks_x;
(void)tot_blocks_y;
......@@ -36,6 +50,7 @@ void DataAdaptor::Initialize(
(void)block_id_x;
(void)block_id_y;
(void)block_id_z;
// we only really need to save the local extents for our current example. So
// we'll just save that.
this->CellExtent[0] = start_extents_x;
......@@ -52,6 +67,7 @@ void DataAdaptor::Initialize(
this->WholeExtent[3] = g_y;
this->WholeExtent[4] = 0;
this->WholeExtent[5] = g_z;
this->GetInformation()->Set(vtkDataObject::DATA_EXTENT(),
this->WholeExtent, 6);
}
......@@ -74,85 +90,156 @@ void DataAdaptor::ClearArrays()
}
//-----------------------------------------------------------------------------
vtkDataObject* DataAdaptor::GetMesh(bool vtkNotUsed(structure_only))
int DataAdaptor::GetNumberOfArrays(const std::string &meshName,
int association, unsigned int &numberOfArrays)
{
if (!this->Mesh)
numberOfArrays = 0;
if (meshName != "mesh")
{
this->Mesh = vtkSmartPointer<vtkImageData>::New();
this->Mesh->SetExtent(
this->CellExtent[0], this->CellExtent[1] + 1,
this->CellExtent[2], this->CellExtent[3] + 1,
this->CellExtent[4], this->CellExtent[5] + 1);
SENSEI_ERROR("No mesh \"" << meshName << "\"")
return -1;
}
if (association == vtkDataObject::FIELD_ASSOCIATION_CELLS)
{
numberOfArrays = this->Variables.size();
}
return this->Mesh;
return 0;
}
//-----------------------------------------------------------------------------
bool DataAdaptor::AddArray(vtkDataObject* mesh, int association, const std::string& name)
int DataAdaptor::GetArrayName(const std::string &meshName, int association,
unsigned int index, std::string &arrayName)
{
if (association != vtkDataObject::FIELD_ASSOCIATION_CELLS || name.empty())
arrayName = "";
if (meshName != "mesh")
{
return false;
SENSEI_ERROR("No mesh \"" << meshName << "\"")
return -1;
}
VariablesType::iterator iterV = this->Variables.find(name);
if (iterV == this->Variables.end())
if (association != vtkDataObject::FIELD_ASSOCIATION_CELLS)
{
return false;
SENSEI_ERROR("No point data on mesh")
return -1;
}
if (index >= this->Variables.size())
{
SENSEI_ERROR("Index out of bounds")
return -1;
}
#ifndef NDEBUG
vtkImageData* image = vtkImageData::SafeDownCast(mesh);
#endif
assert(image != NULL);
ArraysType::iterator iterA = this->Arrays.find(iterV->first);
if (iterA == this->Arrays.end())
unsigned int count = 0;
VariablesType::iterator end = this->Variables.end();
VariablesType::iterator iter = this->Variables.begin();
for (; iter != end; ++iter, ++count)
{
vtkSmartPointer<vtkDoubleArray>& vtkarray = this->Arrays[iterV->first];
vtkarray = vtkSmartPointer<vtkDoubleArray>::New();
vtkarray->SetName(name.c_str());
const vtkIdType size = (this->CellExtent[1] - this->CellExtent[0] + 1) *
(this->CellExtent[3] - this->CellExtent[2] + 1) *
(this->CellExtent[5] - this->CellExtent[4] + 1);
assert(size == image->GetNumberOfCells());
vtkarray->SetArray(iterV->second, size, 1);
vtkImageData::SafeDownCast(mesh)->GetCellData()->AddArray(vtkarray);
return true;
if (count == index)
{
arrayName = iter->first;
return 0;
}
}
return true;
return 0;
}
//-----------------------------------------------------------------------------
unsigned int DataAdaptor::GetNumberOfArrays(int association)
int DataAdaptor::GetNumberOfMeshes(unsigned int &numMeshes)
{
return (association == vtkDataObject::FIELD_ASSOCIATION_CELLS)?
static_cast<unsigned int>(this->Variables.size()): 0;
numMeshes = 1;
return 0;
}
//-----------------------------------------------------------------------------
std::string DataAdaptor::GetArrayName(int association, unsigned int index)
int DataAdaptor::GetMeshName(unsigned int id, std::string &meshName)
{
if (id != 0)
{
SENSEI_ERROR("Mesh id is out of range. 1 mesh available.")
return -1;
}
meshName = "mesh";
return 0;
}
//-----------------------------------------------------------------------------
int DataAdaptor::GetMesh(const std::string &meshName, bool structureOnly,
vtkDataObject *&mesh)
{