Commit 2d33832d authored by ghweber's avatar ghweber

Merged 2.0RC into trunk: Added ability to connect particle mesh based on...

Merged 2.0RC into trunk: Added ability to connect particle mesh based on polymer_id and particle_nid to Chombo reader. Updated config file for groening (my laptop).

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@11693 18c085ea-50e0-402c-830e-de6fd14e8384
parent fb3c1af5
#/what/is/the/path/to/bin/cmake
#/scratch/build/visit_3rdparty/cmake/2.8.0/i386-apple-darwin9_gcc-4.0/bin/cmake
##
## build_vist generated host.conf
## created: Mon Nov 19 18:59:21 PST 2007
## system: Darwin fry.local 9.1.0 Darwin Kernel Version 9.1.0: Wed Oct 31 17:46:22 PDT 2007; root:xnu-1228.0.2~1/RELEASE_I386 i386
## visit_svn/2.0RC_trunk//src/svn_bin/build_visit generated host.cmake
## created: Thu May 20 08:53:22 PDT 2010
## system: Darwin groening.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
## by: ghweber
##
## Set the VISITHOME environment variable.
## Setup VISITHOME & VISITARCH variables.
##
SET(VISITHOME /scratch/build/visit_3rdparty)
SET(VISITARCH i386-apple-darwin9_gcc-4.0)
SET(VISIT_VERBOSE_MAKEFILE TRUE)
VISIT_OPTION_DEFAULT(CMAKE_INSTALL_PREFIX /usr/local/visit)
VISIT_OPTION_DEFAULT(CMAKE_BUILD_TYPE Release)
##
## Specify the location of the mesa include files and libraries.
## Specify the location of the mesa.
##
VISIT_OPTION_DEFAULT(VISIT_MESA_DIR ${VISITHOME}/mesa/7.5/i386-apple-darwin9)
VISIT_OPTION_DEFAULT(VISIT_MESA_DIR ${VISITHOME}/mesa/7.5/${VISITARCH})
##
## Specify the location of the vtk include files and libraries.
## Specify the location of the vtk.
##
VISIT_OPTION_DEFAULT(VISIT_VTK_DIR ${VISITHOME}/vtk/5.0.0c/i386-apple-darwin9/lib/vtk-5.0)
VISIT_OPTION_DEFAULT(VISIT_VTK_DIR ${VISITHOME}/vtk/5.0.0e/${VISITARCH}/lib/vtk-5.0/)
##
## Specify the location of the qt include files and libraries.
## Specify the Qt4 binary dir.
## (qmake us used to locate & setup Qt4 dependencies)
##
VISIT_OPTION_DEFAULT(VISIT_QT_BIN ${VISITHOME}/qt/4.5.2/i386-apple-darwin9/bin)
VISIT_OPTION_DEFAULT(VISIT_QT_BIN ${VISITHOME}/qt/4.6.1/${VISITARCH}/bin)
##
## Specify the location of the python include and libraries.
## Specify the location of the python.
##
VISIT_OPTION_DEFAULT(VISIT_PYTHON_DIR ${VISITHOME}/python/2.5/i386-apple-darwin9)
VISIT_OPTION_DEFAULT(VISIT_PYTHON_DIR ${VISITHOME}/python/2.6.4/${VISITARCH})
##
## Compiler flags.
##
SET(VISIT_C_COMPILER gcc)
SET(VISIT_C_FLAGS "-O2 -fno-common -fexceptions")
SET(VISIT_CXX_COMPILER g++)
SET(VISIT_CXX_FLAGS "-O2 -fno-common -fexceptions")
VISIT_OPTION_DEFAULT(VISIT_C_COMPILER gcc)
VISIT_OPTION_DEFAULT(VISIT_CXX_COMPILER g++)
VISIT_OPTION_DEFAULT(VISIT_C_FLAGS "-O2 -fno-common -fexceptions -fvisibility=hidden")
VISIT_OPTION_DEFAULT(VISIT_CXX_FLAGS "-O2 -fno-common -fexceptions -fvisibility=hidden")
## Para Args
##
SET(VISIT_C_FLAGS "-D_REENTRANT")
SET(VISIT_MPI_C_FLAGS "-DOMPI_SKIP_MPICXX")
## Parallel flags
##
SET(VISIT_MPI_C_FLAGS "-D_REENTRANT -DOMPI_SKIP_MPICXX")
SET(VISIT_MPI_CXX_FLAGS "-D_REENTRANT -DOMPI_SKIP_MPICXX")
SET(VISIT_PARALLEL_LINKER_FLAGS "-Wl,-undefined,dynamic_lookup")
SET(VISIT_MPI_LIBS "-Wl,-u,_munmap -Wl,-multiply_defined,suppress -lmpi -lopen-rte -lopen-pal -lutil")
VISIT_OPTION_DEFAULT(VISIT_PARALLEL ON)
##############################################################
##
## Database reader plugin support libraries
##
......@@ -52,58 +62,50 @@ SET(VISIT_MPI_C_FLAGS "-DOMPI_SKIP_MPICXX")
##
## Boxlib
##
VISIT_OPTION_DEFAULT(VISIT_BOXLIB2D_DIR ${VISITHOME}/boxlib/i386-apple-darwin9)
VISIT_OPTION_DEFAULT(VISIT_BOXLIB3D_DIR ${VISITHOME}/boxlib/i386-apple-darwin9)
VISIT_OPTION_DEFAULT(VISIT_BOXLIB2D_DIR ${VISITHOME}/boxlib/${VISITARCH})
VISIT_OPTION_DEFAULT(VISIT_BOXLIB3D_DIR ${VISITHOME}/boxlib/${VISITARCH})
##
## CFITSIO
##
VISIT_OPTION_DEFAULT(VISIT_CFITSIO_DIR ${VISITHOME}/cfitsio/3006/i386-apple-darwin9)
##
## CGNS
## GDAL
##
VISIT_OPTION_DEFAULT(VISIT_CGNS_DIR ${VISITHOME}/cgns/2.4/i386-apple-darwin9)
#VISIT_OPTION_DEFAULT(VISIT_GDAL_DIR ${VISITHOME}/gdal/1.7.1/${VISITARCH})
##
## Exodus
## FastBit
##
VISIT_OPTION_DEFAULT(VISIT_EXODUSII_DIR ${VISITHOME}/exodus/4.46/i386-apple-darwin9)
VISIT_OPTION_DEFAULT(VISIT_FASTBIT_DIR ${VISITHOME}/fastbit/1.0.9/${VISITARCH})
##
## GDAL
## HDF5
##
VISIT_OPTION_DEFAULT(VISIT_GDAL_DIR ${VISITHOME}/gdal/1.3.2/i386-apple-darwin9)
VISIT_OPTION_DEFAULT(VISIT_HDF5_DIR ${VISITHOME}/hdf5/1.8.4/${VISITARCH})
VISIT_OPTION_DEFAULT(VISIT_HDF5_LIBDEP ${VISITHOME}/szip/2.1/${VISITARCH}/lib sz)
##
## H5Part
##
VISIT_OPTION_DEFAULT(VISIT_H5PART_DIR ${VISITHOME}/h5part/1.4.2/i386-apple-darwin9)
VISIT_OPTION_DEFAULT(VISIT_H5PART_DIR ${VISITHOME}/h5part/1.6.0/${VISITARCH})
VISIT_OPTION_DEFAULT(VISIT_H5PART_LIBDEP HDF5_LIBRARY_DIR hdf5 ${VISIT_HDF5_LIBDEP})
##
## FastBit
## NetCDF
##
VISIT_OPTION_DEFAULT(VISIT_FASTBIT_DIR ${VISITHOME}/fastbit/1.1.0/i386-apple-darwin9)
VISIT_OPTION_DEFAULT(VISIT_NETCDF_DIR ${VISITHOME}/netcdf/3.6.3/${VISITARCH})
##
## HDF4
## SZIP
##
VISIT_OPTION_DEFAULT(VISIT_HDF4_DIR ${VISITHOME}/hdf4/4.2.1/i386-apple-darwin9)
VISIT_OPTION_DEFAULT(VISIT_HDF4_LIBDEP /usr/lib jpeg)
VISIT_OPTION_DEFAULT(VISIT_SZIP_DIR ${VISITHOME}/szip/2.1/${VISITARCH})
##
## HDF5
## Silo
##
VISIT_OPTION_DEFAULT(VISIT_HDF5_DIR ${VISITHOME}/hdf5/1.8.2/i386-apple-darwin9)
VISIT_OPTION_DEFAULT(VISIT_HDF5_LIBDEP ${VISITHOME}/szip/2.1/${VISITARCH}/lib sz)
VISIT_OPTION_DEFAULT(VISIT_SILO_DIR ${VISITHOME}/silo/4.7.2/${VISITARCH})
VISIT_OPTION_DEFAULT(VISIT_SILO_LIBDEP HDF5_LIBRARY_DIR hdf5 ${VISIT_HDF5_LIBDEP})
##
## NetCDF
## Xdmf
##
VISIT_OPTION_DEFAULT(VISIT_NETCDF_DIR ${VISITHOME}/netcdf/3.6.0/i386-apple-darwin9)
VISIT_OPTION_DEFAULT(VISIT_XDMF_DIR ${VISITHOME}/Xdmf/2.1/${VISITARCH})
VISIT_OPTION_DEFAULT(VISIT_XDMF_LIBDEP HDF5_LIBRARY_DIR hdf5 ${VISIT_HDF5_LIBDEP})
##
## Silo (must be after HDF5 symbols to reference them correctly)
##
VISIT_OPTION_DEFAULT(VISIT_SILO_DIR ${VISITHOME}/silo/4.7/i386-apple-darwin9)
VISIT_OPTION_DEFAULT(VISIT_SILO_LIBDEP HDF5_LIBRARY_DIR hdf5 ${VISIT_HDF5_LIBDEP})
......@@ -50,12 +50,14 @@
#include <vtkFieldData.h>
#include <vtkCellData.h>
#include <vtkCellArray.h>
#include <vtkFloatArray.h>
#include <vtkDoubleArray.h>
#include <vtkIntArray.h>
#include <vtkUnsignedCharArray.h>
#include <vtkRectilinearGrid.h>
#include <vtkUnstructuredGrid.h>
#include <vtkPolyData.h>
#include <vtkCellType.h>
#include <DBOptionsAttributes.h>
......@@ -119,6 +121,10 @@ using std::string;
// Hank Childs, Fri Mar 5 13:16:52 PST 2010
// Initialize hasParticles.
//
// Gunther H. Weber, Thu Jun 17 10:10:17 PDT 2010
// Added ability to connect particle mesh based on polymer_id and
// particle_nid
//
// ****************************************************************************
avtChomboFileFormat::avtChomboFileFormat(const char *filename,
......@@ -134,6 +140,7 @@ avtChomboFileFormat::avtChomboFileFormat(const char *filename,
mappingFileExists = false;
mappingIs3D = false;
hasParticles = false;
connectParticles = false;
if (atts != NULL)
{
for (int i = 0; i < atts->GetNumberOfOptions(); ++i)
......@@ -146,6 +153,8 @@ avtChomboFileFormat::avtChomboFileFormat(const char *filename,
enableOnlyExplicitMaterials = atts->GetBool("Enable only explicitly defined materials by default");
else if (atts->GetName(i) == "Check for mapping file and import coordinates if available")
checkForMappingFile = atts->GetBool("Check for mapping file and import coordinates if available");
else if (atts->GetName(i) == "Use particle_nid and polymer_id to connect particles")
connectParticles = atts->GetBool("Use particle_nid and polymer_id to connect particles");
else
debug1 << "Ignoring unknown option " << atts->GetName(i) << endl;
}
......@@ -1955,8 +1964,30 @@ avtChomboFileFormat::GetLevelAndLocalPatchNumber(int global_patch,
// Gunther H. Weber, Wed Jun 10 18:28:24 PDT 2009
// Added ability to handle particle data in Chombo files.
//
// Gunther H. Weber, Thu Jun 17 10:10:17 PDT 2010
// Added ability to connect particle mesh based on polymer_id and
// particle_nid
//
// ****************************************************************************
// Comaprator class used to sort an array with integers so that the permutation
// of integers gives an order so that all prticles belonging to a single polymer
// are next to each other and in correct order along the polymer.
class LookUpOrderCmp
{
public:
LookUpOrderCmp(const int32_t *d1, const int32_t *d2) : order1Var(d1), order2Var(d2) {}
bool operator()(vtkIdType a, vtkIdType b)
{
return order1Var[a] < order1Var[b] ||
order1Var[a] == order1Var[b] && order2Var[a] < order2Var[b];
}
private:
const int32_t *order1Var;
const int32_t *order2Var;
};
vtkDataSet *
avtChomboFileFormat::GetMesh(int patch, const char *meshname)
{
......@@ -2322,6 +2353,69 @@ avtChomboFileFormat::GetMesh(int patch, const char *meshname)
}
}
int32_t *particleOrder = 0;
int32_t *polymerNo = 0;
if (connectParticles &&
std::find(
particleVarnames.begin(), particleVarnames.end(), "particle_nid"
) != particleVarnames.end() &&
std::find(
particleVarnames.begin(), particleVarnames.end(), "polymer_id"
) != particleVarnames.end())
{
dataSet = H5Dopen(file_handle, "/particles/particle_nid");
if ( dataSet > 0)
{
hid_t dataSpace = H5Dget_space(dataSet);
if (H5Sis_simple(dataSpace))
{
hsize_t nParticlesCheck;
if (H5Sget_simple_extent_ndims(dataSpace) == 1)
{
H5Sget_simple_extent_dims(dataSpace, &nParticlesCheck, NULL);
if (nParticles == nParticlesCheck)
{
particleOrder = new int32_t[nParticles];
H5Dread(dataSet, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, particleOrder);
}
}
}
H5Dclose(dataSet);
}
dataSet = H5Dopen(file_handle, "/particles/polymer_id");
if ( dataSet > 0)
{
hid_t dataSpace = H5Dget_space(dataSet);
if (H5Sis_simple(dataSpace))
{
hsize_t nParticlesCheck;
if (H5Sget_simple_extent_ndims(dataSpace) == 1)
{
H5Sget_simple_extent_dims(dataSpace, &nParticlesCheck, NULL);
if (nParticles == nParticlesCheck)
{
polymerNo = new int32_t[nParticles];
H5Dread(dataSet, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, polymerNo);
}
}
}
H5Dclose(dataSet);
}
// Check if both data sets for connecting particles were loaded
if (!(particleOrder && polymerNo))
{
// No, delete any that may be loaded and set pointers to zero
delete[] particleOrder;
particleOrder = 0;
delete[] polymerNo;
polymerNo = 0;
}
}
H5Fclose(file_handle);
file_handle = -1;
......@@ -2337,21 +2431,66 @@ avtChomboFileFormat::GetMesh(int patch, const char *meshname)
delete[] zPos;
delete[] datasetname;
//
// Create a vtkUnstructuredGrid to contain the point cells.
//
vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::New();
ugrid->SetPoints(points);
points->Delete();
ugrid->Allocate(nParticles);
vtkIdType onevertex;
for(int i = 0; i < nParticles; ++i)
if (particleOrder)
{
onevertex = i;
ugrid->InsertNextCell(VTK_VERTEX, 1, &onevertex);
// Create an integer array with proper permutation of particles such that
// all particles on same polymer are "next" to each other and that particles
// within a polymer are ordered according to particle_nid
vtkIdType *orderPermutation = new vtkIdType[nParticles];
for (vtkIdType i=0; i <nParticles; ++i) orderPermutation[i]=i;
LookUpOrderCmp cmp(polymerNo, particleOrder);
std::sort(orderPermutation, orderPermutation+nParticles, cmp);
//
// Create poly data
//
vtkPolyData *pd = vtkPolyData::New();
pd->SetPoints(points);
points->Delete();
vtkCellArray *verts = vtkCellArray::New();
pd->SetVerts(verts);
verts->Delete();
for (vtkIdType i= 0; i<nParticles; ++i)
{
verts->InsertNextCell(1);
verts->InsertCellPoint(i);
}
vtkCellArray *lines = vtkCellArray::New();
pd->SetLines(lines);
lines->Delete();
for (vtkIdType i=0; i<nParticles-1; ++i)
{
if (polymerNo[i] == polymerNo[i+1])
{
lines->InsertNextCell(2);
lines->InsertCellPoint(orderPermutation[i]);
lines->InsertCellPoint(orderPermutation[i+1]);
}
}
delete[] particleOrder;
delete[] polymerNo;
return pd;
}
else {
//
// Create a vtkUnstructuredGrid to contain the point cells.
//
vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::New();
ugrid->SetPoints(points);
points->Delete();
ugrid->Allocate(nParticles);
vtkIdType onevertex;
for(int i = 0; i < nParticles; ++i)
{
onevertex = i;
ugrid->InsertNextCell(VTK_VERTEX, 1, &onevertex);
}
return ugrid;
return ugrid;
}
}
else
EXCEPTION1(InvalidVariableException, meshname);
......
......@@ -146,6 +146,10 @@ class DBOptionsAttributes;
// Gunther H. Weber, Tue Sep 15 11:25:21 PDT 2009
// Added support for 3D mappings for 2D files
//
// Gunther H. Weber, Thu Jun 17 10:10:17 PDT 2010
// Added ability to connect particle mesh based on polymer_id and
// particle_nid
//
// ****************************************************************************
class avtChomboFileFormat : public avtSTMDFileFormat
......@@ -178,6 +182,7 @@ class avtChomboFileFormat : public avtSTMDFileFormat
std::vector<std::string> varnames;
int nMaterials;
bool hasParticles;
bool connectParticles;
std::vector<std::string> particleVarnames;
double dtime;
int cycle;
......
......@@ -71,6 +71,7 @@ GetChomboReadOptions(void)
rv->SetBool("Enable only root level by default", false);
rv->SetBool("Enable only explicitly defined materials by default", false);
rv->SetBool("Check for mapping file and import coordinates if available", true);
rv->SetBool("Use particle_nid and polymer_id to connect particles", false);
return rv;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment