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

This commit is contained in:
andy
2009-03-23 17:44:57 +00:00
27 changed files with 225 additions and 287 deletions

View File

@ -38,26 +38,22 @@ Description
int main(int argc, char *argv[])
{
argList::noParallel();
# include "addTimeOptions.H"
timeSelector::addOptions(false); // no constant
# include "setRootCase.H"
# include "createTime.H"
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptionsNoConstant.H"
runTime.setTime(Times[startTime], startTime);
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMesh.H"
// make a directory called proInterface in the case
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;
if (mesh.readUpdate())

View File

@ -225,8 +225,10 @@ labelList getSelectedPatches
int main(int argc, char *argv[])
{
# include "addTimeOptions.H"
timeSelector::addOptions();
# include "addRegionOption.H"
argList::validOptions.insert("fields", "fields");
argList::validOptions.insert("cellSet", "cellSet name");
argList::validOptions.insert("faceSet", "faceSet name");
@ -244,7 +246,6 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
bool doWriteInternal = !args.options().found("noInternal");
bool doFaceZones = !args.options().found("noFaceZones");
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"
// VTK/ directory in the case
@ -359,11 +354,11 @@ int main(int argc, char *argv[])
// mesh wrapper; does subsetting and decomposition
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
// decomposition.

View File

@ -52,8 +52,7 @@ vtkPV3FoamReader::vtkPV3FoamReader()
// Add second output for the Lagrangian
this->SetNumberOfOutputPorts(2);
vtkMultiBlockDataSet *lagrangian;
lagrangian = vtkMultiBlockDataSet::New();
vtkMultiBlockDataSet *lagrangian = vtkMultiBlockDataSet::New();
lagrangian->ReleaseData();
this->GetExecutive()->SetOutputData(1, lagrangian);
@ -204,9 +203,9 @@ int vtkPV3FoamReader::RequestInformation
);
}
double timeRange[2];
if (nTimeSteps)
{
double timeRange[2];
timeRange[0] = timeSteps[0];
timeRange[1] = timeSteps[nTimeSteps-1];
@ -273,19 +272,53 @@ int vtkPV3FoamReader::RequestData
}
}
// take port0 as the lead for other outputs
vtkInformation *outInfo = outputVector->GetInformationObject(0);
// Get the requested time step.
// 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
(
outInfo->Get
outputVector->GetInformationObject(0)->Get
(
vtkMultiBlockDataSet::DATA_OBJECT()
)
);
vtkMultiBlockDataSet* lagrangianOutput = vtkMultiBlockDataSet::SafeDownCast
(
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)
{

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

View File

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

View File

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

View File

@ -36,25 +36,18 @@ Description
int main(int argc, char *argv[])
{
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H"
# include "createTime.H"
// Get times list
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
instantList timeDirs = timeSelector::select0(runTime, args);
# 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;

View File

@ -37,25 +37,18 @@ Description
int main(int argc, char *argv[])
{
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H"
# include "createTime.H"
// Get times list
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
instantList timeDirs = timeSelector::select0(runTime, args);
# 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();

View File

@ -29,6 +29,8 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "fvMesh.H"
#include "vectorIOField.H"
#include "volFields.H"
@ -41,23 +43,18 @@ using namespace Foam;
int main(int argc, char *argv[])
{
# include "addTimeOptions.H"
timeSelector::addOptions();
# include "setRootCase.H"
# include "createTime.H"
// Get times list
instantList Times = runTime.times();
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
instantList timeDirs = timeSelector::select0(runTime, args);
# 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;
@ -77,10 +74,10 @@ int main(int argc, char *argv[])
mesh.C()
);
//Info<< "Writing cellCentre positions to " << cc.name() << " in "
// << runTime.timeName() << endl;
// Info<< "Writing cellCentre positions to " << cc.name() << " in "
// << runTime.timeName() << endl;
//
//cc.write();
// cc.write();
Info<< "Writing components of cellCentre positions to volScalarFields"
<< " ccx, ccy, ccz in " << runTime.timeName() << endl;
@ -104,7 +101,7 @@ int main(int argc, char *argv[])
}
}
Info << nl << "End" << endl;
Info<< "\nEnd" << endl;
return 0;
}

View File

@ -38,23 +38,16 @@ Description
int main(int argc, char *argv[])
{
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H"
# include "createTime.H"
// Get times list
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMesh.H"
runTime.setTime(Times[endTime-1], endTime-1);
runTime.setTime(timeDirs[timeDirs.size()-1], timeDirs.size()-1);
volScalarField pMean
(
@ -68,9 +61,9 @@ int main(int argc, char *argv[])
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;

View File

@ -35,30 +35,22 @@ Description
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H"
# include "createTime.H"
// Get times list
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
instantList timeDirs = timeSelector::select0(runTime, args);
# 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;

View File

@ -42,24 +42,19 @@ Source files:
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
timeSelector::addOptions();
#include "setRootCase.H"
#include "createTime.H"
// Get times list
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);
#include "createMesh.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;

View File

@ -26,7 +26,7 @@ Application
streamFunction
Description
Calculates and writes the stream function of velocity field U at each time
Calculates and writes the stream function of velocity field U at each time
\*---------------------------------------------------------------------------*/
@ -42,27 +42,20 @@ Description
int main(int argc, char *argv[])
{
timeSelector::addOptions();
# include "addTimeOptions.H"
# include "setRootCase.H"
# include "createTime.H"
// Get times list
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMeshNoClear.H"
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;