Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2009-03-24 10:00:02 +00:00
29 changed files with 245 additions and 324 deletions

View File

@ -39,24 +39,17 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H" # include "setRootCase.H"
Info<< "\nEstimating error in scalar transport equation\n" << endl;
# include "createTime.H" # include "createTime.H"
// Get times list instantList timeDirs = timeSelector::select0(runTime, args);
instantList Times = runTime.times();
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createMesh.H" # include "createMesh.H"
Info<< "Reading transportProperties\n" << endl; Info<< "\nEstimating error in scalar transport equation\n"
<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties IOdictionary transportProperties
( (
@ -79,9 +72,9 @@ int main(int argc, char *argv[])
); );
for (label i=startTime; i<endTime; i++) forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[i], i); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;

View File

@ -38,25 +38,17 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H" # include "setRootCase.H"
Info<< "\nEstimating error in the incompressible momentum equation\n"
<< endl;
# include "createTime.H" # include "createTime.H"
// Get times list instantList timeDirs = timeSelector::select0(runTime, args);
instantList Times = runTime.times();
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createMesh.H" # include "createMesh.H"
Info<< "Reading transportProperties\n" << endl; Info<< "\nEstimating error in the incompressible momentum equation\n"
<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties IOdictionary transportProperties
( (
@ -75,9 +67,9 @@ int main(int argc, char *argv[])
transportProperties.lookup("nu") transportProperties.lookup("nu")
); );
for (label i=startTime; i<endTime; i++) forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[i], i); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;

View File

@ -39,25 +39,17 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H" # include "setRootCase.H"
Info<< "\nEstimating error in the incompressible momentum equation\n"
<< endl;
# include "createTime.H" # include "createTime.H"
// Get times list instantList timeDirs = timeSelector::select0(runTime, args);
instantList Times = runTime.times();
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createMesh.H" # include "createMesh.H"
Info<< "Reading transportProperties\n" << endl; Info<< "\nEstimating error in the incompressible momentum equation\n"
<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties IOdictionary transportProperties
( (
@ -76,9 +68,9 @@ int main(int argc, char *argv[])
transportProperties.lookup("nu") transportProperties.lookup("nu")
); );
for (label i=startTime; i<endTime; i++) forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[i], i); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;

View File

@ -40,24 +40,17 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H" # include "setRootCase.H"
Info<< "\nEstimating error in scalar transport equation\n" << endl;
# include "createTime.H" # include "createTime.H"
// Get times list instantList timeDirs = timeSelector::select0(runTime, args);
instantList Times = runTime.times();
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createMesh.H" # include "createMesh.H"
Info<< "Reading transportProperties\n" << endl; Info<< "\nEstimating error in scalar transport equation\n"
<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties IOdictionary transportProperties
( (
@ -80,9 +73,9 @@ int main(int argc, char *argv[])
); );
for (label i=startTime; i<endTime; i++) forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[i], i); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;

View File

