Commit b69df8d7 authored by hrchilds's avatar hrchilds
Browse files

Update from June 3, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@255 18c085ea-50e0-402c-830e-de6fd14e8384
parent b21e77f1
......@@ -114,6 +114,11 @@
# Sean Ahern, Tue Sep 3 10:36:00 PDT 2002
# Used "ct pwv" to see if we're in a view, rather than checking
# CLEARCASE_ROOT, which doesn't always seem to be set.
#
# Mark C. Miller, Thu Jun 3 10:12:39 PDT 2004
# Made the add_vob_objects function able to recognize views that
# had been started via 'ct startview' as well as set via 'ct setview'
#
require 5.003;
use Getopt::Long;
......@@ -225,9 +230,10 @@ sub add_vob_objects ($@) {
my ($i, $dir, $src, $version) = (0);
local ($_);
chomp($view = `cleartool pwv`);
$setView = `cleartool pwv | grep Set`;
$workView = `cleartool pwv | grep Working`;
return if ($CHILD_ERROR != 0);
return if ($view =~ /NONE/);
return if ($setView =~ /NONE/ && $workView =~ /NONE/ );
print STDERR "Looking for ClearCase vob objects (this may take a while)..."
unless $Quiet;
......
......@@ -68,6 +68,9 @@ $0 = shift @ARGV;
# Eric Brugger, Thu Nov 20 08:23:40 PST 2003
# Pass along -withhelp option to source_files command.
#
# Mark C. Miller, Thu Jun 3 10:12:39 PDT 2004
# Added '-f' flag to the recursive chmod
#
require "newgetopt.pl";
......@@ -144,7 +147,7 @@ EOF
exit(-5);
}
$status = system("chmod -R u+w $dist");
$status = system("chmod -Rf u+w $dist");
$status /= 256;
if ($status != 0)
{
......
......@@ -4,27 +4,19 @@
#include <avtLocateCellQuery.h>
#include <vtkBox.h>
#include <vtkCell.h>
#include <vtkCellData.h>
#include <vtkDataSet.h>
#include <vtkMath.h>
#include <vtkPoints.h>
#include <vtkRectilinearGrid.h>
#include <vtkUnsignedCharArray.h>
#include <vtkVisItCellLocator.h>
#include <vtkVisItUtility.h>
#include <avtTerminatingSource.h>
#include <DebugStream.h>
#include <math.h>
#include <float.h>
#include <avtParallel.h>
using std::string;
// ****************************************************************************
// Method: avtLocateCellQuery constructor
......@@ -42,12 +34,13 @@ using std::string;
// Kathleen Bonnell, Thu Apr 17 09:39:19 PDT 2003
// Removed invTransform.
//
// Kathleen Bonnell, Wed Jun 2 10:21:50 PDT 2004
// Moved code to new parent class, avtLocateQuery.
//
// ****************************************************************************
avtLocateCellQuery::avtLocateCellQuery()
{
foundZone = foundDomain = -1;
minDist = +FLT_MAX;
}
......@@ -69,67 +62,6 @@ avtLocateCellQuery::~avtLocateCellQuery()
}
// ****************************************************************************
// Method: avtLocateCellQuery::PreExecute
//
// Purpose:
// This is called before any of the domains are executed.
//
// Programmer: Kathleen Bonnell
// Creation: November 15, 2002
//
// Modifications:
// Kathleen Bonnell, Fri Jan 31 11:34:03 PST 2003
// Initialize minDist.
//
// Kathleen Bonnell, Mon Apr 14 09:26:46 PDT 2003
// Retrieve the inverse transformation matrix if it is available and
// can be used.
//
// Kathleen Bonnell, Thu Apr 17 09:39:19 PDT 2003
// Removed code to retrieve the inverse transformation matrix.
//
// ****************************************************************************
void
avtLocateCellQuery::PreExecute(void)
{
foundZone = foundDomain = -1;
minDist = +FLT_MAX;
}
// ****************************************************************************
// Method: avtLocateCellQuery::PostExecute
//
// Purpose:
// This is called after all of the domains are executed.
//
// Programmer: Kathleen Bonnell
// Creation: November 15, 2002
//
// Modifications:
// Kathleen Bonnell, Fri Jan 31 11:34:03 PST 2003
// Ensure that only the processor that found the intersection point with
// minimum distance will pass it's information to the queryAtts.
// Removed "message" code, as the messaging is handled in the Viewer.
//
// Kathleen Bonnell, Tue Nov 4 08:18:54 PST 2003
// Use pickAtts instead of queryAtts.
//
// ****************************************************************************
void
avtLocateCellQuery::PostExecute(void)
{
if (ThisProcessorHasMinimumValue(minDist))
{
pickAtts.SetDomain(foundDomain);
pickAtts.SetElementNumber(foundZone);
}
}
// ****************************************************************************
// Method: avtLocateCellQuery::Execute
//
......@@ -172,9 +104,12 @@ avtLocateCellQuery::PostExecute(void)
// Use pickAtts instead of queryAtts.
//
// Kathleen Bonnell, Thu May 6 14:28:00 PDT 2004
// Set foundZone (used to set pickAtts.ElementNumber) to the foundCell
// Set foundElement (used to set pickAtts.ElementNumber) to the foundCell
// if the zones have not been invalidated (ZonesPreserved).
//
// Kathleen Bonnell, Tue May 18 13:12:09 PDT 2004
// Move node-specific code to avtLocateNodeQuery.
//
// ****************************************************************************
void
......@@ -204,8 +139,6 @@ avtLocateCellQuery::Execute(vtkDataSet *ds, const int dom)
minDist = dist;
pickAtts.SetPickPoint(isect);
if (pickAtts.GetPickType() == PickAttributes::Node)
DeterminePickedNode(ds, foundCell, isect);
vtkDataArray *origCells =
ds->GetCellData()->GetArray("avtOriginalCellNumbers");
......@@ -213,7 +146,7 @@ avtLocateCellQuery::Execute(vtkDataSet *ds, const int dom)
if (origCells)
{
int comp = origCells->GetNumberOfComponents() -1;
foundZone = (int) origCells->GetComponent(foundCell, comp);
foundElement = (int) origCells->GetComponent(foundCell, comp);
}
else if (GetInput()->GetInfo().GetAttributes().
GetContainsOriginalCells())
......@@ -225,14 +158,16 @@ avtLocateCellQuery::Execute(vtkDataSet *ds, const int dom)
else if (GetInput()->GetInfo().GetValidity().GetZonesPreserved() &&
GetInput()->GetInfo().GetAttributes().GetContainsGhostZones()
!= AVT_CREATED_GHOSTS)
foundZone = foundCell;
{
foundElement = foundCell;
}
//
// There is no need to 'fudge' the intersection point unless
// avtLocateCellQuery will be using it to find the Zone number and
// we are in 3D.
//
if (foundZone == -1 && dim == 3)
if (foundElement == -1 && dim == 3)
{
vtkCell *cell = ds->GetCell(foundCell);
float parametricCenter[3];
......@@ -247,108 +182,6 @@ avtLocateCellQuery::Execute(vtkDataSet *ds, const int dom)
}
// ****************************************************************************
// Method: avtLocateCellQuery::LocatorFindCell
//
// Purpose:
// Uses a locator to find the cell intersected by the pick ray.
// Ignores ghost zones.
//
// Arguments:
// ds The dataset to query.
// dist A place to store the distance along the ray of the
// intersection point.
// isect A place to store the intersection point of the ray with the
// dataset.
//
// Returns:
// The id of the cell that was intersected (-1 if none found).
//
// Programmer: Kathleen Bonnell
// Creation: May 7, 2003
//
// Modifications:
// Kathleen Bonnell, Tue Jun 3 15:20:35 PDT 2003
// Removed tolerance parameter (based on the diagonal length of the dataset)
// in favor of a tolerance calculated from the MinimumCellLength as
// determined by the locator.
//
// Kathleen Bonnell, Wed Jun 18 17:52:45 PDT 2003
// Use new IntersectWithLine routine from cellLocator. It doesn't require
// the calculation of a tolerance.
//
// Kathleen Bonnell, Thu Jun 19 16:50:41 PDT 2003
// Test for no cells in ds.
//
// Kathleen Bonnell, Wed Jul 23 15:51:45 PDT 2003
// Added logic for World pick (indicated by rayPoint1 == rayPoint2).
//
// Kathleen Bonnell, Tue Nov 4 15:00:04 PST 2003
// Use pickAtts insteead of queryAtts.
// Specify the bounds for cellLocator to use when doing spatial decomp.
//
// Kathleen Bonnell, Wed Apr 14 10:26:19 PDT 2004
// Initialize variables to protect against possible incorrect values
// being returned.
//
// ****************************************************************************
int
avtLocateCellQuery::LocatorFindCell(vtkDataSet *ds, float &dist, float *isect)
{
if (ds->GetNumberOfCells() == 0)
{
return -1;
}
float *rayPt1 = pickAtts.GetRayPoint1();
float *rayPt2 = pickAtts.GetRayPoint2();
dist = -1;
vtkVisItCellLocator *cellLocator = vtkVisItCellLocator::New();
cellLocator->SetIgnoreGhosts(true);
cellLocator->SetDataSet(ds);
//
// Cells may have been removed, and unused points may still exist,
// giving the dataset larger bounds than just the cell bounds, so
// tell the locator to use the actual bounds retrieved from the
// plot that originated this query. The locator will use these
// bounds only if they are smaller than the dataset bounds.
//
cellLocator->SetUserBounds(pickAtts.GetPlotBounds());
cellLocator->BuildLocator();
float pcoords[3] = {0., 0., 0.}, ptLine[3] = {0., 0., 0.};
int subId = 0, success = 0;
vtkIdType foundCell;
if (rayPt1[0] == rayPt2[0] &&
rayPt1[1] == rayPt2[1] &&
rayPt1[2] == rayPt2[2])
{
cellLocator->FindClosestPoint(rayPt1, ptLine, foundCell,
subId, dist);
if (foundCell >= 0 && dist >= 0)
{
success = 1;
isect[0] = rayPt1[0];
isect[1] = rayPt1[1];
isect[2] = rayPt1[2];
}
}
else
{
success = cellLocator->IntersectWithLine(rayPt1, rayPt2, dist,
isect, pcoords, subId, foundCell);
}
cellLocator->Delete();
if (success)
return foundCell;
else
return -1;
}
// ****************************************************************************
// Method: avtLocateCellQuery::RGridFindCell
//
......@@ -383,52 +216,19 @@ avtLocateCellQuery::LocatorFindCell(vtkDataSet *ds, float &dist, float *isect)
// Replaced vtkCell::HitBBox with vtkBox::IntersectBox, as the old
// method is soon to be obsoleted in vtk.
//
// Kathleen Bonnell, Wed Jun 2 10:21:50 PDT 2004
// Moved Isect code to RGridIsect.
//
// ****************************************************************************
int
avtLocateCellQuery::RGridFindCell(vtkDataSet *ds, float &dist, float *isect)
{
vtkRectilinearGrid *rgrid = (vtkRectilinearGrid*)ds;
int i, cellId = -1;
float t, dsBounds[6], rayDir[3];
float *rayPt1 = pickAtts.GetRayPoint1();
float *rayPt2 = pickAtts.GetRayPoint2();
int ijk[3], success = 0;
vtkRectilinearGrid *rgrid = vtkRectilinearGrid::SafeDownCast(ds);
int ijk[3], cellId = -1;
rgrid->GetBounds(dsBounds);
if (rayPt1[0] == rayPt2[0] &&
rayPt1[1] == rayPt2[1] &&
rayPt1[2] == rayPt2[2])
{
success = vtkVisItUtility::ComputeStructuredCoordinates(rgrid, rayPt1, ijk);
if (success)
{
isect[0] = rayPt1[0];
isect[1] = rayPt1[1];
isect[2] = rayPt1[2];
dist = 0;
}
}
else
{
for (i = 0; i < 3; i++)
{
rayDir[i] = rayPt2[i] - rayPt1[i];
}
if (vtkBox::IntersectBox(dsBounds, rayPt1, rayDir, isect, t))
{
success = vtkVisItUtility::ComputeStructuredCoordinates(rgrid,
isect, ijk);
if (success)
{
dist = vtkMath::Distance2BetweenPoints(rayPt1, isect);
}
}
}
if (success)
if (RGridIsect(rgrid, dist, isect, ijk))
{
cellId = rgrid->ComputeCellId(ijk);
vtkUnsignedCharArray *ghosts = (vtkUnsignedCharArray *)ds->
......@@ -441,104 +241,3 @@ avtLocateCellQuery::RGridFindCell(vtkDataSet *ds, float &dist, float *isect)
return cellId;
}
// ****************************************************************************
// Method: avtLocateCellQuery::DeterminePickedNode
//
// Purpose:
// Finds the closest node-point to the picked point.
//
// Arguments:
// ds The dataset to retrieve information from.
// foundEl the picked ZONE
// ppoint the node's coordinates.
//
//
// Programmer: Kathleen Bonnell
// Creation: June 27, 2003
//
// Modifications:
// Kathleen Bonnell, Tue Nov 4 08:18:54 PST 2003
// Use pickAtts instead of queryAtts.
//
// ****************************************************************************
void
avtLocateCellQuery::DeterminePickedNode(vtkDataSet *ds, int foundEl, float *ppoint)
{
vtkIdType minId = -1;
vtkPoints *points = vtkVisItUtility::GetPoints(ds);
//
// VTK's FindPoint method is faster than the brute force method
// in the else-part, but only for Rectilinear grids.
//
if (ds->GetDataObjectType() == VTK_RECTILINEAR_GRID)
{
minId = ds->FindPoint(ppoint);
}
else
{
vtkIdList *ptIds = vtkIdList::New();
vtkIdType id;
ds->GetCellPoints(foundEl, ptIds);
int numPts = ptIds->GetNumberOfIds();
float dist2;
float minDist2 = FLT_MAX;
for (int i = 0; i < numPts; i++)
{
id = ptIds->GetId(i);
dist2 = vtkMath::Distance2BetweenPoints(ppoint,
points->GetPoint(id));
if (dist2 < minDist2)
{
minDist2 = dist2;
minId = id;
}
}
ptIds->Delete();
}
if ( minId != -1)
pickAtts.SetNodePoint(points->GetPoint(minId));
}
// ****************************************************************************
// Method: avtLocateCellQuery::SetPickAtts
//
// Purpose:
// Sets the pickAtts to the passed values.
//
// Programmer: Kathleen Bonnell
// Creation: November 4, 2003
//
// ****************************************************************************
void
avtLocateCellQuery::SetPickAtts(const PickAttributes *pa)
{
pickAtts = *pa;
}
// ****************************************************************************
// Method: avtLocateCellQuery::GetPickAtts
//
// Purpose:
//
// Programmer: Kathleen Bonnell
// Creation: November 4, 2003
//
// ****************************************************************************
const PickAttributes *
avtLocateCellQuery::GetPickAtts()
{
return &pickAtts;
}
......@@ -6,10 +6,7 @@
#define AVT_LOCATE_CELL_QUERY_H
#include <query_exports.h>
#include <avtDatasetQuery.h>
#include <PickAttributes.h>
#include <string>
#include <avtLocateQuery.h>
class vtkDataSet;
......@@ -48,9 +45,13 @@ class vtkDataSet;
// Moved inlined destructor definition to .C file because certain compilers
// have problems with them.
//
// Kathleen Bonnell, Tue May 18 13:12:09 PDT 2004
// Inherit from avtLocateQuery. Moved Node specific code to
// avtLocateNodeQuery.
//
// ****************************************************************************
class QUERY_API avtLocateCellQuery : public avtDatasetQuery
class QUERY_API avtLocateCellQuery : public avtLocateQuery
{
public:
avtLocateCellQuery();
......@@ -61,25 +62,10 @@ class QUERY_API avtLocateCellQuery : public avtDatasetQuery
virtual const char *GetDescription(void)
{ return "Locating cell."; };
void SetPickAtts(const PickAttributes *);
const PickAttributes *GetPickAtts(void);
protected:
PickAttributes pickAtts;
int foundDomain;
int foundZone;
float minDist;
virtual void Execute(vtkDataSet *, const int);
virtual void PreExecute(void);
virtual void PostExecute(void);
int LocatorFindCell(vtkDataSet *,
float &, float*);
int RGridFindCell(vtkDataSet *,
float &, float*);
void DeterminePickedNode(vtkDataSet *,
int, float*);
};
......
// ************************************************************************* //
// avtPickByNodeQuery.C //
// ************************************************************************* //
#include <avtPickByNodeQuery.h>
#include <vtkDataSet.h>
#include <vtkFieldData.h>
#include <vtkPoints.h>
#include <vtkIntArray.h>
#include <vtkVisItUtility.h>
#include <avtMatrix.h>
#include <avtTerminatingSource.h>
#include <avtVector.h>
#include <BadNodeException.h>
// ****************************************************************************
// Method: avtPickByNodeQuery constructor
//
// Programmer: Kathleen Bonnell
// Creation: May 10, 2004
//
// Modifications:
//
// ****************************************************************************
avtPickByNodeQuery::avtPickByNodeQuery()
{
}
// ****************************************************************************
// Method: avtPickByNodeQuery destructor
//
// Purpose:
// Defines the destructor. Note: this should not be inlined in the header
// because it causes problems for certain compilers.
//
// Programmer: Kathleen Bonnell
// Creation: May 10, 2004
//
// Modifications:
//
// ****************************************************************************
avtPickByNodeQuery::~avtPickByNodeQuery()
{
}
// ****************************************************************************
// Method: avtPickByNodeQuery::Execute
//
// Purpose:
// Processes a single domain.
//
// Programmer: Kathleen Bonnell
// Creation: May 10, 2004
//
// Modifications:
//
// ****************************************************************************
void
avtPickByNodeQuery::Execute(vtkDataSet *ds, const int dom)
{
if (dom != pickAtts.GetDomain() || pickAtts.GetFulfilled() || ds == NULL)
{
return;
}
int nodeid = pickAtts.GetElementNumber();
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)
{
EXCEPTION2(BadNodeException, nodeid, maxEls);
}