Commit e3ee5fcf authored by Chris Greenshields's avatar Chris Greenshields
Browse files

Merge branch 'master' of ssh://chris@noisy/~OpenFOAM/OpenFOAM-dev

parents be461afe b2744a5e
......@@ -16,6 +16,8 @@
*.la
*.so
*.jar
# ignore derived files
lex.yy.c
# Corefiles
......@@ -32,9 +34,10 @@ linux*Gcc*
# reinstate wmake/rules that look like build folders
!wmake/rules/linux*
# but do ignore the derived files in there
wmake/rules/linux*/dirToString
wmake/rules/linux*/wmkdep
# but do continue to ignore the derived wmake files
wmake/rules/*/dirToString
wmake/rules/*/wmkdep
# doxygen generated documentation
doc/[Dd]oxygen/html
......
polyDualMesh.C
polyDualMeshApp.C
EXE = $(FOAM_APPBIN)/polyDualMesh
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/conversion/lnInclude
EXE_LIBS = \
-lmeshTools
-lmeshTools -lconversion
......@@ -344,7 +344,7 @@ bool doCommand
/ (10*Pstream::nProcs());
bool error = false;
bool ok = true;
// Set to work on
autoPtr<topoSet> currentSetPtr(NULL);
......@@ -388,7 +388,7 @@ bool doCommand
Pout<< " Cannot construct/load set "
<< topoSet::localPath(mesh, setName) << endl;
error = true;
ok = false;
}
else
{
......@@ -518,7 +518,7 @@ bool doCommand
}
catch (Foam::IOerror& fIOErr)
{
error = true;
ok = false;
Pout<< fIOErr.message().c_str() << endl;
......@@ -529,7 +529,7 @@ bool doCommand
}
catch (Foam::error& fErr)
{
error = true;
ok = false;
Pout<< fErr.message().c_str() << endl;
......@@ -539,15 +539,16 @@ bool doCommand
}
}
return !error;
return ok;
}
// Status returned from parsing the first token of the line
enum commandStatus
{
QUIT,
INVALID,
VALID
QUIT, // quit program
INVALID, // token is not a valid set manipulation command
VALID // ,, is a valid ,,
};
......@@ -841,7 +842,7 @@ int main(int argc, char *argv[])
}
}
ok = false;
ok = true;
if (stat == QUIT)
{
......
......@@ -50,6 +50,14 @@ Usage
Remove any existing @a processor subdirectories before decomposing the
geometry.
@param -ifRequired \n
Only decompose the geometry if the number of domains has changed from a
previous decomposition. No @a processor subdirectories will be removed
unless the @a -force option is also specified. This option can be used
to avoid redundant geometry decomposition (eg, in scripts), but should
be used with caution when the underlying (serial) geometry or the
decomposition method etc. have been changed between decompositions.
\*---------------------------------------------------------------------------*/
#include "OSspecific.H"
......@@ -80,6 +88,7 @@ int main(int argc, char *argv[])
argList::validOptions.insert("fields", "");
argList::validOptions.insert("filterPatches", "");
argList::validOptions.insert("force", "");
argList::validOptions.insert("ifRequired", "");
# include "setRootCase.H"
......@@ -88,6 +97,7 @@ int main(int argc, char *argv[])
bool decomposeFieldsOnly(args.options().found("fields"));
bool filterPatches(args.options().found("filterPatches"));
bool forceOverwrite(args.options().found("force"));
bool ifRequiredDecomposition(args.options().found("ifRequired"));
# include "createTime.H"
......@@ -100,47 +110,84 @@ int main(int argc, char *argv[])
++nProcs;
}
// Check for previously decomposed case first
// get requested numberOfSubdomains
label nDomains = 0;
{
IOdictionary decompDict
(
IOobject
(
"decomposeParDict",
runTime.time().system(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
decompDict.lookup("numberOfSubdomains") >> nDomains;
}
if (decomposeFieldsOnly)
{
if (!nProcs)
// Sanity check on previously decomposed case
if (nProcs != nDomains)
{
FatalErrorIn(args.executable())
<< "Specifying -fields requires a decomposed geometry!"
<< "Specified -fields, but the case was decomposed with "
<< nProcs << " domains"
<< nl
<< "instead of " << nDomains
<< " domains as specified in decomposeParDict"
<< nl
<< exit(FatalError);
}
}
else
else if (nProcs)
{
if (nProcs)
bool procDirsProblem = true;
if (ifRequiredDecomposition && nProcs == nDomains)
{
if (forceOverwrite)
{
Info<< "Removing " << nProcs
<< " existing processor directories" << endl;
// we can reuse the decomposition
decomposeFieldsOnly = true;
procDirsProblem = false;
forceOverwrite = false;
// remove existing processor dirs
for (label procI = nProcs-1; procI >= 0; --procI)
{
fileName procDir
(
runTime.path()/(word("processor") + name(procI))
);
Info<< "Using existing processor directories" << nl;
}
rmDir(procDir);
}
}
else
if (forceOverwrite)
{
Info<< "Removing " << nProcs
<< " existing processor directories" << endl;
// remove existing processor dirs
// reverse order to avoid gaps if someone interrupts the process
for (label procI = nProcs-1; procI >= 0; --procI)
{
FatalErrorIn(args.executable())
<< "Case is already decomposed, "
"use the -force option or manually remove" << nl
<< "processor directories before decomposing. e.g.," << nl
<< " rm -rf " << runTime.path().c_str() << "/processor*"
<< nl
<< exit(FatalError);
fileName procDir
(
runTime.path()/(word("processor") + name(procI))
);
rmDir(procDir);
}
procDirsProblem = false;
}
if (procDirsProblem)
{
FatalErrorIn(args.executable())
<< "Case is already decomposed with " << nProcs
<< " domains, use the -force option or manually" << nl
<< "remove processor directories before decomposing. e.g.,"
<< nl
<< " rm -rf " << runTime.path().c_str() << "/processor*"
<< nl
<< exit(FatalError);
}
}
......
// Mesh decomposition control dictionary
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
/*-------------------------------*- C++ -*---------------------------------*\
| ========= |
| \\ / OpenFOAM |
| \\ / |
| \\ / The Open Source CFD Toolbox |
| \\/ http://www.OpenFOAM.org |
\*-------------------------------------------------------------------------*/
FoamFile
{
version 0.5;
format ascii;
root "ROOT";
case "CASE";
instance "system";
local "";
class dictionary;
object decompositionDict;
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
numberOfSubdomains 4;
//preservePatches (inlet);
//preserveFaceZones (heater solid1 solid3);
// preservePatches (inlet);
// preserveFaceZones (heater solid1 solid3);
method simple;
//method hierarchical;
//method metis;
//method manual;
method simple;
// method hierarchical;
// method metis;
// method manual;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (2 2 1);
delta 0.001;
order xyz;
n (2 2 1);
delta 0.001;
order xyz;
}
metisCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
/*
processorWeights
(
1
1
1
1
);
*/
}
manualCoeffs
{
dataFile "decompositionData";
dataFile "decompositionData";
}
// ************************************************************************* //
......@@ -70,6 +70,7 @@ Foam::polyMesh::readUpdateState Foam::vtkMesh::readUpdate()
// the subset even if only movement.
topoPtr_.clear();
pointMeshPtr_.clear();
if (setName_.size() > 0)
{
......
#!/bin/sh
set -x
rm -r PV3FoamReader/Make
wclean libso vtkPV3Foam
......@@ -54,7 +54,7 @@ vtkPV3FoamReader::vtkPV3FoamReader()
{
Debug = 0;
vtkDebugMacro(<<"Constructor");
SetNumberOfInputPorts(0);
FileName = NULL;
......@@ -115,7 +115,6 @@ vtkPV3FoamReader::vtkPV3FoamReader()
vtkPV3FoamReader::~vtkPV3FoamReader()
{
vtkDebugMacro(<<"Deconstructor");
cout << "Destroy ~vtkPV3FoamReader\n";
if (foamData_)
{
......@@ -152,23 +151,30 @@ int vtkPV3FoamReader::RequestInformation
)
{
vtkDebugMacro(<<"RequestInformation");
cout<<"REQUEST_INFORMATION\n";
if (Foam::vtkPV3Foam::debug)
{
cout<<"REQUEST_INFORMATION\n";
}
if (!FileName)
{
vtkErrorMacro("FileName has to be specified!");
return 0;
}
if (Foam::vtkPV3Foam::debug)
{
vtkInformation* outputInfo = this->GetOutputPortInformation(0);
outputInfo->Print(cout);
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
(
outputInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT())
);
if (output)
outputInfo->Print(cout);
if (output)
{
output->Print(cout);
}
......@@ -177,21 +183,19 @@ int vtkPV3FoamReader::RequestInformation
cout << "no output\n";
}
cout << "GetExecutive:\n";
this->GetExecutive()->GetOutputInformation(0)->Print(cout);
}
{
int nInfo = outputVector->GetNumberOfInformationObjects();
cout<<"requestInfo with " << nInfo << " items\n";
cout<< "requestInfo with " << nInfo << " items:\n";
for (int i=0; i<nInfo; i++)
{
vtkInformation *info = outputVector->GetInformationObject(i);
info->Print(cout);
}
}
vtkInformation *outInfo = outputVector->GetInformationObject(0);
if (!foamData_)
......@@ -207,15 +211,12 @@ int vtkPV3FoamReader::RequestInformation
else
{
vtkDebugMacro("RequestInformation: updating information");
foamData_->UpdateInformation();
}
int nTimeSteps = 0;
double* timeSteps = foamData_->timeSteps(nTimeSteps);
cout<<"Have nTimeSteps: " << nTimeSteps << "\n";
outInfo->Set
(
vtkStreamingDemandDrivenPipeline::TIME_STEPS(),
......@@ -229,13 +230,16 @@ int vtkPV3FoamReader::RequestInformation
timeRange[0] = timeSteps[0];
timeRange[1] = timeSteps[nTimeSteps-1];
cout<<"nTimeSteps " << nTimeSteps << "\n";
cout<<"timeRange " << timeRange[0] << " -> " << timeRange[1] << "\n";
if (Foam::vtkPV3Foam::debug)
{
cout<<"nTimeSteps " << nTimeSteps << "\n";
cout<<"timeRange " << timeRange[0] << " to " << timeRange[1] << "\n";
// for (int i = 0; i < nTimeSteps; ++i)
// {
// cout<<"step[" << i << "] = " << timeSteps[i] << "\n";
// }
for (int i = 0; i < nTimeSteps; ++i)
{
cout<< "step[" << i << "] = " << timeSteps[i] << "\n";
}
}
outInfo->Set
(
......@@ -247,7 +251,6 @@ int vtkPV3FoamReader::RequestInformation
delete timeSteps;
cout<<"done RequestInformation\n";
return 1;
}
......@@ -261,21 +264,27 @@ int vtkPV3FoamReader::RequestData
)
{
vtkDebugMacro(<<"RequestData");
cout<<"REQUEST_DATA\n";
if (!FileName)
{
vtkErrorMacro("FileName has to be specified!");
return 0;
}
{
int nInfo = outputVector->GetNumberOfInformationObjects();
cout<<"requestData with " << nInfo << " items\n";
if (Foam::vtkPV3Foam::debug)
{
cout<<"requestData with " << nInfo << " items\n";
}
for (int i=0; i<nInfo; i++)
{
vtkInformation *info = outputVector->GetInformationObject(i);
info->Print(cout);
if (Foam::vtkPV3Foam::debug)
{
info->Print(cout);
}
}
}
......@@ -284,38 +293,38 @@ int vtkPV3FoamReader::RequestData
(
outInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT())
);
#if 1
if (Foam::vtkPV3Foam::debug)
{
vtkInformation* outputInfo = this->GetOutputPortInformation(0);
outputInfo->Print(cout);
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
(
outputInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT())
);
if (output)
if (output)
{
output->Print(cout);
}
else
{
cout << "no output\n";
cout<< "no output\n";
}
vtkInformation* execInfo = this->GetExecutive()->GetOutputInformation(0);
execInfo->Print(cout);
outInfo->Print(cout);
vtkMultiBlockDataSet* dobj = vtkMultiBlockDataSet::SafeDownCast
(
outInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT())
);
if (dobj)
if (dobj)
{
dobj->Print(cout);
vtkInformation* dobjInfo = dobj->GetInformation();
dobjInfo->Print(cout);
}
......@@ -323,16 +332,16 @@ int vtkPV3FoamReader::RequestData
{
cout << "no data_object\n";
}
}
#endif
if (outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()))
{
cout<<"Has UPDATE_TIME_STEPS\n";
cout<<"output->GetNumberOfBlocks() " << output->GetNumberOfBlocks() <<
"\n";
if (Foam::vtkPV3Foam::debug)
{
cout<<"Has UPDATE_TIME_STEPS\n";
cout<<"output->GetNumberOfBlocks() = "
<< output->GetNumberOfBlocks() << "\n";
}
// Get the requested time step.
// We only supprt requests of a single time step
......@@ -370,10 +379,6 @@ int vtkPV3FoamReader::RequestData
}
UpdateGUIOld = GetUpdateGUI();
cout<<"done RequestData\n";
cout<<"done output->GetNumberOfBlocks() "
<< output->GetNumberOfBlocks() << "\n";