@ -61,6 +61,7 @@ See Also
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "timeSelector.H"
#include "Time.H" #include "Time.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "STARCDMeshWriter.H" #include "STARCDMeshWriter.H"
@ -73,20 +74,17 @@ using namespace Foam;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::noParallel(); argList::noParallel();
timeSelector::addOptions();
argList::validOptions.insert("scale", "scale"); argList::validOptions.insert("scale", "scale");
argList::validOptions.insert("noBnd", ""); argList::validOptions.insert("noBnd", "");
argList::validOptions.insert("tri", ""); argList::validOptions.insert("tri", "");
argList::validOptions.insert("surface", ""); argList::validOptions.insert("surface", "");
# include "addTimeOptions.H"
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
// Get times list
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options instantList timeDirs = timeSelector::select0(runTime, args);
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
bool surfaceOnly = false; bool surfaceOnly = false;
if (args.options().found("surface") or args.options().found("tri")) if (args.options().found("surface") or args.options().found("tri"))
@ -118,17 +116,16 @@ int main(int argc, char *argv[])
# include "createPolyMesh.H" # include "createPolyMesh.H"
// bool firstCheck = true;
for (label timeI = startTime; timeI < endTime; ++timeI) forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[timeI], timeI); runTime.setTime(timeDirs[timeI], timeI);
# include "getTimeIndex.H" # include "getTimeIndex.H"
polyMesh::readUpdateState state = mesh.readUpdate(); polyMesh::readUpdateState state = mesh.readUpdate();
if (timeI == startTime || state != polyMesh::UNCHANGED) if (!timeI || state != polyMesh::UNCHANGED)
{ {
meshWriters::STARCD writer(mesh, scaleFactor); meshWriters::STARCD writer(mesh, scaleFactor);

View File

@ -1,4 +1,4 @@
meshDualiser.C meshDualiser.C
makePolyDualMesh.C polyDualMeshApp.C
EXE = $(FOAM_APPBIN)/polyDualMesh EXE = $(FOAM_APPBIN)/polyDualMesh

View File

@ -348,8 +348,10 @@ int main(int argc, char *argv[])
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
// Get times list // Get times list
instantList Times = runTime.times(); instantList Times = runTime.times();
# include "checkTimeOptions.H" # include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime); runTime.setTime(Times[startTime], startTime);

View File

@ -37,6 +37,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "timeSelector.H"
#include "Time.H" #include "Time.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "OFstream.H" #include "OFstream.H"
@ -336,6 +337,7 @@ void writePointCells
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions();
argList::validOptions.insert("patchFaces", ""); argList::validOptions.insert("patchFaces", "");
argList::validOptions.insert("cell", "cellI"); argList::validOptions.insert("cell", "cellI");
argList::validOptions.insert("face", "faceI"); argList::validOptions.insert("face", "faceI");
@ -343,7 +345,6 @@ int main(int argc, char *argv[])
argList::validOptions.insert("cellSet", "setName"); argList::validOptions.insert("cellSet", "setName");
argList::validOptions.insert("faceSet", "setName"); argList::validOptions.insert("faceSet", "setName");
# include "addTimeOptions.H"
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
runTime.functionObjects().off(); runTime.functionObjects().off();
@ -361,31 +362,23 @@ int main(int argc, char *argv[])
<< "(for points, faces, cells) is consistent with" << "(for points, faces, cells) is consistent with"
<< " Foam numbering (starting from 0)." << endl << endl; << " Foam numbering (starting from 0)." << endl << endl;
// Get times list instantList timeDirs = timeSelector::select0(runTime, args);
instantList Times = runTime.times();
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createPolyMesh.H" # include "createPolyMesh.H"
bool firstCheck = true; forAll(timeDirs, timeI)
for (label i=startTime; i<endTime; i++)
{ {
runTime.setTime(Times[i], i); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;
polyMesh::readUpdateState state = mesh.readUpdate(); polyMesh::readUpdateState state = mesh.readUpdate();
if (firstCheck || state != polyMesh::UNCHANGED) if (!timeI || state != polyMesh::UNCHANGED)
{ {
if (patchFaces) if (patchFaces)
{ {
writePatchFaces(mesh, runTime.timeName()); writePatchFaces(mesh, runTime.timeName());
} }
else if (doCell) else if (doCell)
{ {
@ -487,9 +480,7 @@ int main(int argc, char *argv[])
Info << "No mesh." << endl; Info << "No mesh." << endl;
} }
firstCheck = false; Info << nl << endl;
Info << endl << endl;
} }

View File

@ -31,7 +31,9 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "timeSelector.H"
#include "Time.H" #include "Time.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "globalMeshData.H" #include "globalMeshData.H"
@ -45,48 +47,34 @@ using namespace Foam;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions(false); // no constant
# include "addRegionOption.H" # include "addRegionOption.H"
# include "addTimeOptionsNoConstant.H"
argList::validOptions.insert("noTopology", ""); argList::validOptions.insert("noTopology", "");
argList::validOptions.insert("allGeometry", ""); argList::validOptions.insert("allGeometry", "");
argList::validOptions.insert("allTopology", ""); argList::validOptions.insert("allTopology", "");
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createNamedPolyMesh.H"
const bool noTopology = args.options().found("noTopology"); const bool noTopology = args.options().found("noTopology");
const bool allGeometry = args.options().found("allGeometry"); const bool allGeometry = args.options().found("allGeometry");
const bool allTopology = args.options().found("allTopology"); const bool allTopology = args.options().found("allTopology");
# include "createTime.H" forAll(timeDirs, timeI)
// Get times list
instantList Times = runTime.times();
# include "checkTimeOptionsNoConstant.H"
runTime.setTime(Times[startTime], startTime);
# include "createNamedPolyMesh.H"
bool firstCheck = true;
for (label i=startTime; i<endTime; i++)
{ {
runTime.setTime(Times[i], i); runTime.setTime(timeDirs[timeI], timeI);
polyMesh::readUpdateState state = mesh.readUpdate(); polyMesh::readUpdateState state = mesh.readUpdate();
if if
( (
firstCheck !timeI
|| state == polyMesh::TOPO_CHANGE || state == polyMesh::TOPO_CHANGE
|| state == polyMesh::TOPO_PATCH_CHANGE || state == polyMesh::TOPO_PATCH_CHANGE
) )
{ {
firstCheck = false;
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
// Clear mesh before checking // Clear mesh before checking
@ -110,32 +98,30 @@ int main(int argc, char *argv[])
if (noFailedChecks == 0) if (noFailedChecks == 0)
{ {
Info<< "\nMesh OK." Info<< "\nMesh OK.\n" << endl;
<< nl << endl;
} }
else else
{ {
Info<< "\nFailed " << noFailedChecks << " mesh checks." Info<< "\nFailed " << noFailedChecks << " mesh checks.\n"
<< nl << endl; << endl;
} }
} }
else if (state == polyMesh::POINTS_MOVED) else if (state == polyMesh::POINTS_MOVED)
{ {
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
label noFailedChecks = checkGeometry(mesh, allGeometry); label nFailedChecks = checkGeometry(mesh, allGeometry);
reduce(noFailedChecks, sumOp<label>()); reduce(nFailedChecks, sumOp<label>());
if (noFailedChecks == 0) if (nFailedChecks)
{ {
Info << "\nMesh OK." Info<< "\nFailed " << nFailedChecks << " mesh checks.\n"
<< nl << endl; << endl;
} }
else else
{ {
Info<< "\nFailed " << noFailedChecks << " mesh checks." Info << "\nMesh OK.\n" << endl;
<< nl << endl;
} }
} }
} }

View File

@ -31,6 +31,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "timeSelector.H"
#include "Time.H" #include "Time.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "volFields.H" #include "volFields.H"
@ -66,7 +67,8 @@ void RotateFields
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
# include "addTimeOptions.H" timeSelector::addOptions();
argList::validArgs.append("n1"); argList::validArgs.append("n1");
argList::validArgs.append("n2"); argList::validArgs.append("n2");
@ -105,19 +107,15 @@ int main(int argc, char *argv[])
points.write(); points.write();
} }
// Get times list
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options instantList timeDirs = timeSelector::select0(runTime, args);
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createMesh.H" # include "createMesh.H"
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[i], i); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;

View File

@ -40,25 +40,19 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "addRegionOption.H" # include "addRegionOption.H"
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
// Get times list instantList timeDirs = timeSelector::select0(runTime, args);
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createNamedMesh.H" # include "createNamedMesh.H"
for (label i=startTime; i<endTime; i++) forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[i], i); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;

