Commit 5494d0bf authored by hrchilds's avatar hrchilds
Browse files

Update from July 9, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@276 18c085ea-50e0-402c-830e-de6fd14e8384
parent 26b69bf3
......@@ -1685,6 +1685,10 @@ avtGenericDatabase::GetSymmetricTensorVariable(const char *varname, int ts,
// Hank Childs, Sun Jun 27 10:47:38 PDT 2004
// Copy over more information about ghosts or global indexing.
//
// Hank Childs, Fri Jul 9 14:24:21 PDT 2004
// No longer scale the mesh, since the camera and lighting now both handle
// large and small problems better.
//
// ****************************************************************************
vtkDataSet *
......@@ -1725,7 +1729,6 @@ avtGenericDatabase::GetMesh(const char *meshname, int ts, int domain,
mesh->Update();
AssociateBounds(mesh);
ScaleMesh(mesh);
if (Interface->CanCacheVariable(meshname))
{
......@@ -2977,6 +2980,12 @@ avtGenericDatabase::ActivateTimestep(int stateIndex)
// Kathleen Bonnell, Fri May 28 18:31:15 PDT 2004
// Initialize ContainsOriginalNodes in the MetaData.
//
// Jeremy Meredith, Fri Jul 9 17:32:38 PDT 2004
// It is possible to get multiple secondary variables in the data
// specification and cause all sorts of problems (see '4798). I added a
// method to get the secondary variable list without duplicating either the
// primary variable or other secondary variables, and made use of it here.
//
// ****************************************************************************
void
......@@ -3000,7 +3009,8 @@ avtGenericDatabase::ReadDataset(avtDatasetCollection &ds, vector<int> &domains,
// Set up some things we will want for later.
//
const char *var = spec->GetVariable();
const vector<CharStrRef> &vars2nd = spec->GetSecondaryVariables();
const vector<CharStrRef> &vars2nd =
spec->GetSecondaryVariablesWithoutDuplicates();
avtSILRestriction_p silr = spec->GetRestriction();
char progressString[1024];
......@@ -3307,6 +3317,12 @@ avtGenericDatabase::ReadDataset(avtDatasetCollection &ds, vector<int> &domains,
// Hank Childs, Sun Jun 27 11:02:42 PDT 2004
// Add support for identifying ghost nodes using global indexing.
//
// Jeremy Meredith, Fri Jul 9 17:32:38 PDT 2004
// It is possible to get multiple secondary variables in the data
// specification and cause all sorts of problems (see '4798). I added a
// method to get the secondary variable list without duplicating either the
// primary variable or other secondary variables, and made use of it here.
//
// ****************************************************************************
bool
......@@ -3560,7 +3576,8 @@ avtGenericDatabase::CommunicateGhosts(avtDatasetCollection &ds,
//
// Exchange secondary variables.
//
const vector<CharStrRef> &var2nd = spec->GetSecondaryVariables();
const vector<CharStrRef> &var2nd =
spec->GetSecondaryVariablesWithoutDuplicates();
avtDatabaseMetaData *metadata = GetMetaData(ts);
for (i = 0 ; i < var2nd.size() ; i++)
{
......
......@@ -853,6 +853,56 @@ avtDataSpecification::VariablesAreTheSame(const avtDataSpecification &ds)
}
// ****************************************************************************
// Method: avtDataSpecification::GetSecondaryVariablesWithoutDuplicates
//
// Purpose:
// Return the list of secondary variables, removing duplicates of the
// primary variable and not allowing duplicates within the secondary
// variables.
//
// Arguments:
// none.
//
// Programmer: Jeremy Meredith
// Creation: July 9, 2004
//
// ****************************************************************************
vector<CharStrRef>
avtDataSpecification::GetSecondaryVariablesWithoutDuplicates(void)
{
vector<CharStrRef> newList;
for (int i = 0 ; i < secondaryVariables.size() ; i++)
{
bool duplicate = false;
// don't allow duplicates of the primary variable
if (variable && strcmp(db_variable, *(secondaryVariables[i])) == 0)
{
duplicate = true;
}
// don't allow duplicates of other secondary variables; just take
// the first instance of it
for (int j = 0 ; j < i && !duplicate; j++)
{
if (strcmp(*(secondaryVariables[i]),*(secondaryVariables[j])) == 0)
{
duplicate = true;
}
}
// add it to the list if it wasn't a duplicate
if (!duplicate)
{
newList.push_back(secondaryVariables[i]);
}
}
return newList;
}
// ****************************************************************************
// Method: avtSILSpecification::GetDomainList
//
......
......@@ -101,6 +101,9 @@ typedef ref_ptr<avtDataSpecification> avtDataSpecification_p;
// Kathleen Bonnell, Mon Jun 28 08:05:38 PDT 2004
// Added SetTimestep method.
//
// Jeremy Meredith, Fri Jul 9 16:49:24 PDT 2004
// Added GetSecondaryVariablesWithoutDuplicates.
//
// ****************************************************************************
class PIPELINE_API avtDataSpecification
......@@ -137,6 +140,7 @@ class PIPELINE_API avtDataSpecification
const std::vector<CharStrRef> &
GetSecondaryVariables(void)
{ return secondaryVariables; };
std::vector<CharStrRef> GetSecondaryVariablesWithoutDuplicates(void);
bool MustDoMaterialInterfaceReconstruction(void)
{ return mustDoMIR; };
......
......@@ -9,6 +9,7 @@
#include <vtkDataSet.h>
#include <vtkRectilinearGrid.h>
#include <vtkUnsignedCharArray.h>
#include <vtkVisItCellLocator.h>
#include <vtkVisItUtility.h>
#include <avtTerminatingSource.h>
......@@ -110,6 +111,9 @@ avtLocateCellQuery::~avtLocateCellQuery()
// Kathleen Bonnell, Tue May 18 13:12:09 PDT 2004
// Move node-specific code to avtLocateNodeQuery.
//
// Kathleen Bonnell, Wed Jul 7 14:48:44 PDT 2004
// Added call to FindClosestCell for line data.
//
// ****************************************************************************
void
......@@ -120,14 +124,20 @@ avtLocateCellQuery::Execute(vtkDataSet *ds, const int dom)
return;
}
int dim = GetInput()->GetInfo().GetAttributes().GetSpatialDimension();
float dist, isect[3] = { 0., 0., 0.};
int foundCell;
int topodim = GetInput()->GetInfo().GetAttributes().GetTopologicalDimension();
float dist = minDist, isect[3] = { 0., 0., 0.};
int foundCell = -1;
// Find the cell, intersection point, and distance along the ray.
//
if (ds->GetDataObjectType() != VTK_RECTILINEAR_GRID)
{
foundCell = LocatorFindCell(ds, dist, isect);
if (topodim == 1 && dim == 2) // Lines
foundCell = FindClosestCell(ds, dist, isect);
else
foundCell = LocatorFindCell(ds, dist, isect);
}
else
{
......@@ -241,3 +251,61 @@ avtLocateCellQuery::RGridFindCell(vtkDataSet *ds, float &dist, float *isect)
return cellId;
}
// ****************************************************************************
// Method: avtLocateQuery::FindClosestCell
//
// Purpose:
// Uses a locator to find the closest cell to the given point.
//
// Arguments:
// ds The dataset to query.
// minDist The current minimum distance.
// isect The intersection point.
//
// Returns:
// The id of the closest cell (-1 if none found).
//
// Programmer: Kathleen Bonnell
// Creation: July 7, 2004
//
// Modifications:
//
// ****************************************************************************
int
avtLocateCellQuery::FindClosestCell(vtkDataSet *ds, float &minDist, float isect[3])
{
if (ds->GetNumberOfPoints() == 0)
{
return -1;
}
int foundCell = -1;
float *rayPt1 = pickAtts.GetRayPoint1();
float pt[3] = {rayPt1[0], rayPt1[1], 0.};
float dist, rad = minDist;
vtkVisItCellLocator *cellLocator = vtkVisItCellLocator::New();
cellLocator->SetDataSet(ds);
cellLocator->IgnoreGhostsOn();
cellLocator->BuildLocator();
int subId = 0;
float cp[3] = {0., 0., 0.};
int success = cellLocator->FindClosestPointWithinRadius(pt, rad, cp,
foundCell, subId, dist);
if (success == 1 && dist < minDist)
{
isect[0] = cp[0];
isect[1] = cp[1];
isect[2] = cp[2];
minDist = dist;
}
cellLocator->Delete();
return foundCell;
}
......@@ -49,6 +49,9 @@ class vtkDataSet;
// Inherit from avtLocateQuery. Moved Node specific code to
// avtLocateNodeQuery.
//
// Kathleen Bonnell, Wed Jul 7 14:48:44 PDT 2004
// Added FindClosestCell, for use with line plots.
//
// ****************************************************************************
class QUERY_API avtLocateCellQuery : public avtLocateQuery
......@@ -66,6 +69,9 @@ class QUERY_API avtLocateCellQuery : public avtLocateQuery
virtual void Execute(vtkDataSet *, const int);
int RGridFindCell(vtkDataSet *,
float &, float*);
int FindClosestCell(vtkDataSet *ds,
float &minDist,
float isect[3]);
};
......
......@@ -82,18 +82,28 @@ avtLocateNodeQuery::Execute(vtkDataSet *ds, const int dom)
float dist, isect[3] = { 0., 0., 0.};
int foundNode = -1;
int origNode = -1;
int topodim = GetInput()->GetInfo().GetAttributes().GetTopologicalDimension();
int spatdim = GetInput()->GetInfo().GetAttributes().GetSpatialDimension();
// Find the cell, intersection point, and distance along the ray.
//
if (ds->GetDataObjectType() != VTK_RECTILINEAR_GRID)
{
int foundCell = LocatorFindCell(ds, dist, isect);
if (foundCell != -1)
if (topodim == 1 && spatdim == 2) // LINES
{
if (!pickAtts.GetMatSelected())
foundNode = DeterminePickedNode(ds, foundCell, isect);
else
foundNode = FindClosestPoint(ds, isect, origNode);
dist = minDist;
foundNode = FindClosestPointOnLine(ds, dist, isect);
}
else
{
int foundCell = LocatorFindCell(ds, dist, isect);
if (foundCell != -1)
{
if (!pickAtts.GetMatSelected())
foundNode = DeterminePickedNode(ds, foundCell, isect);
else
foundNode = FindClosestPoint(ds, isect, origNode);
}
}
}
else
......@@ -298,3 +308,57 @@ avtLocateNodeQuery::FindClosestPoint(vtkDataSet *ds, float *isect, int &origNode
locator->Delete();
return id;
}
// ****************************************************************************
// Method: avtLocateQuery::FindClosestPointOnLine
//
// Purpose:
// Uses a locator to find the closest point to the given point.
//
// Arguments:
// ds The dataset to query.
// minDist The current minimum distance.
//
// Returns:
// The id of the closest point (-1 if none found).
//
// Programmer: Kathleen Bonnell
// Creation: June 10, 2004
//
// Modifications:
//
// ****************************************************************************
int
avtLocateNodeQuery::FindClosestPointOnLine(vtkDataSet *ds, float &minDist,
float isect[3])
{
if (ds->GetNumberOfPoints() == 0)
{
return -1;
}
float *rayPt1 = pickAtts.GetRayPoint1();
vtkVisItPointLocator *pointLocator = vtkVisItPointLocator::New();
pointLocator->SetDataSet(ds);
pointLocator->IgnoreDisconnectedPointsOn();
pointLocator->BuildLocator();
vtkIdType foundPoint = -1;
float pt[3] = {rayPt1[0], rayPt1[1], 0.};
float dist, rad = minDist;
foundPoint = pointLocator->FindClosestPointWithinRadius(rad, pt, dist);
if (foundPoint >= 0 && dist < minDist)
{
vtkVisItUtility::GetPoints(ds)->GetPoint(foundPoint, isect);
minDist = dist;
}
pointLocator->Delete();
return foundPoint;
}
......@@ -23,6 +23,9 @@
// Kathleen Bonnell, Thu Jun 17 12:58:47 PDT 2004
// Added FindClosestPoint.
//
// Kathleen Bonnell, Wed Jul 7 14:59:49 PDT 2004
// Added FindClosestPointOnLine.
//
// ****************************************************************************
class QUERY_API avtLocateNodeQuery : public avtLocateQuery
......@@ -41,6 +44,10 @@ class QUERY_API avtLocateNodeQuery : public avtLocateQuery
int RGridFindNode(vtkDataSet *, float&, float*);
int DeterminePickedNode(vtkDataSet *, int, float*);
int FindClosestPoint(vtkDataSet *, float*, int &);
int FindClosestPointOnLine(vtkDataSet *,
float &,
float [3]);
};
......
......@@ -62,6 +62,8 @@ avtPickByNodeQuery::~avtPickByNodeQuery()
// Creation: May 10, 2004
//
// Modifications:
// Kathleen Bonnell, Thu Jul 8 16:42:05 PDT 2004
// Changed the way that nodeid is modified when accounting for ghost zones.
//
// ****************************************************************************
......@@ -74,41 +76,30 @@ avtPickByNodeQuery::Execute(vtkDataSet *ds, const int dom)
}
int nodeid = pickAtts.GetElementNumber();
int maxEls = ds->GetNumberOfPoints();
// Verify the node number is in range.
if (nodeid < 0 || nodeid >= maxEls)
{
EXCEPTION2(BadNodeException, nodeid, maxEls);
}
int type = ds->GetDataObjectType();
bool needRealId = ghostType == AVT_HAS_GHOSTS &&
(type == VTK_STRUCTURED_GRID || type == VTK_RECTILINEAR_GRID ||
ds->GetFieldData()->GetArray("vtkOriginalDimensions") != NULL );
// Doing a PickByNode or PickByZone, verify the element number is in range.
int maxEls = ds->GetNumberOfPoints();
if (nodeid < 0 || nodeid >= maxEls)
if (needRealId)
{
EXCEPTION2(BadNodeException, nodeid, maxEls);
}
// Need to convert a nodeid that is Non-Ghost relative
// to a nodeid that is ghost-relative.
nodeid = vtkVisItUtility::NodeGhostIdFromNonGhost(ds, nodeid);
pickAtts.SetElementNumber(nodeid);
}
if (!pickAtts.GetMatSelected() && ghostType != AVT_CREATED_GHOSTS)
{
if (needRealId)
{
int dims[3], ijk[3] = {0, 0, 0};
vtkVisItUtility::GetDimensions(ds, dims);
vtkVisItUtility::GetLogicalIndices(ds, false, nodeid, ijk, false,
false);
vtkIntArray *realDims =
(vtkIntArray*)ds->GetFieldData()->GetArray("avtRealDims");
if (realDims != NULL)
{
ijk[0] += realDims->GetValue(0);
ijk[1] += realDims->GetValue(2);
ijk[2] += realDims->GetValue(4);
}
nodeid = ijk[0] +
ijk[1] * dims[0] +
ijk[2] * dims[0] * dims[1];
pickAtts.SetElementNumber(nodeid);
}
GetNodeCoords(ds, nodeid);
if (RetrieveZones(ds, nodeid))
{
......
......@@ -61,6 +61,8 @@ avtPickByZoneQuery::~avtPickByZoneQuery()
// Creation: May 10, 2004
//
// Modifications:
// Kathleen Bonnell, Thu Jul 8 16:42:05 PDT 2004
// Changed the way that zoneid is modified when accounting for ghost zones.
//
// ****************************************************************************
......@@ -72,42 +74,31 @@ avtPickByZoneQuery::Execute(vtkDataSet *ds, const int dom)
return;
}
int zoneNumber = pickAtts.GetElementNumber();
int zoneid = pickAtts.GetElementNumber();
int maxEls = ds->GetNumberOfCells();
if (zoneid < 0 || zoneid >= maxEls)
{
EXCEPTION2(BadCellException, zoneid+cellOrigin, maxEls+cellOrigin);
}
int type = ds->GetDataObjectType();
bool needRealId = ghostType == AVT_HAS_GHOSTS &&
(type == VTK_STRUCTURED_GRID || type == VTK_RECTILINEAR_GRID ||
ds->GetFieldData()->GetArray("vtkOriginalDimensions") != NULL );
int maxEls = ds->GetNumberOfCells();
if (zoneNumber < 0 || zoneNumber >= maxEls)
if (needRealId)
{
EXCEPTION2(BadCellException, zoneNumber+cellOrigin, maxEls+cellOrigin);
// Need to convert a zoneid that is Non-Ghost relative
// to a zoneid that is ghost-relative.
zoneid = vtkVisItUtility::ZoneGhostIdFromNonGhost(ds, zoneid);
pickAtts.SetElementNumber(zoneid);
}
if (!pickAtts.GetMatSelected() && ghostType != AVT_CREATED_GHOSTS)
{
if (needRealId)
{
int dims[3], ijk[3] = {0, 0, 0};
vtkVisItUtility::GetDimensions(ds, dims);
vtkVisItUtility::GetLogicalIndices(ds, true, zoneNumber, ijk,
false, false);
vtkIntArray *realDims =
(vtkIntArray*)ds->GetFieldData()->GetArray("avtRealDims");
if (realDims != NULL)
{
ijk[0] += realDims->GetValue(0);
ijk[1] += realDims->GetValue(2);
ijk[2] += realDims->GetValue(4);
}
zoneNumber = ijk[0] +
ijk[1] * (dims[0]-1) +
ijk[2] * (dims[0]-1) * (dims[1]-1);
pickAtts.SetElementNumber(zoneNumber);
}
GetZoneCoords(ds, zoneNumber);
if (RetrieveNodes(ds, zoneNumber))
GetZoneCoords(ds, zoneid);
if (RetrieveNodes(ds, zoneid))
{
RetrieveVarInfo(ds);
pickAtts.SetFulfilled(true);
......@@ -175,7 +166,7 @@ avtPickByZoneQuery::Execute(vtkDataSet *ds, const int dom)
//
// Use the cell center as the place to position the pick letter.
//
vtkCell *cell = ds->GetCell(zoneNumber);
vtkCell *cell = ds->GetCell(zoneid);
float parametricCenter[3], center[3];
float weights[28];
int subId = cell->GetParametricCenter(parametricCenter);
......@@ -215,7 +206,7 @@ avtPickByZoneQuery::Execute(vtkDataSet *ds, const int dom)
// locator code that it should use the RealElementNumber in
// determining zone location.
//
pickAtts.SetRealElementNumber(zoneNumber);
pickAtts.SetRealElementNumber(zoneid);
}
}
else
......
<?xml version="1.0"?>
<Plugin name="EnSight" type="database" label="EnSight" version="1.0" enabled="true" dbtype="MTSD" haswriter="false">
<CXXFLAGS> $(ENSIGHT_FLAGS) </CXXFLAGS>
<LDFLAGS> $(ENSIGHT_LIBS) </LDFLAGS>
<Extensions> case </Extensions>
<Files components="M,E">
<Plugin name="EnSight" type="database" label="EnSight" version="1.0" enabled="true" dbtype="MTMD" haswriter="false">
<CXXFLAGS>
$(ENSIGHT_FLAGS)
</CXXFLAGS>
<LDFLAGS>
$(ENSIGHT_LIBS)
</LDFLAGS>
<Extensions>
case
</Extensions>
<Files components="M">
avtEnSightFileFormat.C
vtkVisItGenericEnSightReader.C
vtkVisItEnSightReader.C
vtkVisItEnSight6Reader.C
vtkVisItEnSight6BinaryReader.C
vtkVisItEnSightGoldReader.C
vtkVisItEnSightGoldBinaryReader.C
</Files>
<Files components="E">
avtEnSightFileFormat.C
vtkVisItGenericEnSightReader.C
vtkVisItEnSightReader.C
......
#include <EnSightPluginInfo.h>
#include <avtEnSightFileFormat.h>
#include <avtMTSDFileFormatInterface.h>
#include <avtMTMDFileFormatInterface.h>
#include <avtGenericDatabase.h>
// ****************************************************************************
......@@ -10,13 +10,13 @@
// Returns the type of a EnSight database.
//
// Programmer: childs -- generated by xml2info
// Creation: Tue Apr 22 16:28:14 PST 2003
// Creation: Fri Jul 9 07:46:37 PDT 2004
//
// ****************************************************************************
DatabaseType
EnSightCommonPluginInfo::GetDatabaseType()
{
return DB_TYPE_MTSD;
return DB_TYPE_MTMD;
}
// ****************************************************************************
......@@ -26,7 +26,7 @@ EnSightCommonPluginInfo::GetDatabaseType()
// Returns the default extensions for a EnSight database.
//
// Programmer: childs -- generated by xml2info
// Creation: Tue Apr 22 16:28:14 PST 2003
// Creation: Fri Jul 9 07:46:37 PDT 2004
//
// ****************************************************************************
std::vector<std::string>
......@@ -38,6 +38,24 @@ EnSightCommonPluginInfo::GetDefaultExtensions()
return defaultExtensions;
}
// ****************************************************************************
// Method: EnSightCommonPluginInfo::GetWriter
//
// Purpose:
// Sets up a EnSight writer.
//
// Returns: A EnSight writer.
//
// Programmer: childs -- generated by xml2info
// Creation: Fri Jul 9 07:46:37 PDT 2004
//
// ****************************************************************************