Commit 5f4804b8 authored by hrchilds's avatar hrchilds

Update from July 14, 2003

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@33 18c085ea-50e0-402c-830e-de6fd14e8384
parent ad0de3c0
......@@ -1003,7 +1003,7 @@ else
elsif ($debug_totalview eq $exe_name)
{
# Run totalview
@debugcmd = ("totalview6", $exe_name, "-a", "-dograb", @visitargs);
@debugcmd = ("totalview", $exe_name, "-a", "-dograb", @visitargs);
push(@debugcmd, "-key $security_key") if ($security_key_set);
print STDERR "Running: @debugcmd\n";
$exec_totalview_failed = 0;
......
......@@ -145,3 +145,111 @@ avtRay::SetArbitrator(avtSamplePointArbitrator *arb)
}
// ****************************************************************************
// Method: avtRay::GetFirstSampleOfLongestRun
//
// Purpose:
// Gets the first sample of the longest run.
//
// Programmer: Hank Childs
// Creation: July 14, 2003
//
// ****************************************************************************
int
avtRay::GetFirstSampleOfLongestRun(void) const
{
int longestRun = 0;
int longestRunStartsAt = 0;
int currentRun = 0;
int currentRunStartsAt = 0;
bool inRun = false;
for (int i = 0 ; i < numSamples ; i++)
{
if (validSample[i])
{
if (inRun)
{
currentRun++;
if (currentRun > longestRun)
{
longestRun = currentRun;
longestRunStartsAt = currentRunStartsAt;
}
}
else
{
inRun = true;
currentRunStartsAt = i;
currentRun = 1;
}
}
else
{
inRun = false;
}
}
if (longestRun > 0)
{
return longestRunStartsAt;
}
return -1;
}
// ****************************************************************************
// Method: avtRay::GetLastSampleOfLongestRun
//
// Purpose:
// Gets the first sample of the longest run.
//
// Programmer: Hank Childs
// Creation: July 14, 2003
//
// ****************************************************************************
int
avtRay::GetLastSampleOfLongestRun(void) const
{
int longestRun = 0;
int longestRunStartsAt = 0;
int currentRun = 0;
int currentRunStartsAt = 0;
bool inRun = false;
for (int i = 0 ; i < numSamples ; i++)
{
if (validSample[i])
{
if (inRun)
{
currentRun++;
if (currentRun > longestRun)
{
longestRun = currentRun;
longestRunStartsAt = currentRunStartsAt;
}
}
else
{
inRun = true;
currentRunStartsAt = i;
currentRun = 1;
}
}
else
{
inRun = false;
}
}
if (longestRun > 0)
{
return longestRunStartsAt + longestRun-1;
}
return -1;
}
......@@ -77,6 +77,8 @@ class PIPELINE_API avtRay
{ return numSamples; };
inline int GetFirstSample(void) const;
inline int GetLastSample(void) const;
int GetFirstSampleOfLongestRun(void) const;
int GetLastSampleOfLongestRun(void) const;
static void SetArbitrator(avtSamplePointArbitrator *);
......
......@@ -191,6 +191,9 @@ avtSamplePointCommunicator::Execute(void)
int outMinWidth, outMaxWidth, outMinHeight, outMaxHeight;
imagePartition->GetThisPartition(outMinWidth, outMaxWidth, outMinHeight,
outMaxHeight);
int nv = GetTypedInput()->GetNumberOfVariables();
nv = UnifyMaximumValue(nv);
GetTypedOutput()->SetNumberOfVariables(nv);
GetTypedOutput()->SetVolume(volumeWidth, volumeHeight, volumeDepth);
avtVolume *outvolume = GetTypedOutput()->GetVolume();
outvolume->Restrict(outMinWidth, outMaxWidth, outMinHeight, outMaxHeight);
......
......@@ -49,6 +49,9 @@ avtSamplePointToSurfaceFilter::avtSamplePointToSurfaceFilter()
// Made the surface be output in a form that will be more conducive to
// comparisons.
//
// Hank Childs, Mon Jul 14 20:27:31 PDT 2003
// Better account for holes in volumes.
//
// ****************************************************************************
void
......@@ -100,8 +103,8 @@ avtSamplePointToSurfaceFilter::Execute(void)
}
else
{
int samp1 = ray->GetFirstSample();
int samp2 = ray->GetLastSample();
int samp1 = ray->GetFirstSampleOfLongestRun();
int samp2 = ray->GetLastSampleOfLongestRun();
depth = (samp1 + samp2) / 2;
}
if (depth >= 0)
......
......@@ -217,6 +217,9 @@ avtVariableLegend::GetVarRange(float &amin, float &amax)
//
// Kathleen Bonnell, Wed Mar 19 14:31:42 PST 200
// For constant or invalid range, set number of labels to zero.
//
// Hank Childs, Mon Jul 14 09:54:14 PDT 2003
// Do not assume that the lut is non-NULL. ['3494]
//
// ****************************************************************************
......@@ -246,7 +249,8 @@ avtVariableLegend::SetRange(float nmin, float nmax)
else
{
sBar->SetNumberOfLabelsToDefault();
lut->SetTableRange(min, max);
if (lut != NULL)
lut->SetTableRange(min, max);
sBar->SetRange(min, max);
}
}
......
......@@ -1120,14 +1120,18 @@ QvisColorTableWindow::apply()
// Creation: Mon Jun 11 10:04:17 PDT 2001
//
// Modifications:
//
// Brad Whitlock, Mon Jul 14 15:04:07 PST 2003
// Added code to block signals.
//
// ****************************************************************************
void
QvisColorTableWindow::alignControlPoints()
{
// Align the control points.
spectrumBar->blockSignals(true);
spectrumBar->alignControlPoints();
spectrumBar->blockSignals(false);
// Get the current attributes.
GetCurrentValues(0);
......@@ -1726,7 +1730,10 @@ QvisColorTableWindow::setActiveDiscrete(const QString &ct)
// Creation: Wed Feb 26 15:12:20 PST 2003
//
// Modifications:
//
// Brad Whitlock, Mon Jul 14 14:35:27 PST 2003
// I added code to prevent the spectrum bar from emitting signals while
// it is having color control points added or removed.
//
// ****************************************************************************
void
......@@ -1788,9 +1795,14 @@ QvisColorTableWindow::resizeColorTable(int size)
if(size < ccpl->GetNumColorControlPoints())
{
int rmPoints = ccpl->GetNumColorControlPoints() - size;
spectrumBar->blockSignals(true);
spectrumBar->setSuppressUpdates(true);
for(int i = 0; i < rmPoints; ++i)
spectrumBar->removeControlPoint();
spectrumBar->blockSignals(false);
spectrumBar->setSuppressUpdates(false);
spectrumBar->update();
GetCurrentValues(0);
SetUpdate(false);
Apply();
......@@ -1798,8 +1810,13 @@ QvisColorTableWindow::resizeColorTable(int size)
else if(size > spectrumBar->numControlPoints())
{
int addPoints = size - spectrumBar->numControlPoints();
spectrumBar->blockSignals(true);
spectrumBar->setSuppressUpdates(true);
for(int i = 0; i < addPoints; ++i)
spectrumBar->addControlPoint(GetNextColor());
spectrumBar->blockSignals(false);
spectrumBar->setSuppressUpdates(false);
spectrumBar->update();
GetCurrentValues(0);
SetUpdate(false);
......
......@@ -542,17 +542,35 @@ QvisSpectrumBar::addControlPoint(const QColor &color, float position)
// Figure the position that should be used.
if(index == controlPoints->NumControlPoints() - 1)
{
// Compute the distance to the next point.
float dx = controlPoints->Position(index) - controlPoints->Position(index - 1);
// If the distance is small enough, realign the points and recalculate the
// distance to the next point.
if(dx <= 0.)
{
alignControlPoints();
dx = controlPoints->Position(index) - controlPoints->Position(index - 1);
}
// Add new point to the left.
temp.position = controlPoints->Position(index - 1) +
((controlPoints->Position(index) - controlPoints->Position(index - 1)) *
0.5);
temp.position = controlPoints->Position(index - 1) + dx * 0.5f;
}
else
{
// Compute the distance to the next point.
float dx = controlPoints->Position(index + 1) - controlPoints->Position(index);
// If the distance is small enough, realign the points and recalculate the
// distance to the next point.
if(dx <= 0.)
{
alignControlPoints();
dx = controlPoints->Position(index) - controlPoints->Position(index - 1);
}
// Add new point to the right.
temp.position = controlPoints->Position(index) +
((controlPoints->Position(index + 1) - controlPoints->Position(index)) *
0.5);
temp.position = controlPoints->Position(index) + dx * 0.5f;
}
}
else
......@@ -715,7 +733,9 @@ QvisSpectrumBar::setRawColors(unsigned char *colors, int ncolors)
// Creation: Tue Mar 27 15:01:02 PST 2001
//
// Modifications:
//
// Brad Whitlock, Mon Jul 14 14:44:11 PST 2003
// I added some value checking.
//
// ****************************************************************************
void
......@@ -725,14 +745,18 @@ QvisSpectrumBar::setEditMode(bool val)
{
float *fcolors = new float[256 * 3];
unsigned char *raw = getRawColors(256);
// Turn the unsigned chars into floats.
for(int i = 0; i < 256 * 3; ++i)
fcolors[i] = (float)raw[i] / 255;
// Note that the fcolors array is owned by the controlPoints object after
// the call to SetColorValues.
controlPoints->SetColorValues(fcolors, 256);
if(raw)
{
// Turn the unsigned chars into floats.
for(int i = 0; i < 256 * 3; ++i)
fcolors[i] = (float)raw[i] / 255;
// Note that the fcolors array is owned by the controlPoints object after
// the call to SetColorValues.
controlPoints->SetColorValues(fcolors, 256);
delete [] raw;
}
}
controlPoints->SetEditMode(val);
......@@ -1495,6 +1519,9 @@ QvisSpectrumBar::drawSpectrum()
// Brad Whitlock, Thu Oct 24 11:06:22 PDT 2002
// I removed the restriction that the endpoints lie at 0 and 1.
//
// Brad Whitlock, Mon Jul 14 14:43:04 PST 2003
// I added a little range checking code.
//
// ****************************************************************************
unsigned char *
......@@ -1505,8 +1532,13 @@ QvisSpectrumBar::getRawColors(int range)
ControlPoint *oldpts = NULL, *newpts = NULL;
ControlPoint *c1 = NULL, *c2 = NULL;
// Return early if the range is bad.
if(range < 1)
return 0;
// Allocate memory for the array to be returned.
row = new unsigned char[range * 3];
int arrayLength = range * 3;
row = new unsigned char[arrayLength];
/*******************************************
* Phase I -- If the widget is non-editable
......@@ -1610,6 +1642,7 @@ QvisSpectrumBar::getRawColors(int range)
* Phase IV -- Figure the colors for a row.
********************************************/
c2 = c1;
int consecutiveZeroLengthRanges = 0;
for(ci = 0; ci < npoints - 1; ci++)
{
float delta_r, delta_g, delta_b;
......@@ -1624,22 +1657,26 @@ QvisSpectrumBar::getRawColors(int range)
if(color_range > 1)
{
consecutiveZeroLengthRanges = 0;
if(ci == 0 && color_start_i != 0)
{
for(i = 0; i < color_start_i; i++)
{
row[c++] = (unsigned char)(c1->color[0] * 255);
row[c++] = (unsigned char)(c1->color[1] * 255);
row[c++] = (unsigned char)(c1->color[2] * 255);
if(c < arrayLength)
{
row[c++] = (unsigned char)(c1->color[0] * 255);
row[c++] = (unsigned char)(c1->color[1] * 255);
row[c++] = (unsigned char)(c1->color[2] * 255);
}
}
}
// Figure out some deltas.
if(smoothing())
{
delta_r = (float)(c2->color[0]-c1->color[0])/(float)(color_range-1);
delta_g = (float)(c2->color[1]-c1->color[1])/(float)(color_range-1);
delta_b = (float)(c2->color[2]-c1->color[2])/(float)(color_range-1);
delta_r = (float)(c2->color[0]-c1->color[0])/(float)(color_range-1);
delta_g = (float)(c2->color[1]-c1->color[1])/(float)(color_range-1);
delta_b = (float)(c2->color[2]-c1->color[2])/(float)(color_range-1);
}
else
delta_r = delta_g = delta_b = 0.;
......@@ -1651,9 +1688,12 @@ QvisSpectrumBar::getRawColors(int range)
for(i = color_start_i; i < color_end_i; i++)
{
// Store the colors as 24 bit rgb.
row[c++] = (unsigned char)(r_sum * 255);
row[c++] = (unsigned char)(g_sum * 255);
row[c++] = (unsigned char)(b_sum * 255);
if(c < arrayLength)
{
row[c++] = (unsigned char)(r_sum * 255);
row[c++] = (unsigned char)(g_sum * 255);
row[c++] = (unsigned char)(b_sum * 255);
}
// Add the color deltas.
r_sum += delta_r; g_sum += delta_g; b_sum += delta_b;
......@@ -1663,17 +1703,24 @@ QvisSpectrumBar::getRawColors(int range)
{
for(i = color_end_i; i < range; i++)
{
row[c++] = (unsigned char)(c2->color[0] * 255);
row[c++] = (unsigned char)(c2->color[1] * 255);
row[c++] = (unsigned char)(c2->color[2] * 255);
if(c < arrayLength)
{
row[c++] = (unsigned char)(c2->color[0] * 255);
row[c++] = (unsigned char)(c2->color[1] * 255);
row[c++] = (unsigned char)(c2->color[2] * 255);
}
}
}
}
else
else if(c < arrayLength)
{
row[c++] = (unsigned char)(c1->color[0] * 255);
row[c++] = (unsigned char)(c1->color[1] * 255);
row[c++] = (unsigned char)(c1->color[2] * 255);
// If this is the second zero length range in a row, back up.
if(++consecutiveZeroLengthRanges > 1)
c -= 3;
}
c1++;
......
......@@ -277,6 +277,10 @@ avtSliceFilter::Equivalent(const AttributeGroup *a)
// Hank Childs, Wed Jun 18 11:06:30 PDT 2003
// Request arrays if necessary for different slice types.
//
// Hank Childs, Mon Jul 14 19:50:30 PDT 2003
// Make sure that the info about the origin is up-to-date before eliminating
// domains from potential calculation.
//
// ****************************************************************************
avtPipelineSpecification_p
......@@ -311,11 +315,19 @@ avtSliceFilter::PerformRestriction(avtPipelineSpecification_p spec)
// Give the interval tree the linear equation of the plane and have it
// return a domain list.
//
float normal[3]
if (atts.GetOriginType() == SliceAttributes::Point ||
atts.GetOriginType() == SliceAttributes::Intercept)
{
float normal[3]
= {atts.GetNormal()[0], atts.GetNormal()[1], atts.GetNormal()[2]};
vector<int> domains;
it->GetDomainsList(normal, D, domains);
rv->GetDataSpecification()->GetRestriction()->RestrictDomains(domains);
float origin[3];
GetOrigin(origin[0], origin[1], origin[2]);
float tmpD = normal[0]*origin[0] + normal[1]*origin[1] +
normal[2]*origin[2];
vector<int> domains;
it->GetDomainsList(normal, tmpD, domains);
rv->GetDataSpecification()->GetRestriction()->RestrictDomains(domains);
}
return rv;
}
......
......@@ -35,6 +35,7 @@
#include <NoInputException.h>
#include <ImproperUseException.h>
#include <AbortException.h>
#include <InvalidColortableException.h>
extern ViewerSubject *viewerSubject; // FIX_ME This is a hack.
......@@ -2794,7 +2795,10 @@ ViewerPlot::GetCurrentPlotAtts() const
//
// Eric Brugger, Tue Nov 26 10:59:42 PST 2002
// I added keyframing support.
//
//
// Brad Whitlock, Mon Jul 14 13:50:54 PST 2003
// I made it catch InvalidColortableException.
//
// ****************************************************************************
bool
......@@ -2810,7 +2814,14 @@ ViewerPlot::UpdateColorTable(const char *ctName)
{
if (*plotList[i] != NULL)
{
retval |= (*plotList[i])->SetColorTable(ctName);
TRY
{
retval |= (*plotList[i])->SetColorTable(ctName);
}
CATCH(InvalidColortableException)
{
}
ENDTRY
}
}
......
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