Commit 83fa655a authored by Ken Martin's avatar Ken Martin
Browse files

ENH: some fixes form the main tree

parent 1708ed8f
Data @ ce929ee9
Subproject commit ae37af9fc61a2fcc4116409eb8a6cc2cd660e30e
Subproject commit ce929ee954c72903124ddc6cfac678a62f698a4c
......@@ -432,7 +432,7 @@
output="vtkUnstructuredGrid"
class="vtkPVAdvancedReaderModule"
module_type="Reader"
extensions=".g .e .ex2 .exo .gen .0 .00 .000 .0000"
extensions=".g .e .ex2 .exo .gen .exoII .0 .00 .000 .0000"
file_description="Exodus">
<Source class="vtkPExodusReader"/>
......
......@@ -20,7 +20,7 @@
#include "vtkSMStringListDomain.h"
vtkStandardNewMacro(vtkPVAnimationBatchHelper);
vtkCxxRevisionMacro(vtkPVAnimationBatchHelper, "1.2");
vtkCxxRevisionMacro(vtkPVAnimationBatchHelper, "1.2.4.1");
//---------------------------------------------------------------------------
void vtkPVAnimationBatchHelper::SetAnimationValueInBatch(
......@@ -32,13 +32,13 @@ void vtkPVAnimationBatchHelper::SetAnimationValueInBatch(
return;
}
if (!strcmp(domain->GetClassName(), "vtkSMDoubleRangeDomain"))
if (domain->IsA("vtkSMDoubleRangeDomain"))
{
*file << " [$pvTemp" << sourceID << " GetProperty "
<< property->GetXMLName() << "] SetElement " << idx << " " << value
<< endl;
}
else if (!strcmp(domain->GetClassName(), "vtkSMExtentDomain"))
else if (domain->IsA("vtkSMExtentDomain"))
{
vtkSMIntVectorProperty *ivp =
vtkSMIntVectorProperty::SafeDownCast(property);
......@@ -79,13 +79,13 @@ void vtkPVAnimationBatchHelper::SetAnimationValueInBatch(
break;
}
}
else if (!strcmp(domain->GetClassName(), "vtkSMIntRangeDomain"))
else if (domain->IsA("vtkSMIntRangeDomain"))
{
*file << " [$pvTemp" << sourceID << " GetProperty "
<< property->GetXMLName() << "] SetElement " << idx << " "
<< (int)(floor(value + 0.5)) << endl;
}
else if (!strcmp(domain->GetClassName(), "vtkSMStringListDomain"))
else if (domain->IsA("vtkSMStringListDomain"))
{
vtkSMStringListDomain *sld = vtkSMStringListDomain::SafeDownCast(domain);
if (!sld)
......@@ -96,7 +96,7 @@ void vtkPVAnimationBatchHelper::SetAnimationValueInBatch(
<< property->GetXMLName() << "] SetElement " << idx << " {"
<< sld->GetString((int)(floor(value + 0.5))) << "}" << endl;
}
else if (!strcmp(domain->GetClassName(), "vtkSMStringListRangeDomain"))
else if (domain->IsA("vtkSMStringListRangeDomain"))
{
char val[128];
sprintf(val, "%d", static_cast<int>(floor(value + 0.5)));
......@@ -104,6 +104,10 @@ void vtkPVAnimationBatchHelper::SetAnimationValueInBatch(
<< property->GetXMLName() << "] SetElement " << 2*idx+1 << " " << val
<< endl;
}
else
{
vtkErrorMacro("Missing handler for " << domain->GetClassName() << " domain");
}
*file << " $pvTemp" << sourceID << " UpdateVTKObjects" << endl;
}
......
......@@ -14,6 +14,7 @@
=========================================================================*/
#include "vtkPVAnimationInterfaceEntry.h"
#include "vtkPVConfig.h" // Needed for PARAVIEW_EXPERIMENTAL_USER
#include "vtkCommand.h"
#include "vtkKWEntry.h"
#include "vtkKWFrame.h"
......@@ -77,7 +78,7 @@ public:
//-----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPVAnimationInterfaceEntry);
vtkCxxRevisionMacro(vtkPVAnimationInterfaceEntry, "1.52");
vtkCxxRevisionMacro(vtkPVAnimationInterfaceEntry, "1.52.2.1");
vtkCxxSetObjectMacro(vtkPVAnimationInterfaceEntry, CurrentSMDomain,
vtkSMDomain);
......
......@@ -84,7 +84,7 @@
//----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPVDisplayGUI);
vtkCxxRevisionMacro(vtkPVDisplayGUI, "1.9");
vtkCxxRevisionMacro(vtkPVDisplayGUI, "1.9.2.1");
int vtkPVDisplayGUICommand(ClientData cd, Tcl_Interp *interp,
int argc, char *argv[]);
......@@ -1108,111 +1108,7 @@ void vtkPVDisplayGUI::UpdateInternal()
this->OpacityScale->SetValue(this->PVSource->GetPartDisplay()->GetOpacity());
vtkPVDataInformation* dataInfo = source->GetDataInformation();
char tmp[350], volCmd[1024], defCmd[350];
int i, numArrays, numComps;
vtkPVDataSetAttributesInformation *attrInfo;
vtkPVArrayInformation *arrayInfo;
int defPoint = 0;
vtkPVArrayInformation *defArray, *inputArray, *volRenArray;
int dataType = dataInfo->GetDataSetType();
// Default is the scalars to use when current color is not found.
// This is sort of a mess, and should be handled by a color selection widget.
defCmd[0] = '\0';
defArray = NULL;
inputArray = NULL;
volRenArray = NULL;
const char *currentVolumeField = this->VolumeScalarsMenu->GetValue();
this->VolumeScalarsMenu->ClearEntries();
attrInfo = dataInfo->GetPointDataInformation();
numArrays = attrInfo->GetNumberOfArrays();
int firstField = 1;
for (i = 0; i < numArrays; i++)
{
arrayInfo = attrInfo->GetArrayInformation(i);
numComps = arrayInfo->GetNumberOfComponents();
sprintf(volCmd, "VolumeRenderPointField {%s}", arrayInfo->GetName());
if (numComps > 1)
{
sprintf(tmp, "Point %s (%d)", arrayInfo->GetName(), numComps);
}
else
{
sprintf(tmp, "Point %s", arrayInfo->GetName());
this->VolumeScalarsMenu->AddEntryWithCommand(tmp, this, volCmd);
if ( firstField || (strcmp(tmp, currentVolumeField) == 0) )
{
this->VolumeScalarsMenu->SetValue( tmp );
volRenArray = arrayInfo;
firstField = 0;
}
}
if (attrInfo->IsArrayAnAttribute(i) == vtkDataSetAttributes::SCALARS)
{
strcpy(defCmd, tmp);
defPoint = 1;
defArray = arrayInfo;
if ( !strlen(currentVolumeField) )
{
volRenArray = arrayInfo;
this->VolumeScalarsMenu->SetValue( tmp );
}
}
}
attrInfo = dataInfo->GetCellDataInformation();
numArrays = attrInfo->GetNumberOfArrays();
for (i = 0; i < numArrays; i++)
{
arrayInfo = attrInfo->GetArrayInformation(i);
numComps = arrayInfo->GetNumberOfComponents();
sprintf(volCmd, "VolumeRenderCellField {%s}", arrayInfo->GetName());
if (numComps > 1)
{
sprintf(tmp, "Cell %s (%d)", arrayInfo->GetName(), numComps);
}
else
{
sprintf(tmp, "Cell %s", arrayInfo->GetName());
this->VolumeScalarsMenu->AddEntryWithCommand(tmp, this, volCmd);
if ( firstField || (strcmp(tmp, currentVolumeField) == 0) )
{
this->VolumeScalarsMenu->SetValue( tmp );
volRenArray = arrayInfo;
firstField = 0;
}
}
if (attrInfo->IsArrayAnAttribute(i) == vtkDataSetAttributes::SCALARS)
{
strcpy(defCmd, tmp);
defPoint = 1;
defArray = arrayInfo;
if ( !strlen(currentVolumeField) )
{
volRenArray = arrayInfo;
this->VolumeScalarsMenu->SetValue( tmp );
}
}
}
// Determine if this is unstructured grid data and add the
// volume rendering option
if ( this->RepresentationMenu->HasEntry( VTK_PV_VOLUME_LABEL ) )
{
this->RepresentationMenu->DeleteEntry( VTK_PV_VOLUME_LABEL );
}
if (dataType == VTK_UNSTRUCTURED_GRID && volRenArray)
{
this->RepresentationMenu->AddEntryWithCommand(VTK_PV_VOLUME_LABEL, this,
"DrawVolume");
// Update the transfer functions
pDisp->InitializeTransferFunctions(volRenArray, dataInfo);
}
this->UpdateVolumeGUI();
}
......@@ -1468,6 +1364,127 @@ void vtkPVDisplayGUI::UpdateInterpolateColorsCheck()
this->UpdateEnableState();
}
//-----------------------------------------------------------------------------
void vtkPVDisplayGUI::UpdateVolumeGUI()
{
vtkSMPartDisplay *pDisp = this->PVSource->GetPartDisplay();
char tmp[350], volCmd[1024], defCmd[350];
int i, numArrays, numComps;
vtkPVDataInformation *dataInfo = this->PVSource->GetDataInformation();
vtkPVDataSetAttributesInformation *attrInfo;
vtkPVArrayInformation *arrayInfo;
int defPoint = 0;
vtkPVArrayInformation *defArray, *inputArray, *volRenArray;
int dataType = dataInfo->GetDataSetType();
this->VolumeRenderMode = pDisp->GetVolumeRenderMode();
// Default is the scalars to use when current color is not found.
// This is sort of a mess, and should be handled by a color selection widget.
defCmd[0] = '\0';
defArray = NULL;
inputArray = NULL;
volRenArray = NULL;
const char *currentVolumeField = pDisp->GetVolumeRenderField();
this->VolumeScalarsMenu->ClearEntries();
attrInfo = dataInfo->GetPointDataInformation();
numArrays = attrInfo->GetNumberOfArrays();
int firstField = 1;
for (i = 0; i < numArrays; i++)
{
arrayInfo = attrInfo->GetArrayInformation(i);
numComps = arrayInfo->GetNumberOfComponents();
sprintf(volCmd, "VolumeRenderPointField {%s} %d",
arrayInfo->GetName(), numComps);
if (numComps > 1)
{
sprintf(tmp, "Point %s (%d)", arrayInfo->GetName(), numComps);
}
else
{
sprintf(tmp, "Point %s", arrayInfo->GetName());
}
this->VolumeScalarsMenu->AddEntryWithCommand(tmp, this, volCmd);
if ( firstField
|| ( currentVolumeField
&& (pDisp->GetColorField() == vtkDataSet::POINT_DATA_FIELD)
&& (strcmp(arrayInfo->GetName(), currentVolumeField) == 0) ) )
{
this->VolumeScalarsMenu->SetValue( tmp );
volRenArray = arrayInfo;
firstField = 0;
}
if (attrInfo->IsArrayAnAttribute(i) == vtkDataSetAttributes::SCALARS)
{
strcpy(defCmd, tmp);
defPoint = 1;
defArray = arrayInfo;
if (!currentVolumeField)
{
volRenArray = arrayInfo;
this->VolumeScalarsMenu->SetValue( tmp );
}
}
}
attrInfo = dataInfo->GetCellDataInformation();
numArrays = attrInfo->GetNumberOfArrays();
for (i = 0; i < numArrays; i++)
{
arrayInfo = attrInfo->GetArrayInformation(i);
numComps = arrayInfo->GetNumberOfComponents();
sprintf(volCmd, "VolumeRenderCellField {%s} %d",
arrayInfo->GetName(), numComps);
if (numComps > 1)
{
sprintf(tmp, "Cell %s (%d)", arrayInfo->GetName(), numComps);
}
else
{
sprintf(tmp, "Cell %s", arrayInfo->GetName());
}
this->VolumeScalarsMenu->AddEntryWithCommand(tmp, this, volCmd);
if ( firstField
|| ( currentVolumeField
&& (pDisp->GetColorField() == vtkDataSet::CELL_DATA_FIELD)
&& (strcmp(arrayInfo->GetName(), currentVolumeField) == 0) ) )
{
this->VolumeScalarsMenu->SetValue( tmp );
volRenArray = arrayInfo;
firstField = 0;
}
if (attrInfo->IsArrayAnAttribute(i) == vtkDataSetAttributes::SCALARS)
{
strcpy(defCmd, tmp);
defPoint = 1;
defArray = arrayInfo;
if (!currentVolumeField)
{
volRenArray = arrayInfo;
this->VolumeScalarsMenu->SetValue( tmp );
}
}
}
// Determine if this is unstructured grid data and add the
// volume rendering option
if ( this->RepresentationMenu->HasEntry( VTK_PV_VOLUME_LABEL ) )
{
this->RepresentationMenu->DeleteEntry( VTK_PV_VOLUME_LABEL );
}
if (dataType == VTK_UNSTRUCTURED_GRID && volRenArray)
{
this->RepresentationMenu->AddEntryWithCommand(VTK_PV_VOLUME_LABEL, this,
"DrawVolume");
// Update the transfer functions
pDisp->InitializeTransferFunctions(volRenArray, dataInfo);
}
}
//----------------------------------------------------------------------------
void vtkPVDisplayGUI::SetActorColor(double r, double g, double b)
{
......@@ -1526,19 +1543,30 @@ void vtkPVDisplayGUI::ColorByPropertyInternal()
//----------------------------------------------------------------------------
// Select which point field to use for volume rendering
//
void vtkPVDisplayGUI::VolumeRenderPointField(const char *name)
void vtkPVDisplayGUI::VolumeRenderPointField(const char *name, int numComps)
{
if (name == NULL)
{
return;
}
this->AddTraceEntry("$kw(%s) VolumeRenderPointField {%s}",
this->GetTclName(), name);
this->AddTraceEntry("$kw(%s) VolumeRenderPointField {%s} %d",
this->GetTclName(), name, numComps);
this->ArraySetByUser = 1;
char *str;
str = new char [strlen(name) + 16];
if (numComps == 1)
{
sprintf(str, "Point %s", name);
}
else
{
sprintf(str, "Point %s (%d)", name, numComps);
}
this->VolumeScalarsMenu->SetValue(str);
delete[] str;
// Update the transfer functions
vtkPVDataInformation* dataInfo = this->GetPVSource()->GetDataInformation();
......@@ -1547,10 +1575,7 @@ void vtkPVDisplayGUI::VolumeRenderPointField(const char *name)
this->PVSource->GetPartDisplay()->ResetTransferFunctions(arrayInfo, dataInfo);
this->VolumeScalarsMenu->SetValue(str);
this->VolumeRenderPointFieldInternal(name);
delete [] str;
}
//----------------------------------------------------------------------------
......@@ -1567,19 +1592,30 @@ void vtkPVDisplayGUI::VolumeRenderPointFieldInternal(const char *name)
//----------------------------------------------------------------------------
// Select which cell field to use for volume rendering
//
void vtkPVDisplayGUI::VolumeRenderCellField(const char *name)
void vtkPVDisplayGUI::VolumeRenderCellField(const char *name, int numComps)
{
if (name == NULL)
{
return;
}
this->AddTraceEntry("$kw(%s) VolumeRenderCellField {%s}",
this->GetTclName(), name);
this->AddTraceEntry("$kw(%s) VolumeRenderCellField {%s} %d",
this->GetTclName(), name, numComps);
this->ArraySetByUser = 1;
char *str;
str = new char [strlen(name) + 16];
if (numComps == 1)
{
sprintf(str, "Cell %s", name);
}
else
{
sprintf(str, "Cell %s (%d)", name, numComps);
}
this->VolumeScalarsMenu->SetValue(str);
delete[] str;
// Update the transfer functions
vtkPVDataInformation* dataInfo = this->GetPVSource()->GetDataInformation();
......@@ -1588,10 +1624,7 @@ void vtkPVDisplayGUI::VolumeRenderCellField(const char *name)
this->PVSource->GetPartDisplay()->ResetTransferFunctions(arrayInfo, dataInfo);
this->VolumeScalarsMenu->SetValue(str);
this->VolumeRenderCellFieldInternal(name);
delete [] str;
}
//----------------------------------------------------------------------------
......@@ -1825,6 +1858,13 @@ void vtkPVDisplayGUI::DrawPoints()
//----------------------------------------------------------------------------
void vtkPVDisplayGUI::DrawVolume()
{
if (this->PVSource->GetDataInformation()->GetNumberOfCells() > 500000)
{
vtkWarningMacro("Sorry. Unstructured grids with more than 500,000 "
"cells cannot currently be rendered with ParaView. "
"Consider thresholding cells you are not interested in.");
return;
}
if (this->GetPVSource()->GetInitialized())
{
this->AddTraceEntry("$kw(%s) DrawVolume", this->GetTclName());
......@@ -1893,6 +1933,34 @@ void vtkPVDisplayGUI::VolumeRenderModeOff()
this->ColorFrame->GetWidgetName(),
this->ViewFrame->GetWidgetName() );
// Make the color selection the same as the scalars we were just volume
// rendering.
if (this->VolumeRenderMode)
{
const char *colorSelection = this->VolumeScalarsMenu->GetValue();
char *str = new char[strlen(colorSelection) + 1];
strcpy(str, colorSelection);
char *mode = strtok(str, " ");
char *name = strtok(NULL, " ");
char *numCompsStr = strtok(NULL, " ");
int numComps = 1;
if (numCompsStr)
{
sscanf(numCompsStr, "(%d)", &numComps);
}
if (strcmp(mode, "Point") == 0)
{
this->ColorByPointField(name, numComps);
}
else
{
this->ColorByCellField(name, numComps);
}
delete[] str;
}
this->VolumeRenderMode = 0;
this->UpdateEnableState();
}
......@@ -1910,6 +1978,36 @@ void vtkPVDisplayGUI::VolumeRenderModeOn()
this->Script("pack %s -after %s -fill x -expand t -pady 2",
this->VolumeAppearanceFrame->GetWidgetName(),
this->ViewFrame->GetWidgetName() );
// Make scalar selection be the same for colors.
if (!this->VolumeRenderMode)
{
const char *colorSelection = this->ColorMenu->GetValue();
if (strcmp(colorSelection, "Property") != 0)
{
char *str = new char[strlen(colorSelection) + 1];
strcpy(str, colorSelection);
char *mode = strtok(str, " ");
char *name = strtok(NULL, " ");
char *numCompsStr = strtok(NULL, " ");
int numComps = 1;
if (numCompsStr)
{
sscanf(numCompsStr, "(%d)", &numComps);
}
if (strcmp(mode, "Point") == 0)
{
this->VolumeRenderPointField(name, numComps);
}
else
{
this->VolumeRenderCellField(name, numComps);
}
delete[] str;
}
}
this->VolumeRenderMode = 1;
this->UpdateEnableState();
......
......@@ -134,6 +134,7 @@ public:
void Update();
void UpdateCubeAxesVisibilityCheck();
void UpdateColorGUI();
void UpdateVolumeGUI();
// Description:
// This method is meant to setup the actor/mapper
......@@ -220,11 +221,11 @@ public:
// Description:
// Select a point field to use for volume rendering
void VolumeRenderPointField(const char *name);
void VolumeRenderPointField(const char *name, int numComps);
// Description:
// Select a cell field to use for volume rendering
void VolumeRenderCellField(const char *name);
void VolumeRenderCellField(const char *name, int numComps);
// Description:
// Called by vtkPVSource::DeleteCallback().
......
......@@ -72,7 +72,7 @@ public:
//----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPVFileEntry);
vtkCxxRevisionMacro(vtkPVFileEntry, "1.95");
vtkCxxRevisionMacro(vtkPVFileEntry, "1.95.2.1");
//----------------------------------------------------------------------------
vtkPVFileEntry::vtkPVFileEntry()
......@@ -646,6 +646,7 @@ void vtkPVFileEntry::SetValue(const char* fileName)
if ( strcmp(fullPath.str(), dom->GetString(i)) == 0 )
{
this->SetTimeStep(i);
this->TimeStep = i;
break;
}
}
......@@ -1027,12 +1028,12 @@ void vtkPVFileEntry::UpdateTimeStep()
int ts = this->FileListSelect->GetElementIndexFromFinalList(file);
if ( ts < 0 )
{
cout << "This should not have happended" << endl;
cout << "Cannot find \"" << file << "\" on the list" << endl;
cerr << "This should not have happended" << endl;
cerr << "Cannot find \"" << file << "\" on the list" << endl;
int cc;
for ( cc = 0; cc < this->FileListSelect->GetNumberOfElementsOnFinalList(); cc ++ )
{
cout << "Element: " << this->FileListSelect->GetElementFromFinalList(cc) << endl;
cerr << "Element: " << this->FileListSelect->GetElementFromFinalList(cc) << endl;
}
vtkPVApplication::Abort();
}
......
......@@ -67,7 +67,7 @@
vtkStandardNewMacro(vtkPVSource);
vtkCxxRevisionMacro(vtkPVSource, "1.395.2.1");
vtkCxxRevisionMacro(vtkPVSource, "1.395.2.2");
vtkCxxSetObjectMacro(vtkPVSource,Notebook,vtkPVSourceNotebook);
vtkCxxSetObjectMacro(vtkPVSource,PartDisplay,vtkSMPartDisplay);
......@@ -632,6 +632,8 @@ void vtkPVSource::Select()
it->GoToNextItem();
}
it->Delete();
this->Notebook->ShowPage("Display");
this->Notebook->ShowPage("Information");
}
//----------------------------------------------------------------------------
......
......@@ -130,7 +130,7 @@
//-----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPVWindow);
vtkCxxRevisionMacro(vtkPVWindow, "1.615");
vtkCxxRevisionMacro(vtkPVWindow, "1.615.2.1");
int vtkPVWindowCommand(ClientData cd, Tcl_Interp *interp,
int argc, char *argv[]);
......@@ -518,8 +518,11 @@ void vtkPVWindow::PrepareForDelete()
this->Toolbar->Delete();
this->Toolbar = NULL;
}
if ( this->ToolbarMenuButton )
{
this->ToolbarMenuButton->Delete();
this->ToolbarMenuButton = 0;
}
if (this->PickCenterButton)
{
......@@ -983,6 +986,7 @@ void vtkPVWindow::ToolbarMenuCheckCallback(const char* buttonName)
this->Toolbar->RemoveWidget(button);