Commit e9141154 authored by whitlocb's avatar whitlocb
Browse files

Added global node and cell ids for libsim unstructured meshes

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@23548 18c085ea-50e0-402c-830e-de6fd14e8384
parent 9540c472
/***************************************************************************** /*****************************************************************************
* *
* Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC * Copyright (c) 2000 - 2014, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory * Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911 * LLNL-CODE-442911
* All rights reserved. * All rights reserved.
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#include <vtkFloatArray.h> #include <vtkFloatArray.h>
#include <vtkDoubleArray.h> #include <vtkDoubleArray.h>
#include <vtkIdTypeArray.h> #include <vtkIdTypeArray.h>
#include <vtkIntArray.h>
#include <vtkLongArray.h> #include <vtkLongArray.h>
#include <vtkPointData.h> #include <vtkPointData.h>
#include <vtkPolyData.h> #include <vtkPolyData.h>
...@@ -115,7 +116,7 @@ using std::ostringstream; ...@@ -115,7 +116,7 @@ using std::ostringstream;
#include <simv2_VariableData.h> #include <simv2_VariableData.h>
#include <simv2_TypeTraits.hxx> #include <simv2_TypeTraits.hxx>
#include <simv2_DeleteEventObserver.h> #include <simv2_DeleteEventObserver.h>
#include <simv2_UnstructuredMesh.h>
vtkDataSet *SimV2_GetMesh_Curvilinear(visit_handle h); vtkDataSet *SimV2_GetMesh_Curvilinear(visit_handle h);
vtkDataSet *SimV2_GetMesh_Rectilinear(visit_handle h); vtkDataSet *SimV2_GetMesh_Rectilinear(visit_handle h);
...@@ -1265,6 +1266,118 @@ avtSimV2FileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md) ...@@ -1265,6 +1266,118 @@ avtSimV2FileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md)
#endif #endif
} }
#ifndef MDSERVER
// ****************************************************************************
// Method: PackageGlobalIdArray
//
// Purpose:
// Package the global cells/nodes as a VTK int array.
//
// Arguments:
// global : The data array.
// name : Then name of the data array we're making.
//
// Returns: A VTK int array with the global cell/node ids.
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Fri Jun 13 10:53:32 PDT 2014
//
// Modifications:
//
// ****************************************************************************
static vtkIntArray *
PackageGlobalIdArray(visit_handle global, const char *name)
{
vtkIntArray *arr = NULL;
// Get the global cell id information
int owner, dataType, nComps, nTuples = 0;
void *data = 0;
if(simv2_VariableData_getData(global, owner, dataType, nComps, nTuples, data))
{
arr = vtkIntArray::New();
arr->SetName(name);
arr->SetNumberOfTuples(nTuples);
if(dataType == VISIT_DATATYPE_INT)
memcpy(arr->GetVoidPointer(0), data, sizeof(int) * nTuples);
else
{
int *iptr = (int *)arr->GetVoidPointer(0);
const long *lptr = (const long *)data;
for(int i = 0; i < nTuples; ++i)
iptr[i] = lptr[i];
}
}
return arr;
}
// ****************************************************************************
// Method: CreateUnstructuredMeshGlobalCellIds
//
// Purpose:
// Creates global cell ids for unstructured mesh.
//
// Arguments:
// h : The handle to the unstructured mesh.
//
// Returns: A pointer to the VTK data array containing the ids.
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Fri Jun 13 10:47:37 PDT 2014
//
// Modifications:
//
// ****************************************************************************
static vtkIntArray *
CreateUnstructuredMeshGlobalCellIds(visit_handle h)
{
vtkIntArray *retval = NULL;
visit_handle globalCells = VISIT_INVALID_HANDLE;
if(simv2_UnstructuredMesh_getGlobalCellIds(h, &globalCells) == VISIT_OKAY)
{
retval = PackageGlobalIdArray(globalCells, "avtGlobalZoneIds");
}
return retval;
}
// ****************************************************************************
// Method: CreateUnstructuredMeshGlobalNodeIds
//
// Purpose:
// Creates global node ids for unstructured mesh.
//
// Arguments:
// h : The handle to the unstructured mesh.
//
// Returns: A pointer to the VTK data array containing the ids.
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Fri Jun 13 10:47:37 PDT 2014
//
// Modifications:
//
// ****************************************************************************
static vtkIntArray *
CreateUnstructuredMeshGlobalNodeIds(visit_handle h)
{
vtkIntArray *retval = NULL;
visit_handle globalNodes = VISIT_INVALID_HANDLE;
if(simv2_UnstructuredMesh_getGlobalNodeIds(h, &globalNodes) == VISIT_OKAY)
{
retval = PackageGlobalIdArray(globalNodes, "avtGlobalNodeIds");
}
return retval;
}
#endif
// **************************************************************************** // ****************************************************************************
// Method: avtSimV2FileFormat::GetMesh // Method: avtSimV2FileFormat::GetMesh
// //
...@@ -1283,6 +1396,8 @@ avtSimV2FileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md) ...@@ -1283,6 +1396,8 @@ avtSimV2FileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md)
// Creation: Thu Feb 5 11:50:58 PST 2009 // Creation: Thu Feb 5 11:50:58 PST 2009
// //
// Modifications: // Modifications:
// Brad Whitlock, Fri Jun 13 10:56:13 PDT 2014
// I added global nodes/cell support.
// //
// **************************************************************************** // ****************************************************************************
...@@ -1332,6 +1447,26 @@ avtSimV2FileFormat::GetMesh(int domain, const char *meshname) ...@@ -1332,6 +1447,26 @@ avtSimV2FileFormat::GetMesh(int domain, const char *meshname)
AUXILIARY_DATA_POLYHEDRAL_SPLIT, AUXILIARY_DATA_POLYHEDRAL_SPLIT,
timestep, domain, vr); timestep, domain, vr);
} }
else
{
// Try and add the global ids if we have not split the mesh.
vtkIntArray *globalCellIds = CreateUnstructuredMeshGlobalCellIds(h);
if(globalCellIds != NULL)
{
void_ref_ptr vr = void_ref_ptr(globalCellIds, avtVariableCache::DestructVTKObject);
cache->CacheVoidRef(meshname, AUXILIARY_DATA_GLOBAL_ZONE_IDS, timestep,
domain, vr);
}
vtkIntArray *globalNodeIds = CreateUnstructuredMeshGlobalNodeIds(h);
if(globalNodeIds != NULL)
{
void_ref_ptr vr = void_ref_ptr(globalNodeIds, avtVariableCache::DestructVTKObject);
cache->CacheVoidRef(meshname, AUXILIARY_DATA_GLOBAL_NODE_IDS, timestep,
domain, vr);
}
}
} }
break; break;
case VISIT_POINT_MESH: case VISIT_POINT_MESH:
......
/***************************************************************************** /*****************************************************************************
* *
* Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC * Copyright (c) 2000 - 2014, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory * Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911 * LLNL-CODE-442911
* All rights reserved. * All rights reserved.
......
...@@ -40,7 +40,7 @@ enhancements and bug-fixes that were added to this release.</p> ...@@ -40,7 +40,7 @@ enhancements and bug-fixes that were added to this release.</p>
<a name="Advanced_Features"></a> <a name="Advanced_Features"></a>
<p><b><font size="4">Advanced features added in version 2.8</font></b></p> <p><b><font size="4">Advanced features added in version 2.8</font></b></p>
<ul> <ul>
<li></li> <li>Libsim was enhanced so simulations can expose global node and cell ids for unstructured meshes.</li>
<li></li> <li></li>
</ul> </ul>
......
...@@ -112,6 +112,22 @@ VisIt_UnstructuredMesh_setGhostNodes(visit_handle obj, visit_handle gn) ...@@ -112,6 +112,22 @@ VisIt_UnstructuredMesh_setGhostNodes(visit_handle obj, visit_handle gn)
(obj,gn)); (obj,gn));
} }
int
VisIt_UnstructuredMesh_setGlobalCellIds(visit_handle obj, visit_handle gz)
{
VISIT_DYNAMIC_EXECUTE(UnstructuredMesh_setGlobalCellIds,
int, (visit_handle,visit_handle),
(obj,gz));
}
int
VisIt_UnstructuredMesh_setGlobalNodeIds(visit_handle obj, visit_handle gn)
{
VISIT_DYNAMIC_EXECUTE(UnstructuredMesh_setGlobalNodeIds,
int, (visit_handle,visit_handle),
(obj,gn));
}
int int
VisIt_UnstructuredMesh_getCoords(visit_handle obj, VisIt_UnstructuredMesh_getCoords(visit_handle obj,
int *ndims, int *coordMode, int *ndims, int *coordMode,
...@@ -155,6 +171,22 @@ VisIt_UnstructuredMesh_getGhostNodes(visit_handle obj, visit_handle *gn) ...@@ -155,6 +171,22 @@ VisIt_UnstructuredMesh_getGhostNodes(visit_handle obj, visit_handle *gn)
(obj,gn)); (obj,gn));
} }
int
VisIt_UnstructuredMesh_getGlobalCellIds(visit_handle obj, visit_handle *gz)
{
VISIT_DYNAMIC_EXECUTE(UnstructuredMesh_getGlobalCellIds,
int, (visit_handle,visit_handle*),
(obj,gz));
}
int
VisIt_UnstructuredMesh_getGlobalNodeIds(visit_handle obj, visit_handle *gn)
{
VISIT_DYNAMIC_EXECUTE(UnstructuredMesh_getGlobalNodeIds,
int, (visit_handle,visit_handle*),
(obj,gn));
}
/************************** Fortran callable routines *************************/ /************************** Fortran callable routines *************************/
/* maxlen 012345678901234567890123456789 */ /* maxlen 012345678901234567890123456789 */
#define F_VISITUCDMESHALLOC F77_ID(visitucdmeshalloc_,visitucdmeshalloc,VISITUCDMESHALLOC) #define F_VISITUCDMESHALLOC F77_ID(visitucdmeshalloc_,visitucdmeshalloc,VISITUCDMESHALLOC)
...@@ -166,12 +198,16 @@ VisIt_UnstructuredMesh_getGhostNodes(visit_handle obj, visit_handle *gn) ...@@ -166,12 +198,16 @@ VisIt_UnstructuredMesh_getGhostNodes(visit_handle obj, visit_handle *gn)
#define F_VISITUCDMESHSETREALINDICES F77_ID(visitucdmeshsetrealindices_,visitucdmeshsetrealindices,VISITUCDMESHSETREALINDICES) #define F_VISITUCDMESHSETREALINDICES F77_ID(visitucdmeshsetrealindices_,visitucdmeshsetrealindices,VISITUCDMESHSETREALINDICES)
#define F_VISITUCDMESHSETGHOSTCELLS F77_ID(visitucdmeshsetghostcells_,visitucdmeshsetghostcells,VISITUCDMESHSETGHOSTCELLS) #define F_VISITUCDMESHSETGHOSTCELLS F77_ID(visitucdmeshsetghostcells_,visitucdmeshsetghostcells,VISITUCDMESHSETGHOSTCELLS)
#define F_VISITUCDMESHSETGHOSTNODES F77_ID(visitucdmeshsetghostnodes_,visitucdmeshsetghostnodes,VISITUCDMESHSETGHOSTNODES) #define F_VISITUCDMESHSETGHOSTNODES F77_ID(visitucdmeshsetghostnodes_,visitucdmeshsetghostnodes,VISITUCDMESHSETGHOSTNODES)
#define F_VISITUCDMESHSETGLOBALCELLIDS F77_ID(visitucdmeshsetglobalcellids_,visitucdmeshsetglobalcellids,VISITUCDMESHSETGLOBALCELLIDS)
#define F_VISITUCDMESHSETGLOBALNODEIDS F77_ID(visitucdmeshsetglobalnodeids_,visitucdmeshsetglobalnodeids,VISITUCDMESHSETGLOBALNODEIDS)
#define F_VISITUCDMESHGETCOORDS F77_ID(visitucdmeshgetcoords_,visitucdmeshgetcoords,VISITUCDMESHGETCOORDS) #define F_VISITUCDMESHGETCOORDS F77_ID(visitucdmeshgetcoords_,visitucdmeshgetcoords,VISITUCDMESHGETCOORDS)
#define F_VISITUCDMESHGETCONNECTIVITY F77_ID(visitucdmeshgetconnectivity_,visitucdmeshgetconnectivity,VISITUCDMESHGETCONNECTIVITY) #define F_VISITUCDMESHGETCONNECTIVITY F77_ID(visitucdmeshgetconnectivity_,visitucdmeshgetconnectivity,VISITUCDMESHGETCONNECTIVITY)
#define F_VISITUCDMESHGETREALINDICES F77_ID(visitucdmeshgetrealindices_,visitucdmeshgetrealindices,VISITUCDMESHGETREALINDICES) #define F_VISITUCDMESHGETREALINDICES F77_ID(visitucdmeshgetrealindices_,visitucdmeshgetrealindices,VISITUCDMESHGETREALINDICES)
#define F_VISITUCDMESHGETGHOSTCELLS F77_ID(visitucdmeshgetghostcells_,visitucdmeshgetghostcells,VISITUCDMESHGETGHOSTCELLS) #define F_VISITUCDMESHGETGHOSTCELLS F77_ID(visitucdmeshgetghostcells_,visitucdmeshgetghostcells,VISITUCDMESHGETGHOSTCELLS)
#define F_VISITUCDMESHGETGHOSTNODES F77_ID(visitucdmeshgetghostnodes_,visitucdmeshgetghostnodes,VISITUCDMESHGETGHOSTNODES) #define F_VISITUCDMESHGETGHOSTNODES F77_ID(visitucdmeshgetghostnodes_,visitucdmeshgetghostnodes,VISITUCDMESHGETGHOSTNODES)
#define F_VISITUCDMESHGETGLOBALCELLIDS F77_ID(visitucdmeshgetglobalcellids_,visitucdmeshgetglobalcellids,VISITUCDMESHGETGLOBALCELLIDS)
#define F_VISITUCDMESHGETGLOBALNODEIDS F77_ID(visitucdmeshgetglobalnodeids_,visitucdmeshgetglobalnodeids,VISITUCDMESHGETGLOBALNODEIDS)
int int
F_VISITUCDMESHALLOC(visit_handle *obj) F_VISITUCDMESHALLOC(visit_handle *obj)
...@@ -227,6 +263,18 @@ F_VISITUCDMESHSETGHOSTNODES(visit_handle *obj, visit_handle *gn) ...@@ -227,6 +263,18 @@ F_VISITUCDMESHSETGHOSTNODES(visit_handle *obj, visit_handle *gn)
return VisIt_UnstructuredMesh_setGhostNodes(*obj, *gn); return VisIt_UnstructuredMesh_setGhostNodes(*obj, *gn);
} }
int
F_VISITUCDMESHSETGLOBALCELLIDS(visit_handle *obj, visit_handle *gz)
{
return VisIt_UnstructuredMesh_setGlobalCellIds(*obj, *gz);
}
int
F_VISITUCDMESHSETGLOBALNODEIDS(visit_handle *obj, visit_handle *gn)
{
return VisIt_UnstructuredMesh_setGlobalNodeIds(*obj, *gn);
}
int int
F_VISITUCDMESHGETCOORDS(visit_handle *obj, int *ndims, int *coordMode, F_VISITUCDMESHGETCOORDS(visit_handle *obj, int *ndims, int *coordMode,
visit_handle *x, visit_handle *y, visit_handle *z, visit_handle *c) visit_handle *x, visit_handle *y, visit_handle *z, visit_handle *c)
...@@ -257,3 +305,15 @@ F_VISITUCDMESHGETGHOSTNODES(visit_handle *obj, visit_handle *gn) ...@@ -257,3 +305,15 @@ F_VISITUCDMESHGETGHOSTNODES(visit_handle *obj, visit_handle *gn)
{ {
return VisIt_UnstructuredMesh_getGhostNodes(*obj, gn); return VisIt_UnstructuredMesh_getGhostNodes(*obj, gn);
} }
int
F_VISITUCDMESHGETGLOBALCELLIDS(visit_handle *obj, visit_handle *gz)
{
return VisIt_UnstructuredMesh_getGlobalCellIds(*obj, gz);
}
int
F_VISITUCDMESHGETGLOBALNODEIDS(visit_handle *obj, visit_handle *gn)
{
return VisIt_UnstructuredMesh_getGlobalNodeIds(*obj, gn);
}
...@@ -53,6 +53,8 @@ int VisIt_UnstructuredMesh_setConnectivity(visit_handle obj, int nCells, visit_h ...@@ -53,6 +53,8 @@ int VisIt_UnstructuredMesh_setConnectivity(visit_handle obj, int nCells, visit_h
int VisIt_UnstructuredMesh_setRealIndices(visit_handle obj, int min, int max); int VisIt_UnstructuredMesh_setRealIndices(visit_handle obj, int min, int max);
int VisIt_UnstructuredMesh_setGhostCells(visit_handle obj, visit_handle gz); int VisIt_UnstructuredMesh_setGhostCells(visit_handle obj, visit_handle gz);
int VisIt_UnstructuredMesh_setGhostNodes(visit_handle obj, visit_handle gn); int VisIt_UnstructuredMesh_setGhostNodes(visit_handle obj, visit_handle gn);
int VisIt_UnstructuredMesh_setGlobalCellIds(visit_handle obj, visit_handle glz);
int VisIt_UnstructuredMesh_setGlobalNodeIds(visit_handle obj, visit_handle gln);
int VisIt_UnstructuredMesh_getCoords(visit_handle h, int VisIt_UnstructuredMesh_getCoords(visit_handle h,
int *ndims, int *coordMode, int *ndims, int *coordMode,
...@@ -65,6 +67,8 @@ int VisIt_UnstructuredMesh_getConnectivity(visit_handle h, int *nCells, ...@@ -65,6 +67,8 @@ int VisIt_UnstructuredMesh_getConnectivity(visit_handle h, int *nCells,
int VisIt_UnstructuredMesh_getRealIndices(visit_handle obj, int *, int *); int VisIt_UnstructuredMesh_getRealIndices(visit_handle obj, int *, int *);
int VisIt_UnstructuredMesh_getGhostCells(visit_handle h, visit_handle *gz); int VisIt_UnstructuredMesh_getGhostCells(visit_handle h, visit_handle *gz);
int VisIt_UnstructuredMesh_getGhostNodes(visit_handle h, visit_handle *gn); int VisIt_UnstructuredMesh_getGhostNodes(visit_handle h, visit_handle *gn);
int VisIt_UnstructuredMesh_getGlobalCellIds(visit_handle obj, visit_handle *glz);
int VisIt_UnstructuredMesh_getGlobalNodeIds(visit_handle obj, visit_handle *gln);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -45,6 +45,9 @@ ...@@ -45,6 +45,9 @@
! Brad Whitlock, Tue Jun 4 09:28:59 PDT 2013 ! Brad Whitlock, Tue Jun 4 09:28:59 PDT 2013
! Add newer environment functions (visitgetenv, visitsetupenv2). ! Add newer environment functions (visitgetenv, visitsetupenv2).
! !
! Brad Whitlock, Fri Jun 13 09:38:34 PDT 2014
! Functions for getting/setting global node/cell ids.
!
!cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
!... Commonly useful declarations !... Commonly useful declarations
...@@ -1454,6 +1457,14 @@ ...@@ -1454,6 +1457,14 @@
external visitucdmeshsetghostnodes external visitucdmeshsetghostnodes
integer visitucdmeshsetghostnodes integer visitucdmeshsetghostnodes
! visitucdmeshsetglobalcellids(visit_handle obj, visit_handle gz)
external visitucdmeshsetglobalcellids
integer visitucdmeshsetglobalcellids
! visitucdmeshsetglobalnodeids(visit_handle obj, visit_handle gn)
external visitucdmeshsetglobalnodeids
integer visitucdmeshsetglobalnodeids
! visitucdmeshgetcoords(visit_handle obj, int ndims, int coordmode, ! visitucdmeshgetcoords(visit_handle obj, int ndims, int coordmode,
! visit_handle x, visit_handle y, visit_handle z, visit_handle c) ! visit_handle x, visit_handle y, visit_handle z, visit_handle c)
external visitucdmeshgetcoords external visitucdmeshgetcoords
...@@ -1475,6 +1486,14 @@ ...@@ -1475,6 +1486,14 @@
external visitucdmeshgetghostnodes external visitucdmeshgetghostnodes
integer visitucdmeshgetghostnodes integer visitucdmeshgetghostnodes
! visitucdmeshgetglobalcellids(visit_handle obj, visit_handle gz)
external visitucdmeshgetglobalcellids
integer visitucdmeshgetglobalcellids
! visitucdmeshgetglobalnodeids(visit_handle obj, visit_handle gn)
external visitucdmeshgetglobalnodeids
integer visitucdmeshgetglobalnodeids
! VisIt_VariableData functions ! VisIt_VariableData functions
!cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
......
...@@ -13,6 +13,8 @@ struct VisIt_UnstructuredMesh : public VisIt_ObjectBase ...@@ -13,6 +13,8 @@ struct VisIt_UnstructuredMesh : public VisIt_ObjectBase
void FreeConnectivity(); void FreeConnectivity();
void FreeGhostCells(); void FreeGhostCells();
void FreeGhostNodes(); void FreeGhostNodes();
void FreeGlobalCellIds();
void FreeGlobalNodeIds();
int ndims; int ndims;
int coordMode; int coordMode;
...@@ -28,6 +30,8 @@ struct VisIt_UnstructuredMesh : public VisIt_ObjectBase ...@@ -28,6 +30,8 @@ struct VisIt_UnstructuredMesh : public VisIt_ObjectBase
visit_handle ghostCells; visit_handle ghostCells;
visit_handle ghostNodes; visit_handle ghostNodes;
visit_handle globalCellIds;
visit_handle globalNodeIds;
}; };
VisIt_UnstructuredMesh::VisIt_UnstructuredMesh() : VisIt_UnstructuredMesh::VisIt_UnstructuredMesh() :
...@@ -47,6 +51,8 @@ VisIt_UnstructuredMesh::VisIt_UnstructuredMesh() : ...@@ -47,6 +51,8 @@ VisIt_UnstructuredMesh::VisIt_UnstructuredMesh() :
ghostCells = VISIT_INVALID_HANDLE; ghostCells = VISIT_INVALID_HANDLE;
ghostNodes = VISIT_INVALID_HANDLE; ghostNodes = VISIT_INVALID_HANDLE;
globalCellIds = VISIT_INVALID_HANDLE;
globalNodeIds = VISIT_INVALID_HANDLE;
} }
VisIt_UnstructuredMesh::~VisIt_UnstructuredMesh() VisIt_UnstructuredMesh::~VisIt_UnstructuredMesh()
...@@ -55,6 +61,8 @@ VisIt_UnstructuredMesh::~VisIt_UnstructuredMesh() ...@@ -55,6 +61,8 @@ VisIt_UnstructuredMesh::~VisIt_UnstructuredMesh()
FreeConnectivity(); FreeConnectivity();
FreeGhostCells(); FreeGhostCells();
FreeGhostNodes(); FreeGhostNodes();
FreeGlobalCellIds();
FreeGlobalNodeIds();
} }
void void
...@@ -112,6 +120,26 @@ VisIt_UnstructuredMesh::FreeGhostNodes() ...@@ -112,6 +120,26 @@ VisIt_UnstructuredMesh::FreeGhostNodes()
} }
} }
void
VisIt_UnstructuredMesh::FreeGlobalCellIds()
{
if(globalCellIds != VISIT_INVALID_HANDLE)
{
simv2_VariableData_free(globalCellIds);
globalCellIds = VISIT_INVALID_HANDLE;
}
}
void
VisIt_UnstructuredMesh::FreeGlobalNodeIds()
{
if(globalNodeIds != VISIT_INVALID_HANDLE)
{
simv2_VariableData_free(globalNodeIds);
globalNodeIds = VISIT_INVALID_HANDLE;
}
}
static VisIt_UnstructuredMesh * static VisIt_UnstructuredMesh *
GetObject(visit_handle h, const char *fname) GetObject(visit_handle h, const char *fname)
{ {
...@@ -442,6 +470,78 @@ simv2_UnstructuredMesh_setGhostNodes(visit_handle h, visit_handle gn) ...@@ -442,6 +470,78 @@ simv2_UnstructuredMesh_setGhostNodes(visit_handle h, visit_handle gn)
return retval; return retval;
} }
int
simv2_UnstructuredMesh_setGlobalCellIds(visit_handle h, visit_handle glz)
{
int retval = VISIT_ERROR;
VisIt_UnstructuredMesh *obj = GetObject(h, "simv2_UnstructuredMesh_setGlobalCellIds");
if(obj != NULL)
{
// Get the global cell id information
int owner, dataType, nComps, nTuples;
void *data = 0;
if(simv2_VariableData_getData(glz, owner, dataType, nComps, nTuples, data) == VISIT_ERROR)
{
VisItError("Could not obtain global cell id information.");
return VISIT_ERROR;
}
if(nComps != 1)
{
VisItError("Global cell id arrays must have 1 component.");
return VISIT_ERROR;
}
if(dataType != VISIT_DATATYPE_LONG && dataType != VISIT_DATATYPE_INT)
{
VisItError("Global cell id arrays must contain either int or long elements.");
return VISIT_ERROR;
}
obj->FreeGlobalCellIds();
obj->globalCellIds = glz;
retval = VISIT_OKAY;
}
return retval;
}
int
simv2_UnstructuredMesh_setGlobalNodeIds(visit_handle h, visit_handle gln)
{
int retval = VISIT_ERROR;
VisIt_UnstructuredMesh *obj = GetObject(h, "simv2_UnstructuredMesh_setGlobalNodeIds");
if(obj != NULL)
{
// Get the global node id information
int owner, dataType, nComps, nTuples;
void *data = 0;
if(simv2_VariableData_getData(gln, owner, dataType, nComps, nTuples, data) == VISIT_ERROR)
{
VisItError("Could not obtain global node id information.");
return VISIT_ERROR;
}
if(nComps != 1)
{
VisItError("Global node id arrays must have 1 component.");
return VISIT_ERROR;
}
if(dataType != VISIT_DATATYPE_LONG && dataType != VISIT_DATATYPE_INT)
{
VisItError("Global node id arrays must contain either int or long elements.");
return VISIT_ERROR;
}
obj->FreeGlobalNodeIds();
obj->globalNodeIds = gln;
retval = VISIT_OKAY;
}
return retval;
}
int int
simv2_UnstructuredMesh_getCoords(visit_handle h, simv2_UnstructuredMesh_getCoords(visit_handle h,
int *ndims, int *coordMode, int *ndims, int *coordMode,
...@@ -518,6 +618,32 @@ simv2_UnstructuredMesh_getGhostNodes(visit_handle h, visit_handle *gn) ...@@ -518,6 +618,32 @@ simv2_UnstructuredMesh_getGhostNodes(visit_handle h, visit_handle *gn)
return retval; return retval;
} }
int
simv2_UnstructuredMesh_getGlobalCellIds(visit_handle h, visit_handle *gz)
{
int retval = VISIT_ERROR;
VisIt_UnstructuredMesh *obj = GetObject(h, "simv2_UnstructuredMesh_getGlobalCellIds");
if(obj != NULL)