mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
fix PV3FoamReader to restore mesh caching
previous disabling of the TimeSelection arrays [commit c52b20b..] resulted in the mesh caching being disabled :( Simplified code is enabled/disabled by PV3FOAM_TIMESELECTION define. Might be removed in the future.
This commit is contained in:
@ -90,52 +90,6 @@
|
|||||||
<BooleanDomain name="bool"/>
|
<BooleanDomain name="bool"/>
|
||||||
</IntVectorProperty>
|
</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 -->
|
<!-- Available regions array -->
|
||||||
<StringVectorProperty
|
<StringVectorProperty
|
||||||
name="RegionArrayInfo"
|
name="RegionArrayInfo"
|
||||||
@ -233,7 +187,9 @@
|
|||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
<!-- Available times array -->
|
<!-- Available times array -->
|
||||||
<!-- <StringVectorProperty
|
<!-- PV3FOAM_TIMESELECTION must be defined when compiling vtkPV3Foam
|
||||||
|
might discard this in the future
|
||||||
|
<StringVectorProperty
|
||||||
name="TimeArrayInfo"
|
name="TimeArrayInfo"
|
||||||
information_only="1">
|
information_only="1">
|
||||||
<ArraySelectionInformationHelper
|
<ArraySelectionInformationHelper
|
||||||
@ -255,6 +211,8 @@
|
|||||||
</RequiredProperties>
|
</RequiredProperties>
|
||||||
</ArraySelectionDomain>
|
</ArraySelectionDomain>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
|
PV3FOAM_TIMESELECTION
|
||||||
-->
|
-->
|
||||||
|
|
||||||
</SourceProxy>
|
</SourceProxy>
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
|
/* -DPV3FOAM_TIMESELECTION */ \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
|||||||
@ -176,6 +176,7 @@ void Foam::vtkPV3Foam::resetCounters()
|
|||||||
|
|
||||||
void Foam::vtkPV3Foam::initializeTime()
|
void Foam::vtkPV3Foam::initializeTime()
|
||||||
{
|
{
|
||||||
|
#ifdef PV3FOAM_TIMESELECTION
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "entered Foam::vtkPV3Foam::initializeTime" << endl;
|
Info<< "entered Foam::vtkPV3Foam::initializeTime" << endl;
|
||||||
@ -206,6 +207,7 @@ void Foam::vtkPV3Foam::initializeTime()
|
|||||||
times[timeI].name().c_str()
|
times[timeI].name().c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
#endif /* PV3FOAM_TIMESELECTION */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -676,15 +678,16 @@ double* Foam::vtkPV3Foam::timeSteps(int& nTimeSteps)
|
|||||||
int nTimes = 0;
|
int nTimes = 0;
|
||||||
double* ts = NULL;
|
double* ts = NULL;
|
||||||
|
|
||||||
vtkDataArraySelection* arraySelection = reader_->GetTimeSelection();
|
|
||||||
|
|
||||||
if (dbPtr_.valid())
|
if (dbPtr_.valid())
|
||||||
{
|
{
|
||||||
Time& runTime = dbPtr_();
|
Time& runTime = dbPtr_();
|
||||||
|
|
||||||
instantList times = runTime.times();
|
instantList times = runTime.times();
|
||||||
|
|
||||||
|
#ifdef PV3FOAM_TIMESELECTION
|
||||||
List<bool> selected = List<bool>(times.size(), false);
|
List<bool> selected = List<bool>(times.size(), false);
|
||||||
|
|
||||||
|
vtkDataArraySelection* arraySelection = reader_->GetTimeSelection();
|
||||||
const label nSelectedTimes = arraySelection->GetNumberOfArrays();
|
const label nSelectedTimes = arraySelection->GetNumberOfArrays();
|
||||||
|
|
||||||
for (int i = 0; i < nSelectedTimes; ++i)
|
for (int i = 0; i < nSelectedTimes; ++i)
|
||||||
@ -697,14 +700,15 @@ double* Foam::vtkPV3Foam::timeSteps(int& nTimeSteps)
|
|||||||
&& timeI < times.size()
|
&& timeI < times.size()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if 0
|
if (debug)
|
||||||
Info<<"timeSelection["
|
{
|
||||||
<< i
|
Info<<"timeSelection["
|
||||||
<<"] = "
|
<< i
|
||||||
<< arraySelection->GetArraySetting(i)
|
<<"] = "
|
||||||
<< " is "
|
<< arraySelection->GetArraySetting(i)
|
||||||
<< arraySelection->GetArrayName(i) << endl;
|
<< " is "
|
||||||
#endif
|
<< arraySelection->GetArrayName(i) << endl;
|
||||||
|
}
|
||||||
selected[timeI] = true;
|
selected[timeI] = true;
|
||||||
++nTimes;
|
++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
|
else
|
||||||
{
|
{
|
||||||
@ -744,7 +769,7 @@ double* Foam::vtkPV3Foam::timeSteps(int& nTimeSteps)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// return length via the parameter
|
// return vector length via the parameter
|
||||||
nTimeSteps = nTimes;
|
nTimeSteps = nTimes;
|
||||||
|
|
||||||
return ts;
|
return ts;
|
||||||
|
|||||||
@ -53,7 +53,10 @@ void Foam::vtkPV3Foam::updateFoamMesh()
|
|||||||
if
|
if
|
||||||
(
|
(
|
||||||
!reader_->GetCacheMesh()
|
!reader_->GetCacheMesh()
|
||||||
|
#ifdef PV3FOAM_TIMESELECTION
|
||||||
|
// This is only useful if the times are individually selectable
|
||||||
|| reader_->GetTimeSelection()->GetArraySetting(0)
|
|| reader_->GetTimeSelection()->GetArraySetting(0)
|
||||||
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
delete meshPtr_;
|
delete meshPtr_;
|
||||||
|
|||||||
Reference in New Issue
Block a user