View File

@ -38,26 +38,22 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::noParallel(); argList::noParallel();
# include "addTimeOptions.H" timeSelector::addOptions(false); // no constant
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
instantList Times = runTime.times(); instantList timeDirs = timeSelector::select0(runTime, args);
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptionsNoConstant.H"
runTime.setTime(Times[startTime], startTime);
# include "createMesh.H" # include "createMesh.H"
// make a directory called proInterface in the case // make a directory called proInterface in the case
mkDir(runTime.rootPath()/runTime.caseName()/"fluentInterface"); mkDir(runTime.rootPath()/runTime.caseName()/"fluentInterface");
for (label timeI = startTime; timeI < endTime; timeI++) forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[timeI], timeI); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;
if (mesh.readUpdate()) if (mesh.readUpdate())

View File

@ -225,8 +225,10 @@ labelList getSelectedPatches
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
# include "addTimeOptions.H" timeSelector::addOptions();
# include "addRegionOption.H" # include "addRegionOption.H"
argList::validOptions.insert("fields", "fields"); argList::validOptions.insert("fields", "fields");
argList::validOptions.insert("cellSet", "cellSet name"); argList::validOptions.insert("cellSet", "cellSet name");
argList::validOptions.insert("faceSet", "faceSet name"); argList::validOptions.insert("faceSet", "faceSet name");
@ -244,7 +246,6 @@ int main(int argc, char *argv[])
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
bool doWriteInternal = !args.options().found("noInternal"); bool doWriteInternal = !args.options().found("noInternal");
bool doFaceZones = !args.options().found("noFaceZones"); bool doFaceZones = !args.options().found("noFaceZones");
bool doLinks = !args.options().found("noLinks"); bool doLinks = !args.options().found("noLinks");
@ -312,14 +313,8 @@ int main(int argc, char *argv[])
} }
instantList Times = runTime.times(); instantList timeDirs = timeSelector::select0(runTime, args);
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
// Current mesh.
# include "createNamedMesh.H" # include "createNamedMesh.H"
// VTK/ directory in the case // VTK/ directory in the case
@ -359,11 +354,11 @@ int main(int argc, char *argv[])
// mesh wrapper; does subsetting and decomposition // mesh wrapper; does subsetting and decomposition
vtkMesh vMesh(mesh, cellSetName); vtkMesh vMesh(mesh, cellSetName);
for (label timeI = startTime; timeI < endTime; timeI++) forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[timeI], timeI); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time " << Times[timeI].name() << endl; Info<< "Time: " << runTime.timeName() << endl;
// Check for new polyMesh/ and update mesh, fvMeshSubset and cell // Check for new polyMesh/ and update mesh, fvMeshSubset and cell
// decomposition. // decomposition.

