Commit 658ca683 authored by Ken Martin's avatar Ken Martin
Browse files

some fixes from the main tree

parent 819af320
......@@ -17,7 +17,7 @@
#include <ctype.h>
vtkCxxRevisionMacro(vtkFunctionParser, "1.24.6.1");
vtkCxxRevisionMacro(vtkFunctionParser, "1.24.6.2");
vtkStandardNewMacro(vtkFunctionParser);
static double vtkParserVectorErrorResult[3] = { VTK_PARSER_ERROR_RESULT,
......@@ -1074,6 +1074,48 @@ void vtkFunctionParser::RemoveSpaces()
delete [] tempString;
}
int vtkFunctionParser::OperatorWithinVariable(int idx)
{
int i;
char *tmpString;
int start, end;
for (i = 0; i < this->NumberOfScalarVariables; i++)
{
if (strchr(this->ScalarVariableNames[i], this->Function[idx]) != 0)
{
tmpString = strstr(this->Function, this->ScalarVariableNames[i]);
if (tmpString)
{
start = (int)(tmpString - this->Function);
end = start + strlen(this->ScalarVariableNames[i]);
if (start <= idx && end >= idx)
{
return 1;
}
}
}
}
for (i = 0; i < this->NumberOfVectorVariables; i++)
{
if (strchr(this->VectorVariableNames[i], this->Function[idx]) != 0)
{
tmpString = strstr(this->Function, this->VectorVariableNames[i]);
if (tmpString)
{
start = (int)(tmpString - this->Function);
end = start + strlen(this->VectorVariableNames[i]);
if (start <= idx && end >= idx)
{
return 1;
}
}
}
}
return 0;
}
int vtkFunctionParser::CheckSyntax()
{
int index = 0, parenthesisCount = 0, currentChar;
......@@ -1370,7 +1412,8 @@ void vtkFunctionParser::BuildInternalSubstringStructure(int beginIndex,
isdigit(this->Function[i-2])))) &&
!(this->Function[i] == '.' &&
(i+1 < this->FunctionLength) &&
(isdigit(this->Function[i+1]))))
(isdigit(this->Function[i+1]))) &&
!this->OperatorWithinVariable(i))
{
this->BuildInternalSubstringStructure(beginIndex, i-1);
this->BuildInternalSubstringStructure(i+1, endIndex);
......
......@@ -177,6 +177,7 @@ protected:
int CheckSyntax();
void RemoveSpaces();
char* RemoveSpacesFrom(const char* variableName);
int OperatorWithinVariable(int idx);
int BuildInternalFunctionStructure();
void BuildInternalSubstringStructure(int beginIndex, int endIndex);
......
......@@ -30,7 +30,7 @@
#include <math.h>
vtkCxxRevisionMacro(vtkClipDataSet, "1.33");
vtkCxxRevisionMacro(vtkClipDataSet, "1.33.2.1");
vtkStandardNewMacro(vtkClipDataSet);
vtkCxxSetObjectMacro(vtkClipDataSet,ClipFunction,vtkImplicitFunction);
......@@ -410,7 +410,13 @@ void vtkClipDataSet::CreateDefaultLocator()
void vtkClipDataSet::ClipVolume()
{
vtkClipVolume *clipVolume = vtkClipVolume::New();
clipVolume->SetInput((vtkImageData *)this->GetInput());
// We cannot set the input directly. This messes up the partitioning.
// output->UpdateNumberOfPieces gets set to 1.
vtkImageData* tmp = vtkImageData::New();
tmp->ShallowCopy(vtkImageData::SafeDownCast(this->GetInput()));
clipVolume->SetInput(tmp);
clipVolume->SetValue(this->Value);
clipVolume->SetInsideOut(this->InsideOut);
clipVolume->SetClipFunction(this->ClipFunction);
......@@ -426,6 +432,7 @@ void vtkClipDataSet::ClipVolume()
output->GetPointData()->ShallowCopy(clipOutput->GetPointData());
output->GetCellData()->ShallowCopy(clipOutput->GetCellData());
clipVolume->Delete();
tmp->Delete();
}
......
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