Commit 04f065cf authored by Mark Olesen's avatar Mark Olesen
Browse files

fix PV3FoamReader to restore mesh caching

previous disabling of the TimeSelection arrays [commit c52b20b1..]
resulted in the mesh caching being disabled :(

Simplified code is enabled/disabled by PV3FOAM_TIMESELECTION define.
Might be removed in the future.
parent 202570dc
......@@ -90,52 +90,6 @@
<BooleanDomain name="bool"/>
</IntVectorProperty>
<!-- Time step edit box -->
<!-- OLESEN
<IntVectorProperty
name="TimeStepRangeInfo"
command="GetTimeStepRange"
information_only="1">
<SimpleIntInformationHelper/>
</IntVectorProperty>
<IntVectorProperty
name="TimeStep"
command="SetTimeStep"
number_of_elements="1"
animateable="1"
default_values="0"
information_property="TimestepValues">
<IntRangeDomain
name="range">
<RequiredProperties>
<Property name="TimeStepRangeInfo"
function="Range"/>
</RequiredProperties>
</IntRangeDomain>
</IntVectorProperty>
-->
<!-- Time step limits boxes -->
<!-- <IntVectorProperty
name="TimeStepLimitsInfo"
command="GetTimeStepLimits"
information_only="1">
<SimpleIntInformationHelper/>
</IntVectorProperty>
<IntVectorProperty
name="TimeStepLimits"
command="SetTimeStepLimits"
number_of_elements="2"
default_values="2 5" >
<IntRangeDomain
name="range">
<RequiredProperties>
<Property name="TimeStepLimitsInfo"
function="Range"/>
</RequiredProperties>
</IntRangeDomain>
</IntVectorProperty>-->
<!-- Available regions array -->
<StringVectorProperty
name="RegionArrayInfo"
......@@ -233,7 +187,9 @@
</StringVectorProperty>
<!-- Available times array -->
<!-- <StringVectorProperty
<!-- PV3FOAM_TIMESELECTION must be defined when compiling vtkPV3Foam
might discard this in the future
<StringVectorProperty
name="TimeArrayInfo"
information_only="1">
<ArraySelectionInformationHelper
......@@ -255,6 +211,8 @@
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
PV3FOAM_TIMESELECTION
-->
</SourceProxy>
......
EXE_INC = \
/* -DPV3FOAM_TIMESELECTION */ \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
......
......@@ -176,6 +176,7 @@ void Foam::vtkPV3Foam::resetCounters()
void Foam::vtkPV3Foam::initializeTime()
{
#ifdef PV3FOAM_TIMESELECTION
if (debug)
{
Info<< "entered Foam::vtkPV3Foam::initializeTime" << endl;
......@@ -206,6 +207,7 @@ void Foam::vtkPV3Foam::initializeTime()
times[timeI].name().c_str()
);
}
#endif /* PV3FOAM_TIMESELECTION */
}
......@@ -676,15 +678,16 @@ double* Foam::vtkPV3Foam::timeSteps(int& nTimeSteps)
int nTimes = 0;
double* ts = NULL;
vtkDataArraySelection* arraySelection = reader_->GetTimeSelection();
if (dbPtr_.valid())
{
Time& runTime = dbPtr_();
instantList times = runTime.times();
#ifdef PV3FOAM_TIMESELECTION
List<bool> selected = List<bool>(times.size(), false);
vtkDataArraySelection* arraySelection = reader_->GetTimeSelection();
const label nSelectedTimes = arraySelection->GetNumberOfArrays();
for (int i = 0; i < nSelectedTimes; ++i)
......@@ -697,14 +700,15 @@ double* Foam::vtkPV3Foam::timeSteps(int& nTimeSteps)
&& timeI < times.size()
)
{
#if 0
Info<<"timeSelection["
<< i
<<"] = "
<< arraySelection->GetArraySetting(i)
<< " is "
<< arraySelection->GetArrayName(i) << endl;
#endif
if (debug)
{
Info<<"timeSelection["
<< i
<<"] = "
<< arraySelection->GetArraySetting(i)
<< " is "
<< arraySelection->GetArrayName(i) << endl;
}
selected[timeI] = true;
++nTimes;
}
......@@ -735,6 +739,27 @@ double* Foam::vtkPV3Foam::timeSteps(int& nTimeSteps)
}
}
}
#else /* PV3FOAM_TIMESELECTION */
// always skip "constant" time, unless there are no other times
nTimes = times.size();
label timeI = 0;
if (nTimes > 1)
{
timeI = 1;
--nTimes;
}
if (nTimes)
{
ts = new double[nTimes];
for (label stepI = 0; stepI < nTimes; ++stepI, ++timeI)
{
ts[stepI] = times[timeI].value();
}
}
#endif /* PV3FOAM_TIMESELECTION */
}
else
{
......@@ -744,7 +769,7 @@ double* Foam::vtkPV3Foam::timeSteps(int& nTimeSteps)
}
}
// return length via the parameter
// return vector length via the parameter
nTimeSteps = nTimes;
return ts;
......
......@@ -53,7 +53,10 @@ void Foam::vtkPV3Foam::updateFoamMesh()
if
(
!reader_->GetCacheMesh()
#ifdef PV3FOAM_TIMESELECTION
// This is only useful if the times are individually selectable
|| reader_->GetTimeSelection()->GetArraySetting(0)
#endif
)
{
delete meshPtr_;
......
Supports Markdown
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