View File

@ -52,8 +52,7 @@ vtkPV3FoamReader::vtkPV3FoamReader()
// Add second output for the Lagrangian // Add second output for the Lagrangian
this->SetNumberOfOutputPorts(2); this->SetNumberOfOutputPorts(2);
vtkMultiBlockDataSet *lagrangian; vtkMultiBlockDataSet *lagrangian = vtkMultiBlockDataSet::New();
lagrangian = vtkMultiBlockDataSet::New();
lagrangian->ReleaseData(); lagrangian->ReleaseData();
this->GetExecutive()->SetOutputData(1, lagrangian); this->GetExecutive()->SetOutputData(1, lagrangian);
@ -204,9 +203,9 @@ int vtkPV3FoamReader::RequestInformation
); );
} }
double timeRange[2];
if (nTimeSteps) if (nTimeSteps)
{ {
double timeRange[2];
timeRange[0] = timeSteps[0]; timeRange[0] = timeSteps[0];
timeRange[1] = timeSteps[nTimeSteps-1]; timeRange[1] = timeSteps[nTimeSteps-1];
@ -273,19 +272,53 @@ int vtkPV3FoamReader::RequestData
} }
} }
// take port0 as the lead for other outputs // Get the requested time step.
vtkInformation *outInfo = outputVector->GetInformationObject(0); // We only support requests for a single time step
int nRequestTime = 0;
double requestTime[nInfo];
// taking port0 as the lead for other outputs would be nice, but fails when
// a filter is added - we need to check everything
// but since PREVIOUS_UPDATE_TIME_STEPS() is protected, relay the logic
// to the vtkPV3Foam::setTime() method
for (int infoI = 0; infoI < nInfo; ++infoI)
{
vtkInformation *outInfo = outputVector->GetInformationObject(infoI);
if
(
outInfo->Has
(
vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()
)
&& outInfo->Length
(
vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()
) >= 1
)
{
requestTime[nRequestTime++] = outInfo->Get
(
vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()
)[0];
}
}
if (nRequestTime)
{
foamData_->setTime(nRequestTime, requestTime);
}
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
( (
outInfo->Get outputVector->GetInformationObject(0)->Get
( (
vtkMultiBlockDataSet::DATA_OBJECT() vtkMultiBlockDataSet::DATA_OBJECT()
) )
); );
vtkMultiBlockDataSet* lagrangianOutput = vtkMultiBlockDataSet::SafeDownCast vtkMultiBlockDataSet* lagrangianOutput = vtkMultiBlockDataSet::SafeDownCast
( (
outputVector->GetInformationObject(1)->Get outputVector->GetInformationObject(1)->Get
@ -294,24 +327,6 @@ int vtkPV3FoamReader::RequestData
) )
); );
if (outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()))
{
// Get the requested time step.
// We only support requests for a single time step
int nRequestedTimeSteps = outInfo->Length
(
vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()
);
if (nRequestedTimeSteps >= 1)
{
double *requestedTimeSteps = outInfo->Get
(
vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()
);
foamData_->setTime(requestedTimeSteps[0]);
}
}
if (Foam::vtkPV3Foam::debug) if (Foam::vtkPV3Foam::debug)
{ {

View File

@ -90,12 +90,21 @@ void Foam::vtkPV3Foam::reduceMemory()
int Foam::vtkPV3Foam::setTime(const double& requestedTime) int Foam::vtkPV3Foam::setTime(int nRequest, const double requestTimes[])
{ {
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::setTime(" << requestedTime << ")" Info<< "<beg> Foam::vtkPV3Foam::setTime(";
<< endl; for (int requestI = 0; requestI < nRequest; ++requestI)
{
if (requestI)
{
Info<< ", ";
}
Info<< requestTimes[requestI];
}
Info << ") - previousIndex = " << timeIndex_ << endl;
} }
Time& runTime = dbPtr_(); Time& runTime = dbPtr_();
@ -103,12 +112,26 @@ int Foam::vtkPV3Foam::setTime(const double& requestedTime)
// Get times list // Get times list
instantList Times = runTime.times(); instantList Times = runTime.times();
int nearestIndex = Time::findClosestTimeIndex(Times, requestedTime); int nearestIndex = timeIndex_;
for (int requestI = 0; requestI < nRequest; ++requestI)
{
int index = Time::findClosestTimeIndex(Times, requestTimes[requestI]);
if (index >= 0 && index != timeIndex_)
{
nearestIndex = index;
break;
}
}
if (nearestIndex < 0) if (nearestIndex < 0)
{ {
nearestIndex = 0; nearestIndex = 0;
} }
// see what has changed // see what has changed
if (timeIndex_ != nearestIndex) if (timeIndex_ != nearestIndex)
{ {
@ -138,10 +161,11 @@ int Foam::vtkPV3Foam::setTime(const double& requestedTime)
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::setTime() - selected time " Info<< "<end> Foam::vtkPV3Foam::setTime() - selectedTime="
<< Times[nearestIndex].name() << " index=" << nearestIndex << Times[nearestIndex].name() << " index=" << timeIndex_
<< " meshChanged=" << meshChanged_ << "/" << Times.size()
<< " fieldsChanged=" << fieldsChanged_ << endl; << " meshChanged=" << Switch(meshChanged_)
<< " fieldsChanged=" << Switch(fieldsChanged_) << endl;
} }
return nearestIndex; return nearestIndex;

View File

@ -133,6 +133,7 @@ class vtkPV3Foam
return block_; return block_;
} }
//- Assign block number, return previous value
int block(int blockNo) int block(int blockNo)
{ {
int prev = block_; int prev = block_;
@ -718,9 +719,11 @@ public:
//- Remove patch names from the display //- Remove patch names from the display
void removePatchNames(vtkRenderer* renderer); void removePatchNames(vtkRenderer* renderer);
//- set the runTime to the requested time, returns the timeIndex //- set the runTime to the first plausible request time,
// sets to "constant" on error and returns -1 // returns the timeIndex
int setTime(const double& requestedTime); // sets to "constant" on error
int setTime(int count, const double requestTimes[]);
//- The current time index //- The current time index
int timeIndex() const int timeIndex() const

View File

@ -40,7 +40,10 @@ void Foam::vtkPV3Foam::updateInfoFields
{ {
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::updateInfoFields" << endl; Info<< "<beg> Foam::vtkPV3Foam::updateInfoFields <"
<< meshType::Mesh::typeName
<< "> [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]"
<< endl;
} }
stringList enabledEntries; stringList enabledEntries;

View File

@ -40,45 +40,38 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "setRootCase.H" #include "setRootCase.H"
#include "createEngineTime.H" #include "createEngineTime.H"
#include "createEngineMesh.H" #include "createEngineMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scalar eps = 1.0e-10; scalar eps = 1.0e-10;
scalar fullCycle = 360.0; scalar fullCycle = 360.0;
scalar ca0 = -180.0; scalar ca0 = -180.0;
scalar ca1 = 0.0; scalar ca1 = 0.0;
scalar ca = runTime.theta();
while (ca > ca0) while (runTime.theta() > ca0)
{ {
ca0 += fullCycle; ca0 += fullCycle;
ca1 += fullCycle; ca1 += fullCycle;
} }
if (mag(ca - ca0) > eps) while (mag(runTime.theta() - ca0) > eps)
{ {
while(mag(ca - ca0) > eps) scalar t0 = runTime.userTimeToTime(ca0 - runTime.theta());
{
ca = runTime.theta();
scalar t0 = runTime.userTimeToTime(ca0 - ca);
runTime.setDeltaT(t0); runTime.setDeltaT(t0);
runTime++; runTime++;
Info << "CA = " << ca << endl; Info<< "CA = " << runTime.theta() << endl;
mesh.move(); mesh.move();
} }
}
scalar Vmax = sum(mesh.V().field()); scalar Vmax = sum(mesh.V().field());
while(mag(ca-ca1) > eps) while (mag(runTime.theta()-ca1) > eps)
{ {
ca = runTime.theta(); scalar t1 = runTime.userTimeToTime(ca1-runTime.theta());
scalar t1 = runTime.userTimeToTime(ca1-ca);
runTime.setDeltaT(t1); runTime.setDeltaT(t1);
runTime++; runTime++;
Info<< "CA = " << runTime.theta() << endl; Info<< "CA = " << runTime.theta() << endl;
@ -90,7 +83,7 @@ int main(int argc, char *argv[])
Info<< "\nVmax = " << Vmax; Info<< "\nVmax = " << Vmax;
Info<< ", Vmin = " << Vmin << endl; Info<< ", Vmin = " << Vmin << endl;
Info<< "Vmax/Vmin = " << Vmax/Vmin << endl; Info<< "Vmax/Vmin = " << Vmax/Vmin << endl;
Info << "\n end\n"; Info<< "\nEnd" << endl;
return 0; return 0;
} }

View File

@ -36,25 +36,18 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
// Get times list instantList timeDirs = timeSelector::select0(runTime, args);
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createMesh.H" # include "createMesh.H"
for (label i=startTime; i<endTime; i++) forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[i], i); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;

View File

@ -37,25 +37,18 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
// Get times list instantList timeDirs = timeSelector::select0(runTime, args);
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createMesh.H" # include "createMesh.H"
for (label i=startTime; i<endTime; i++) forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[i], i); runTime.setTime(timeDirs[timeI], timeI);
mesh.readUpdate(); mesh.readUpdate();

View File

@ -29,6 +29,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "vectorIOField.H" #include "vectorIOField.H"
#include "volFields.H" #include "volFields.H"
@ -41,23 +43,18 @@ using namespace Foam;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
# include "addTimeOptions.H" timeSelector::addOptions();
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
// Get times list
instantList Times = runTime.times();
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createMesh.H" # include "createMesh.H"
for (label i=startTime; i<endTime; i++) forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[i], i); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;
@ -104,7 +101,7 @@ int main(int argc, char *argv[])
} }
} }
Info << nl << "End" << endl; Info<< "\nEnd" << endl;
return 0; return 0;
} }

