Commit 13801a23 authored by Sebastien Jourdain's avatar Sebastien Jourdain

Fix some array name with 0 in ExodusReader

parent bb57c5a1
......@@ -418,73 +418,6 @@ bool vtkPMProxy::ReadXMLSubProxy(vtkPVXMLElement* )
// vtkErrorMacro("Not supported yet.");
return true;
}
//----------------------------------------------------------------------------
// FIXME COLLABORATION : For now we dynamically convert InformationHelper
// into the correct kernel_class and attribute sets.
// THIS CODE MUST BE REMOVED once InformationHelper have been removed from
// legacy XML
void vtkPMProxy::PatchXMLProperty(vtkPVXMLElement* propElement)
{
vtkPVXMLElement* informationHelper = NULL;
// Search InformationHelper XML element
for(unsigned int i=0; i < propElement->GetNumberOfNestedElements(); ++i)
{
vtkPVXMLElement* currentElement = propElement->GetNestedElement(i);
if ( vtkstd::string(currentElement->GetName()).find("InformationHelper") !=
vtkstd::string::npos)
{
informationHelper = currentElement;
break;
}
}
// Process InformationHelper
if(informationHelper)
{
if(strcmp(informationHelper->GetName(),"StringArrayHelper") == 0
|| strcmp(informationHelper->GetName(),"DoubleArrayInformationHelper") == 0
|| strcmp(informationHelper->GetName(),"IntArrayInformationHelper") == 0 )
{
propElement->SetAttribute("kernel_class", "vtkPMDataArrayProperty");
}
else if (strcmp(informationHelper->GetName(),"TimeStepsInformationHelper") == 0)
{
propElement->SetAttribute("kernel_class", "vtkPMTimeStepsProperty");
}
else if (strcmp(informationHelper->GetName(),"TimeRangeInformationHelper") == 0)
{
propElement->SetAttribute("kernel_class", "vtkPMTimeRangeProperty");
}
else if (strcmp(informationHelper->GetName(),"SILInformationHelper") == 0)
{
propElement->SetAttribute("kernel_class", "vtkPMSILProperty");
propElement->SetAttribute("subtree", informationHelper->GetAttribute("subtree"));
}
else if (strcmp(informationHelper->GetName(),"ArraySelectionInformationHelper") == 0)
{
propElement->SetAttribute("kernel_class", "vtkPMArraySelectionProperty");
propElement->SetAttribute("command", informationHelper->GetAttribute("attribute_name"));
}
else if(strcmp(informationHelper->GetName(),"SimpleDoubleInformationHelper") == 0
|| strcmp(informationHelper->GetName(),"SimpleIntInformationHelper") == 0
|| strcmp(informationHelper->GetName(),"SimpleStringInformationHelper") == 0
|| strcmp(informationHelper->GetName(),"SimpleIdTypeInformationHelper") == 0 )
{
// Nothing to do, just remove them
}
else
{
vtkWarningMacro(
<< "No PMProperty for the following information helper: "
<< informationHelper->GetName() );
}
// Remove InformationHelper from XML
propElement->RemoveNestedElement(informationHelper);
}
}
//----------------------------------------------------------------------------
bool vtkPMProxy::ReadXMLProperty(vtkPVXMLElement* propElement)
{
......@@ -494,7 +427,7 @@ bool vtkPMProxy::ReadXMLProperty(vtkPVXMLElement* propElement)
assert(name && this->GetPropertyHelper(name) == NULL);
// Patch XML to remove InformationHelper and set right kernel_class
this->PatchXMLProperty(propElement);
vtkSMProxyDefinitionManager::PatchXMLProperty(propElement);
vtkSmartPointer<vtkObject> object;
vtkstd::string classname;
......
......@@ -128,12 +128,6 @@ private:
class vtkInternals;
vtkInternals* Internals;
// FIXME COLLABORATION : For now we dynamically convert InformationHelper
// into the correct kernel_class and attribute sets.
// THIS CODE MUST BE REMOVED once InformationHelper have been removed from
// legacy XML
void PatchXMLProperty(vtkPVXMLElement* propElement);
//ETX
};
......
......@@ -29,6 +29,7 @@
#include "vtkSMInputProperty.h"
#include "vtkSMMessage.h"
#include "vtkSMPropertyIterator.h"
#include "vtkSMProxyDefinitionManager.h"
#include "vtkSMProxyLocator.h"
#include "vtkSMProxyManager.h"
#include "vtkSMSession.h"
......@@ -1229,6 +1230,9 @@ vtkSMProperty* vtkSMProxy::NewProperty(const char* name,
return 0;
}
// Patch XML to remove InformationHelper and set right kernel_class
vtkSMProxyDefinitionManager::PatchXMLProperty(propElement);
vtkObject* object = 0;
vtksys_ios::ostringstream cname;
cname << "vtkSM" << propElement->GetName() << ends;
......
......@@ -1059,3 +1059,69 @@ void vtkSMProxyDefinitionManager::HandlePlugin(vtkPVPlugin* plugin)
}
}
}
//---------------------------------------------------------------------------
// FIXME COLLABORATION : For now we dynamically convert InformationHelper
// into the correct kernel_class and attribute sets.
// THIS CODE MUST BE REMOVED once InformationHelper have been removed from
// legacy XML
void vtkSMProxyDefinitionManager::PatchXMLProperty(vtkPVXMLElement* propElement)
{
vtkPVXMLElement* informationHelper = NULL;
// Search InformationHelper XML element
for(unsigned int i=0; i < propElement->GetNumberOfNestedElements(); ++i)
{
vtkPVXMLElement* currentElement = propElement->GetNestedElement(i);
if ( vtkstd::string(currentElement->GetName()).find("InformationHelper") !=
vtkstd::string::npos)
{
informationHelper = currentElement;
break;
}
}
// Process InformationHelper
if(informationHelper)
{
if(strcmp(informationHelper->GetName(),"StringArrayHelper") == 0
|| strcmp(informationHelper->GetName(),"DoubleArrayInformationHelper") == 0
|| strcmp(informationHelper->GetName(),"IntArrayInformationHelper") == 0 )
{
propElement->SetAttribute("kernel_class", "vtkPMDataArrayProperty");
}
else if (strcmp(informationHelper->GetName(),"TimeStepsInformationHelper") == 0)
{
propElement->SetAttribute("kernel_class", "vtkPMTimeStepsProperty");
}
else if (strcmp(informationHelper->GetName(),"TimeRangeInformationHelper") == 0)
{
propElement->SetAttribute("kernel_class", "vtkPMTimeRangeProperty");
}
else if (strcmp(informationHelper->GetName(),"SILInformationHelper") == 0)
{
propElement->SetAttribute("kernel_class", "vtkPMSILProperty");
propElement->SetAttribute("subtree", informationHelper->GetAttribute("subtree"));
}
else if (strcmp(informationHelper->GetName(),"ArraySelectionInformationHelper") == 0)
{
propElement->SetAttribute("kernel_class", "vtkPMArraySelectionProperty");
propElement->SetAttribute("command", informationHelper->GetAttribute("attribute_name"));
propElement->SetAttribute("number_of_elements_per_command", "2");
}
else if(strcmp(informationHelper->GetName(),"SimpleDoubleInformationHelper") == 0
|| strcmp(informationHelper->GetName(),"SimpleIntInformationHelper") == 0
|| strcmp(informationHelper->GetName(),"SimpleStringInformationHelper") == 0
|| strcmp(informationHelper->GetName(),"SimpleIdTypeInformationHelper") == 0 )
{
// Nothing to do, just remove them
}
else
{
cerr << "No PMProperty for the following information helper: "
<< informationHelper->GetName() << endl;
}
// Remove InformationHelper from XML
propElement->RemoveNestedElement(informationHelper);
}
}
......@@ -39,6 +39,12 @@ class vtkSMProxyDefinitionIterator;
class VTK_EXPORT vtkSMProxyDefinitionManager : public vtkSMObject
{
public:
// FIXME COLLABORATION : For now we dynamically convert InformationHelper
// into the correct kernel_class and attribute sets.
// THIS CODE MUST BE REMOVED once InformationHelper have been removed from
// legacy XML
static void PatchXMLProperty(vtkPVXMLElement* propElement);
static vtkSMProxyDefinitionManager* New();
vtkTypeMacro(vtkSMProxyDefinitionManager, vtkSMObject);
void PrintSelf(ostream& os, vtkIndent indent);
......
......@@ -280,13 +280,6 @@ int vtkSMStringVectorProperty::ReadXMLAttributes(vtkSMProxy* proxy,
this->Internals->DefaultValues.push_back(tmp);
}
}
if (element->FindNestedElementByName("ArraySelectionInformationHelper"))
{
// since this information helper used to update the
// number-of-elements-per-command on the property everytime information was
// updated.
this->SetNumberOfElementsPerCommand(2);
}
return 1;
}
......
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