Commit 469f2dd2 authored by hrchilds's avatar hrchilds

Update from January 24, 2006

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@605 18c085ea-50e0-402c-830e-de6fd14e8384
parent 9b615be6
......@@ -176,29 +176,55 @@ avtChomboFileFormat::InitializeReader(void)
"have the \"/\" group.");
}
bool hasTime = false;
bool hasIterations = false;
int numAttrs = H5Aget_num_attrs(slash);
char buf[1024];
for (i = 0 ; i < numAttrs ; i++)
{
hid_t idx = H5Aopen_idx(slash, i);
H5Aget_name(idx, 1024, buf);
if (strcmp(buf, "time") == 0)
hasTime = true;
if (strcmp(buf, "iteration") == 0)
hasIterations = true;
H5Aclose(idx);
}
//
// Get the time.
//
hid_t time_id = H5Aopen_name(slash, "time");
if (time_id < 0)
if (hasTime)
{
EXCEPTION1(InvalidDBTypeException, "Cannot be a Chombo file, must "
"have time in \"/\" group.");
hid_t time_id = H5Aopen_name(slash, "time");
if (time_id < 0)
{
EXCEPTION1(InvalidDBTypeException, "Cannot be a Chombo file, must "
"have time in \"/\" group.");
}
H5Aread(time_id, H5T_NATIVE_DOUBLE, &dtime);
H5Aclose(time_id);
}
H5Aread(time_id, H5T_NATIVE_DOUBLE, &dtime);
H5Aclose(time_id);
else
dtime = 0.;
//
// Get the cycle.
//
hid_t cycle_id = H5Aopen_name(slash, "iteration");
if (cycle_id < 0)
if (hasIterations)
{
EXCEPTION1(InvalidDBTypeException, "Cannot be a Chombo file, must "
"have iteration in \"/\" group.");
hid_t cycle_id = H5Aopen_name(slash, "iteration");
if (cycle_id < 0)
{
EXCEPTION1(InvalidDBTypeException, "Cannot be a Chombo file, must "
"have iteration in \"/\" group.");
}
H5Aread(cycle_id, H5T_NATIVE_INT, &cycle);
H5Aclose(cycle_id);
}
H5Aread(cycle_id, H5T_NATIVE_INT, &cycle);
H5Aclose(cycle_id);
else
cycle = 0;
//
// Note: max_level, per conversation with John Shalf, is for the code
......@@ -372,6 +398,20 @@ avtChomboFileFormat::InitializeReader(void)
// Now iterate over the patches again, storing their extents in our
// internal data structure.
//
hid_t box2d_id = H5Tcreate (H5T_COMPOUND, sizeof(box));
H5Tinsert (box2d_id, "lo_i", HOFFSET(box2d, lo.i), H5T_NATIVE_INT);
H5Tinsert (box2d_id, "lo_j", HOFFSET(box2d, lo.j), H5T_NATIVE_INT);
H5Tinsert (box2d_id, "hi_i", HOFFSET(box2d, hi.i), H5T_NATIVE_INT);
H5Tinsert (box2d_id, "hi_j", HOFFSET(box2d, hi.j), H5T_NATIVE_INT);
hid_t box3d_id = H5Tcreate (H5T_COMPOUND, sizeof(box));
H5Tinsert (box3d_id, "lo_i", HOFFSET(box3d, lo.i), H5T_NATIVE_INT);
H5Tinsert (box3d_id, "lo_j", HOFFSET(box3d, lo.j), H5T_NATIVE_INT);
H5Tinsert (box3d_id, "lo_k", HOFFSET(box3d, lo.k), H5T_NATIVE_INT);
H5Tinsert (box3d_id, "hi_i", HOFFSET(box3d, hi.i), H5T_NATIVE_INT);
H5Tinsert (box3d_id, "hi_j", HOFFSET(box3d, hi.j), H5T_NATIVE_INT);
H5Tinsert (box3d_id, "hi_k", HOFFSET(box3d, hi.k), H5T_NATIVE_INT);
int patchId = 0;
for (i = 0 ; i < num_levels ; i++)
{
......@@ -385,36 +425,40 @@ avtChomboFileFormat::InitializeReader(void)
H5Sget_simple_extent_dims(boxspace, dims, maxdims);
hid_t memdataspace = H5Screate_simple(1, dims, NULL);
// EXTREME WEIRDNESS REGARDING SIZE OF BOX. NEED MORE INFO FROM
// LBL. PROBABLY HDF ISSUE THAT I NEED TO BE EDUCATED ON.
int box_size = (dimension == 3 ? 9 : 7);
int arr_size = box_size*patchesPerLevel[i];
int *buff = new int[arr_size];
box *boxes_buff = new box[dims[0]];
H5Dread(boxes, (dimension == 2 ? box2d_id : box3d_id), memdataspace,
boxspace, H5P_DEFAULT, boxes_buff);
hid_t atype = H5Dget_type(boxes);
H5Dread(boxes, atype, memdataspace, boxspace,
H5P_DEFAULT, buff);
for (j = 0 ; j < patchesPerLevel[i] ; j++)
{
int *t = buff + box_size*j;
lowI[patchId] = *t++;
lowJ[patchId] = *t++;
if (dimension == 3)
lowK[patchId] = *t++;
hiI[patchId] = *t++ + 1;
hiJ[patchId] = *t++ + 1;
if (dimension == 3)
hiK[patchId] = *t++ + 1;
if (dimension == 2)
{
lowI[patchId] = boxes_buff[j].b2.lo.i;
lowJ[patchId] = boxes_buff[j].b2.lo.j;
hiI[patchId] = boxes_buff[j].b2.hi.i+1;
hiJ[patchId] = boxes_buff[j].b2.hi.j+1;
}
else
{
lowI[patchId] = boxes_buff[j].b3.lo.i;
lowJ[patchId] = boxes_buff[j].b3.lo.j;
lowK[patchId] = boxes_buff[j].b3.lo.k;
hiI[patchId] = boxes_buff[j].b3.hi.i+1;
hiJ[patchId] = boxes_buff[j].b3.hi.j+1;
hiK[patchId] = boxes_buff[j].b3.hi.k+1;
}
patchId++;
}
delete [] buff;
H5Sclose(memdataspace);
H5Sclose(boxspace);
H5Dclose(boxes);
H5Gclose(level);
}
H5Tclose(box2d_id);
H5Tclose(box3d_id);
//
// The domain nesting takes a while to calculate. We don't need the
// data structure if we are on the mdserver. But we do if we're on the
......@@ -830,7 +874,7 @@ avtChomboFileFormat::GetMesh(int patch, const char *meshname)
int dims[3];
dims[0] = hiI[patch]-lowI[patch]+1;
dims[1] = hiJ[patch]-lowJ[patch]+1;
dims[2] = (dimension == 3 ? hiJ[patch]-lowJ[patch] : 1);
dims[2] = (dimension == 3 ? hiK[patch]-lowK[patch]+1 : 1);
vtkRectilinearGrid *rg = vtkRectilinearGrid::New();
rg->SetDimensions(dims);
......
......@@ -11,6 +11,33 @@
#include <hdf5.h>
struct {
int i;
int j;
} typedef intvect2d;
struct {
int i;
int j;
int k;
} typedef intvect3d;
struct {
intvect2d lo;
intvect2d hi;
} typedef box2d;
struct{
intvect3d lo;
intvect3d hi;
} typedef box3d;
union
{
box2d b2;
box3d b3;
} typedef box;
// ****************************************************************************
// Class: avtChomboFileFormat
......
......@@ -53,9 +53,6 @@ targeted at making it easier to detect when session files contain errors and at
<li>VisIt's Mili database reader plugin has been enhanced so that it can support time-invariant nodal positions.</li>
<li>VisIt's <b>File selection window</b> now truncates the list of files in a virtual database to prevent the window from doing too much work and to work around a flaw in the Qt GUI library. The change allows for faster interaction with the window.
The full list of time states is still available in the <b>Main window's File panel</b>.</li>
<li>VisIt has a new database reader plugin that can read rectilinear Chombo data files. The new database reader can read files ending in
<i>".hdf5"</i> or <i>".h5"</i> as Chombo files. If your files do not have those file extensions then use the
<i>"-default_format Chombo"</i> command line options when you run VisIt.</li>
<li>VisIt has a new database reader plugin that can read HDF4 output files from ZeusMP, a popular astrophysics code. Note that since each processor writes its own HDF4 file and there is no convention for creating master files in ZeusMP, you must create a
<i>".visit"</i> file to let VisIt know how to reassemble the files into a whole. The
<i>&quot;.visit&quot;</i> file is a simple text file.&nbsp; For a time-varying database broken up into 4 tiles,
......@@ -135,6 +132,7 @@ This problem caused the Volume plot to sample data in the wrong regions of a mes
<li>Views saved to session files do not contain all fields, which can lead to confusion.</li>
<li>VisIt's xmledit program does not gracefully handle the removal of a code file.</li>
<li>Pick causes plots to disappear when in scalable rendering mode.</li>
<li>Subset plots of rectilinear or AMR meshes are now rendered correctly. Previously, just the corners of the mesh appeared.</li>
</ul>
<p>Click the following link to view the release notes for the previous version
of VisIt: <a href="relnotes1.5.html">VisIt 1.5 Release Notes</a>.</p>
......
......@@ -8,6 +8,8 @@
#include <vtkRectilinearGrid.h>
#include <vtkUnsignedCharArray.h>
#include <ImproperUseException.h>
using std::vector;
......@@ -163,6 +165,9 @@ SpecializedIndexer::SpecializedIndexer(int x, int y, int z)
// Hank Childs, Sun Mar 13 11:09:16 PST 2005
// Fix memory leak.
//
// Hank Childs, Tue Jan 24 09:53:16 PST 2006
// Add support for ghost nodes.
//
// ****************************************************************************
void vtkRectilinearGridFacelistFilter::Execute()
......@@ -185,7 +190,8 @@ void vtkRectilinearGridFacelistFilter::Execute()
//
if (ForceFaceConsolidation)
{
if (inCellData->GetArray("avtGhostZones") == NULL)
if (inCellData->GetArray("avtGhostZones") == NULL &&
inPointData->GetArray("avtGhostNodes") == NULL)
{
ConsolidateFacesWithoutGhostZones();
output->Delete();
......@@ -528,7 +534,7 @@ void vtkRectilinearGridFacelistFilter::Execute()
// We only get to this spot if we have ghost zones -- which makes
// consolidating faces a harder problem. Use a sub-routine to do that.
//
vtkPolyData *new_output = ConsolidateFacesWithGhostZones(output,
vtkPolyData *new_output = ConsolidateFacesWithGhostZones(output, list,
faceStart, rowSize, columnSize);
output->Delete();
output = new_output;
......@@ -546,12 +552,15 @@ void vtkRectilinearGridFacelistFilter::Execute()
// Hank Childs, Fri Aug 27 15:15:20 PDT 2004
// Rename ghost data array.
//
// Hank Childs, Tue Jan 24 09:53:16 PST 2006
// Add support for ghost nodes.
//
// ****************************************************************************
vtkPolyData *
vtkRectilinearGridFacelistFilter::ConsolidateFacesWithGhostZones(
vtkPolyData *pd, vector<int> &sideStart,
vector<int> &rowSize, vector<int> &columnSize)
vtkPolyData *pd, vtkIdTypeArray *list, vector<int> &sideStart,
vector<int> &rowSize, vector<int> &columnSize)
{
//
// The output will have identical point information to our input. So copy
......@@ -564,10 +573,42 @@ vtkRectilinearGridFacelistFilter::ConsolidateFacesWithGhostZones(
//
// Set up some useful vars for later.
//
vtkCellData *inCellData = pd->GetCellData();
vtkCellData *outCellData = cpd->GetCellData();
vtkUnsignedCharArray *gza = (vtkUnsignedCharArray *)
vtkPointData *inPointData = pd->GetPointData();
vtkCellData *inCellData = pd->GetCellData();
vtkCellData *outCellData = cpd->GetCellData();
vtkUnsignedCharArray *gzv = (vtkUnsignedCharArray *)
inCellData->GetArray("avtGhostZones");
unsigned char *gza = NULL;
bool constructGZA = false;
vector<unsigned char> ghost_zones;
if (gzv == NULL)
{
vtkUnsignedCharArray *gnv = (vtkUnsignedCharArray *)
inPointData->GetArray("avtGhostNodes");
if (gnv == NULL)
{
EXCEPTION0(ImproperUseException);
}
unsigned char *gna = gnv->GetPointer(0);
int nCells = pd->GetNumberOfCells();
gza = new unsigned char[nCells];
constructGZA = true;
vtkIdType *nl = list->GetPointer(0);
for (int i = 0 ; i < nCells ; i++)
{
int npts = *nl++;
bool oneOkay = false;
for (int j = 0 ; j < npts ; j++)
{
oneOkay = oneOkay || (gna[*nl] == 0);
nl++;
}
gza[i] = (oneOkay ? 0 : 1);
}
}
else
gza = gzv->GetPointer(0);
//
// We will be modifying the cells. So set up some of the data structures.
......@@ -597,7 +638,7 @@ vtkRectilinearGridFacelistFilter::ConsolidateFacesWithGhostZones(
int face = k*rowSize[i] + j;
if (faceUsed[face])
continue;
unsigned char gz_standard = gza->GetValue(startFace+face);
unsigned char gz_standard = gza[startFace+face];
//
// Find out how far we can go along the row with the same ghost
......@@ -610,7 +651,7 @@ vtkRectilinearGridFacelistFilter::ConsolidateFacesWithGhostZones(
int face = k*rowSize[i] + l;
if (faceUsed[face])
break;
unsigned char gz_current = gza->GetValue(startFace+face);
unsigned char gz_current = gza[startFace+face];
if (gz_current != gz_standard)
break;
lastRowMatch = l;
......@@ -632,7 +673,7 @@ vtkRectilinearGridFacelistFilter::ConsolidateFacesWithGhostZones(
all_matches = false;
break;
}
unsigned char gz_current = gza->GetValue(startFace+face);
unsigned char gz_current = gza[startFace+face];
if (gz_current != gz_standard)
{
all_matches = false;
......@@ -678,6 +719,7 @@ vtkRectilinearGridFacelistFilter::ConsolidateFacesWithGhostZones(
quad[l] = pd->GetCell(quad_index[l])->GetPointId(l);
}
polys->InsertNextCell(4, quad);
ghost_zones.push_back(gz_standard);
//
// Copy over the new cell data, too. Just copy the cell data from
......@@ -692,6 +734,20 @@ vtkRectilinearGridFacelistFilter::ConsolidateFacesWithGhostZones(
polys->Squeeze();
cpd->GetCellData()->Squeeze();
polys->Delete();
if (constructGZA)
{
cpd->GetPointData()->RemoveArray("avtGhostNodes");
vtkUnsignedCharArray *new_gz = vtkUnsignedCharArray::New();
new_gz->SetName("avtGhostZones");
new_gz->SetNumberOfTuples(ghost_zones.size());
for (int i = 0 ; i < ghost_zones.size() ; i++)
{
new_gz->SetValue(i, ghost_zones[i]);
}
cpd->GetCellData()->AddArray(new_gz);
new_gz->Delete();
delete [] gza;
}
return cpd;
}
......
......@@ -11,6 +11,7 @@
#include <visit_vtk_exports.h>
#include "vtkRectilinearGridToPolyDataFilter.h"
class vtkIdTypeArray;
#include <vector>
// ****************************************************************************
......@@ -20,6 +21,9 @@
// Added separate consolidation routines that work with and without ghost
// zones.
//
// Hank Childs, Tue Jan 24 10:11:22 PST 2006
// Add support for ghost nodes.
//
// ****************************************************************************
class VISIT_VTK_API vtkRectilinearGridFacelistFilter : public vtkRectilinearGridToPolyDataFilter
......@@ -50,8 +54,8 @@ private:
void operator=(const vtkRectilinearGridFacelistFilter&);
void ConsolidateFacesWithoutGhostZones(void);
vtkPolyData *ConsolidateFacesWithGhostZones(vtkPolyData *, std::vector<int>&,
std::vector<int>&,std::vector<int>&);
vtkPolyData *ConsolidateFacesWithGhostZones(vtkPolyData *, vtkIdTypeArray *,
std::vector<int>&, std::vector<int>&,std::vector<int>&);
};
#endif
......
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