View File

@ -38,23 +38,16 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
// Get times list instantList timeDirs = timeSelector::select0(runTime, args);
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createMesh.H" # include "createMesh.H"
runTime.setTime(Times[endTime-1], endTime-1); runTime.setTime(timeDirs[timeDirs.size()-1], timeDirs.size()-1);
volScalarField pMean volScalarField pMean
( (
@ -68,9 +61,9 @@ int main(int argc, char *argv[])
mesh mesh
); );
for (label i=startTime; i<endTime; i++) forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[i], i); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;

View File

@ -35,30 +35,22 @@ Description
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H" #include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "zeroGradientFvPatchFields.H" #include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
// Get times list instantList timeDirs = timeSelector::select0(runTime, args);
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createMesh.H" # include "createMesh.H"
for (label i=startTime; i<endTime; i++) forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[i], i); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;

View File

@ -42,24 +42,19 @@ Source files:
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "addTimeOptions.H" timeSelector::addOptions();
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
// Get times list instantList timeDirs = timeSelector::select0(runTime, args);
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
#include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
#include "createMesh.H" #include "createMesh.H"
#include "createFields.H" #include "createFields.H"
for (label i=startTime; i<endTime; i++) forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[i], i); runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;

View File

@ -42,27 +42,20 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
// Get times list instantList timeDirs = timeSelector::select0(runTime, args);
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createMeshNoClear.H" # include "createMeshNoClear.H"
pointMesh pMesh(mesh); pointMesh pMesh(mesh);
for (label i=startTime; i<endTime; i++) forAll(timeDirs, timeI)
{ {
runTime.setTime(Times[i], i); runTime.setTime(timeDirs[timeI], timeI);
Info<< nl << "Time: " << runTime.timeName() << endl; Info<< nl << "Time: " << runTime.timeName() << endl;

View File

@ -38,20 +38,20 @@ const char* Foam::Switch::names[Foam::Switch::INVALID+1] =
"off", "on", "off", "on",
"no", "yes", "no", "yes",
"n", "y", "n", "y",
"none", "true", // is there a reasonable counterpart to "none"?
"invalid" "invalid"
}; };
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
Foam::Switch::switchType Foam::Switch::asEnum(const bool val) Foam::Switch::switchType Foam::Switch::asEnum(const bool b)
{ {
return val ? Switch::TRUE : Switch::FALSE; return b ? Switch::TRUE : Switch::FALSE;
} }
Foam::Switch::switchType Foam::Switch::switchType Foam::Switch::asEnum
Foam::Switch::asEnum
( (
const std::string& str, const std::string& str,
const bool allowInvalid const bool allowInvalid
@ -61,8 +61,8 @@ Foam::Switch::asEnum
{ {
if (str == names[sw]) if (str == names[sw])
{ {
// convert y/n to yes/no (perhaps should deprecate y/n) // convert n/y to no/yes (perhaps should deprecate y/n)
if (sw == Switch::NO_1) if (sw == Switch::NO_1 || sw == Switch::NONE)
{ {
return Switch::NO; return Switch::NO;
} }
@ -90,6 +90,7 @@ Foam::Switch::asEnum
bool Foam::Switch::asBool(const switchType sw) bool Foam::Switch::asBool(const switchType sw)
{ {
// relies on (INVALID & 0x1) evaluating to false
return (sw & 0x1); return (sw & 0x1);
} }
@ -103,13 +104,19 @@ bool Foam::Switch::asBool
// allow invalid values, but catch after for correct error message // allow invalid values, but catch after for correct error message
switchType sw = asEnum(str, true); switchType sw = asEnum(str, true);
if (sw == Switch::INVALID && !allowInvalid) if (sw == Switch::INVALID)
{
if (!allowInvalid)
{ {
FatalErrorIn("Switch::asBool(const std::string&)") FatalErrorIn("Switch::asBool(const std::string&)")
<< "unknown switch word " << str << nl << "unknown switch word " << str << nl
<< abort(FatalError); << abort(FatalError);
} }
return false;
}
return (sw & 0x1); return (sw & 0x1);
} }

View File

@ -27,7 +27,7 @@ Class
Description Description
A simple wrapper around bool so that it can be read as a word: A simple wrapper around bool so that it can be read as a word:
true/false, on/off, yes/no or y/n. true/false, on/off, yes/no or y/n or none.
SourceFiles SourceFiles
Switch.C Switch.C
@ -80,6 +80,7 @@ public:
OFF = 2, ON = 3, OFF = 2, ON = 3,
NO = 4, YES = 5, NO = 4, YES = 5,
NO_1 = 6, YES_1 = 7, NO_1 = 6, YES_1 = 7,
NONE = 8, PLACEHOLDER = 9,
INVALID INVALID
}; };

View File

@ -32,23 +32,13 @@ License
namespace Foam namespace Foam
{ {
// defineTypeNameAndDebug(displacementFvMotionSolver, 0); defineTypeNameAndDebug(displacementFvMotionSolver, 0);
//
// addToRunTimeSelectionTable
// (
// fvMotionSolver,
// displacementFvMotionSolver,
// dictionary
// );
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::displacementFvMotionSolver:: Foam::displacementFvMotionSolver::displacementFvMotionSolver
displacementFvMotionSolver
( (
const polyMesh& mesh, const polyMesh& mesh,
Istream& Istream&