Merge branch 'master' into cvm

This commit is contained in:
graham
2010-10-22 12:45:30 +01:00
472 changed files with 8917 additions and 7259 deletions

View File

@ -29,13 +29,29 @@
=metis-5.0pre2=, =ParMetis-3.1= and =ParMGridGen-1.0=.
* Library developments
There have been a number of developments to the libraries to support the
extension of functionality in solver and utility applications.
*** Core library
+ Large number of code refinements and consistency improvements to support
other developments.
*** Turbulence modelling
*** Thermo-physical Models
*** *Updated* thermophysical libraries
+ Now use the more descriptive dictionary input format, e.g. for a single
component mixture:
thermoType hPsiThermo<pureMixture<sutherlandTransport<specieThermo<hConstThermo<perfectGas>>>>>;
mixture
{
nMoles 1;
molWeight 28.9;
Cp 1007;
Hf 0;
As 1.4792e-06;
Ts 116;
}
*** DSMC
*** Dynamic Mesh
*** Numerics
@ -67,8 +83,10 @@
+ Additional wall functions for primary region momentum and temperature
taking film into account
+ Parallel aware
*** *New* ptscotch decomposition method
*** *Updated* particle tracking algorithm
*** *Updated* split cyclics into two separate patches. See doc/changed/splitCyclics.txt
*** *New* compact binary I/O for faces and cells. This speeds up reading/writing meshes in binary.
* Solvers
A number of new solvers have been developed for a range of engineering
applications. There has been a set of improvements to certain classes of
@ -108,10 +126,12 @@
+ extrudes into master direction (i.e. away from the owner cell
if flipMap is false)
*** Updated utilities
+ ...
+ =setFields=: optionally use faceSets to set patch values (see e.g. hotRoom tutorial).
+ =blockMesh=: specify patches via dictionary instead of type only. This
makes rereading the boundary superfluous. see
e.g. pitzDailyDirectMapped tutorial.
* Post-processing
+ =foamToEnsight=: new =-nodeValues= option to generate and output nodal
+ =foamToEnsight=: parallel continuous data. new =-nodeValues= option to generate and output nodal
field data.
+ Function objects:
+ =residualControl=: new function object to allow users to terminate steady

View File

@ -55,6 +55,7 @@ Description
#include "edgeStats.H"
#include "treeDataTriSurface.H"
#include "indexedOctree.H"
#include "globalMeshData.H"
using namespace Foam;
@ -298,7 +299,7 @@ label selectOutsideCells
mesh,
outsideFaces.shrink(),
outsideFacesInfo.shrink(),
mesh.nCells() // max iterations
mesh.globalData().nTotalCells()+1 // max iterations
);
// Now regionCalc should hold info on cells that are reachable from

View File

@ -43,7 +43,7 @@ Description
#include "polyMeshZipUpCells.H"
#include "wallPolyPatch.H"
#include "symmetryPolyPatch.H"
#include "cyclicPolyPatch.H"
#include "oldCyclicPolyPatch.H"
#include "Swap.H"
#include "IFstream.H"
#include "readHexLabel.H"
@ -900,7 +900,7 @@ int main(int argc, char *argv[])
fluentToFoamType.insert("interface", polyPatch::typeName);
fluentToFoamType.insert("internal", polyPatch::typeName);
fluentToFoamType.insert("solid", polyPatch::typeName);
fluentToFoamType.insert("fan", cyclicPolyPatch::typeName);
fluentToFoamType.insert("fan", oldCyclicPolyPatch::typeName);
fluentToFoamType.insert("radiator", polyPatch::typeName);
fluentToFoamType.insert("porous-jump", polyPatch::typeName);

View File

@ -41,7 +41,7 @@ Description
#include "wallPolyPatch.H"
#include "symmetryPolyPatch.H"
#include "wedgePolyPatch.H"
#include "cyclicPolyPatch.H"
#include "oldCyclicPolyPatch.H"
#include "unitConversion.H"
using namespace Foam;

View File

@ -196,7 +196,7 @@ const word* kivaPatchTypes[nBCs] =
&polyPatch::typeName,
&polyPatch::typeName,
&symmetryPolyPatch::typeName,
&cyclicPolyPatch::typeName
&oldCyclicPolyPatch::typeName
};
enum patchTypeNames

View File

@ -29,7 +29,7 @@ Description
#include "sammMesh.H"
#include "Time.H"
#include "wallPolyPatch.H"
#include "cyclicPolyPatch.H"
#include "oldCyclicPolyPatch.H"
#include "symmetryPolyPatch.H"
#include "preservePatchTypes.H"
#include "IFstream.H"
@ -208,7 +208,7 @@ void sammMesh::readBoundary()
{
// incorrect. should be cyclicPatch but this
// requires info on connected faces.
patchTypes_[patchLabel] = cyclicPolyPatch::typeName;
patchTypes_[patchLabel] = oldCyclicPolyPatch::typeName;
}
else
{

View File

@ -29,7 +29,7 @@ Description
#include "starMesh.H"
#include "Time.H"
#include "wallPolyPatch.H"
#include "cyclicPolyPatch.H"
#include "oldCyclicPolyPatch.H"
#include "symmetryPolyPatch.H"
#include "preservePatchTypes.H"
#include "IFstream.H"
@ -206,7 +206,7 @@ void starMesh::readBoundary()
{
// incorrect. should be cyclicPatch but this
// requires info on connected faces.
patchTypes_[patchLabel] = cyclicPolyPatch::typeName;
patchTypes_[patchLabel] = oldCyclicPolyPatch::typeName;
}
else
{

View File

@ -11,7 +11,7 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-ldecompositionMethods \
-L$(FOAM_MPI_LIBBIN) -lptscotchDecomp \
-L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \
-lmeshTools \
-ldynamicMesh \
-lautoMesh

View File

@ -0,0 +1,47 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "SetPatchFields.H"
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template<class GeoField>
void Foam::SetPatchFields
(
PtrList<GeoField>& fields,
const label patchI,
const typename GeoField::value_type& initVal
)
{
forAll(fields, i)
{
typename GeoField::PatchFieldType& pfld =
fields[i].boundaryField()[patchI];
pfld == initVal;
}
}
// ************************************************************************* //

View File

@ -21,73 +21,46 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
setHotRoom
Global
Foam::SetPatchFields
Description
Set the initial field of T for the hot room problem.
Helper routine to initialise a patch field to a constant value
SourceFiles
SetPatchFields.C
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "OSspecific.H"
#include "fixedValueFvPatchFields.H"
#ifndef SetPatchFields_H
#define SetPatchFields_H
#include "PtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
namespace Foam
{
# include "setRootCase.H"
//- Helper routine to read fields
template<class GeoField>
void SetPatchFields
(
PtrList<GeoField>& fields,
const label patchI,
const typename GeoField::value_type& initVal
);
# include "createTime.H"
# include "createMesh.H"
# include "createFields.H"
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
volScalarField::GeometricBoundaryField& Tpatches = T.boundaryField();
#ifdef NoRepository
# include "SetPatchFields.C"
#endif
forAll(Tpatches, patchI)
{
if
(
isA<fixedValueFvPatchScalarField>(Tpatches[patchI])
&& mesh.boundaryMesh()[patchI].name() == "floor"
)
{
fixedValueFvPatchScalarField& Tpatch =
refCast<fixedValueFvPatchScalarField>(Tpatches[patchI]);
const vectorField& faceCentres =
mesh.Cf().boundaryField()[patchI];
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
forAll(faceCentres, facei)
{
if
(
(faceCentres[facei].x() > 4.5) &&
(faceCentres[facei].x() < 5.5) &&
(faceCentres[facei].z() > 4.5) &&
(faceCentres[facei].z() < 5.5)
)
{
Tpatch[facei] = 600;
}
else
{
Tpatch[facei] = 300;
}
}
};
#endif
Info<< "Writing modified field T\n" << endl;
T.write();
Info<< "End\n" << endl;
return 0;
}
}
// ************************************************************************* //

View File

@ -43,6 +43,8 @@ Description
#include "volFields.H"
#include "surfaceFields.H"
#include "ZoneIDs.H"
#include "fvMeshMapper.H"
#include "SetPatchFields.H"
using namespace Foam;
@ -241,45 +243,39 @@ int main(int argc, char *argv[])
IOobjectList objects(mesh, runTime.timeName());
// Read vol fields.
if (args.optionFound("updateFields"))
{
Info<< "Reading geometric fields" << nl << endl;
PtrList<volScalarField> vsFlds;
ReadFields(mesh, objects, vsFlds);
Info<< "Reading geometric fields" << nl << endl;
PtrList<volScalarField> vsFlds;
ReadFields(mesh, objects, vsFlds);
PtrList<volVectorField> vvFlds;
ReadFields(mesh, objects, vvFlds);
PtrList<volVectorField> vvFlds;
ReadFields(mesh, objects, vvFlds);
PtrList<volSphericalTensorField> vstFlds;
ReadFields(mesh, objects, vstFlds);
PtrList<volSphericalTensorField> vstFlds;
ReadFields(mesh, objects, vstFlds);
PtrList<volSymmTensorField> vsymtFlds;
ReadFields(mesh, objects, vsymtFlds);
PtrList<volSymmTensorField> vsymtFlds;
ReadFields(mesh, objects, vsymtFlds);
PtrList<volTensorField> vtFlds;
ReadFields(mesh, objects, vtFlds);
PtrList<volTensorField> vtFlds;
ReadFields(mesh, objects, vtFlds);
// Read surface fields.
// Read surface fields.
PtrList<surfaceScalarField> ssFlds;
ReadFields(mesh, objects, ssFlds);
PtrList<surfaceScalarField> ssFlds;
ReadFields(mesh, objects, ssFlds);
PtrList<surfaceVectorField> svFlds;
ReadFields(mesh, objects, svFlds);
PtrList<surfaceVectorField> svFlds;
ReadFields(mesh, objects, svFlds);
PtrList<surfaceSphericalTensorField> sstFlds;
ReadFields(mesh, objects, sstFlds);
PtrList<surfaceSphericalTensorField> sstFlds;
ReadFields(mesh, objects, sstFlds);
PtrList<surfaceSymmTensorField> ssymtFlds;
ReadFields(mesh, objects, ssymtFlds);
PtrList<surfaceSymmTensorField> ssymtFlds;
ReadFields(mesh, objects, ssymtFlds);
PtrList<surfaceTensorField> stFlds;
ReadFields(mesh, objects, stFlds);
PtrList<surfaceTensorField> stFlds;
ReadFields(mesh, objects, stFlds);
}
else
{
Info<< "Not updating geometric fields" << nl << endl;
}
// Mesh change container
polyTopoChange meshMod(mesh);
@ -484,6 +480,58 @@ int main(int argc, char *argv[])
// Update fields
mesh.updateMesh(map);
// Correct boundary faces mapped-out-of-nothing.
{
fvMeshMapper mapper(mesh, map);
bool hasWarned = false;
forAll(newMasterPatches, i)
{
label patchI = newMasterPatches[i];
const fvPatchMapper& pm = mapper.boundaryMap()[patchI];
if (pm.sizeBeforeMapping() == 0)
{
if (!hasWarned)
{
hasWarned = true;
WarningIn(args.executable())
<< "Setting field on boundary faces to zero." << endl
<< "You might have to edit these fields." << endl;
}
SetPatchFields(vsFlds, patchI, pTraits<scalar>::zero);
SetPatchFields(vvFlds, patchI, pTraits<vector>::zero);
SetPatchFields(vstFlds, patchI, pTraits<sphericalTensor>::zero);
SetPatchFields(vsymtFlds, patchI, pTraits<symmTensor>::zero);
SetPatchFields(vtFlds, patchI, pTraits<tensor>::zero);
SetPatchFields(ssFlds, patchI, pTraits<scalar>::zero);
SetPatchFields(svFlds, patchI, pTraits<vector>::zero);
SetPatchFields(sstFlds, patchI, pTraits<sphericalTensor>::zero);
SetPatchFields(ssymtFlds, patchI, pTraits<symmTensor>::zero);
SetPatchFields(stFlds, patchI, pTraits<tensor>::zero);
}
}
forAll(newSlavePatches, i)
{
label patchI = newSlavePatches[i];
const fvPatchMapper& pm = mapper.boundaryMap()[patchI];
if (pm.sizeBeforeMapping() == 0)
{
SetPatchFields(vsFlds, patchI, pTraits<scalar>::zero);
SetPatchFields(vvFlds, patchI, pTraits<vector>::zero);
SetPatchFields(vstFlds, patchI, pTraits<sphericalTensor>::zero);
SetPatchFields(vsymtFlds, patchI, pTraits<symmTensor>::zero);
SetPatchFields(vtFlds, patchI, pTraits<tensor>::zero);
SetPatchFields(ssFlds, patchI, pTraits<scalar>::zero);
SetPatchFields(svFlds, patchI, pTraits<vector>::zero);
SetPatchFields(sstFlds, patchI, pTraits<sphericalTensor>::zero);
SetPatchFields(ssymtFlds, patchI, pTraits<symmTensor>::zero);
SetPatchFields(stFlds, patchI, pTraits<tensor>::zero);
}
}
}
// Move mesh (since morphing might not do this)
if (map().hasMotionPoints())
{

View File

@ -4,4 +4,5 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools
-lmeshTools \
-lgenericPatchFields

View File

@ -7,6 +7,6 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-lgenericPatchFields \
-ldecompositionMethods -lmetisDecomp -lscotchDecomp \
-ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lmetisDecomp -lscotchDecomp \
-llagrangian \
-lmeshTools

View File

@ -7,6 +7,6 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-ldecompositionMethods \
-L$(FOAM_MPI_LIBBIN) -lptscotchDecomp \
-L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \
-lmeshTools \
-ldynamicMesh

View File

@ -57,7 +57,6 @@ public:
labelList prisms;
labelList wedges;
labelList hexes;
labelList hexesWedges;
labelList polys;
@ -77,7 +76,6 @@ public:
prisms(nCells),
wedges(nCells),
hexes(nCells),
hexesWedges(nCells),
polys(nCells)
{}
};

View File

@ -38,6 +38,32 @@ using namespace Foam;
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template<class Type>
Field<Type> map
(
const Field<Type>& vf,
const labelList& map1,
const labelList& map2
)
{
Field<Type> mf(map1.size() + map2.size());
forAll(map1, i)
{
mf[i] = vf[map1[i]];
}
label offset = map1.size();
forAll(map2, i)
{
mf[i + offset] = vf[map2[i]];
}
return mf;
}
template<class Type>
void writeField
(
@ -274,7 +300,8 @@ void ensightField
const labelList& tets = meshCellSets.tets;
const labelList& pyrs = meshCellSets.pyrs;
const labelList& prisms = meshCellSets.prisms;
const labelList& hexesWedges = meshCellSets.hexesWedges;
const labelList& wedges = meshCellSets.wedges;
const labelList& hexes = meshCellSets.hexes;
const labelList& polys = meshCellSets.polys;
ensightStream* ensightFilePtr = NULL;
@ -328,7 +355,7 @@ void ensightField
writeField
(
"hexa8",
Field<Type>(vf, hexesWedges),
map(vf, hexes, wedges),
ensightFile
);
@ -548,99 +575,99 @@ void ensightPointField
}
label ensightPatchI = eMesh.patchPartOffset();
label ensightPatchI = eMesh.patchPartOffset();
forAll(allPatchNames, patchi)
{
const word& patchName = allPatchNames[patchi];
forAll(allPatchNames, patchi)
{
const word& patchName = allPatchNames[patchi];
eMesh.barrier();
eMesh.barrier();
if (patchNames.empty() || patchNames.found(patchName))
{
const fvPatch& p = mesh.boundary()[patchi];
if
(
returnReduce(p.size(), sumOp<label>())
> 0
)
{
// Renumber the patch points/faces into unique points
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPointsPtr =
mesh.globalData().mergePoints
(
p.patch().meshPoints(),
p.patch().meshPointMap(),
pointToGlobal,
uniqueMeshPointLabels
);
if (patchNames.empty() || patchNames.found(patchName))
{
const fvPatch& p = mesh.boundary()[patchi];
if
(
returnReduce(p.size(), sumOp<label>())
> 0
)
{
// Renumber the patch points/faces into unique points
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPointsPtr =
mesh.globalData().mergePoints
(
p.patch().meshPoints(),
p.patch().meshPointMap(),
pointToGlobal,
uniqueMeshPointLabels
);
if (Pstream::master())
{
ensightFile.writePartHeader(ensightPatchI);
}
if (Pstream::master())
{
ensightFile.writePartHeader(ensightPatchI);
}
writeField
(
"coordinates",
Field<Type>(pf.internalField(), uniqueMeshPointLabels),
ensightFile
);
writeField
(
"coordinates",
Field<Type>(pf.internalField(), uniqueMeshPointLabels),
ensightFile
);
ensightPatchI++;
}
}
}
ensightPatchI++;
}
}
}
// write faceZones, if requested
if (faceZoneNames.size())
{
forAllConstIter(wordHashSet, faceZoneNames, iter)
{
const word& faceZoneName = iter.key();
eMesh.barrier();
label zoneID = mesh.faceZones().findZoneID(faceZoneName);
const faceZone& fz = mesh.faceZones()[zoneID];
if (returnReduce(fz().nPoints(), sumOp<label>()) > 0)
{
// Renumber the faceZone points/faces into unique points
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPointsPtr =
mesh.globalData().mergePoints
(
fz().meshPoints(),
fz().meshPointMap(),
pointToGlobal,
uniqueMeshPointLabels
);
if (Pstream::master())
{
ensightFile.writePartHeader(ensightPatchI);
}
writeField
(
"coordinates",
Field<Type>
(
pf.internalField(),
uniqueMeshPointLabels
),
ensightFile
);
ensightPatchI++;
}
}
}
// write faceZones, if requested
if (faceZoneNames.size())
{
forAllConstIter(wordHashSet, faceZoneNames, iter)
{
const word& faceZoneName = iter.key();
eMesh.barrier();
label zoneID = mesh.faceZones().findZoneID(faceZoneName);
const faceZone& fz = mesh.faceZones()[zoneID];
if (returnReduce(fz().nPoints(), sumOp<label>()) > 0)
{
// Renumber the faceZone points/faces into unique points
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPointsPtr =
mesh.globalData().mergePoints
(
fz().meshPoints(),
fz().meshPointMap(),
pointToGlobal,
uniqueMeshPointLabels
);
if (Pstream::master())
{
ensightFile.writePartHeader(ensightPatchI);
}
writeField
(
"coordinates",
Field<Type>
(
pf.internalField(),
uniqueMeshPointLabels
),
ensightFile
);
ensightPatchI++;
}
}
}
if (Pstream::master())
{

View File

@ -70,12 +70,15 @@ void Foam::ensightMesh::correct()
// Patches are output. Check that they're synced.
mesh_.boundaryMesh().checkParallelSync(true);
allPatchNames_ = wordList::subList
(
mesh_.boundaryMesh().names(),
mesh_.boundary().size()
- mesh_.globalData().processorPatches().size()
);
allPatchNames_ = mesh_.boundaryMesh().names();
if (Pstream::parRun())
{
allPatchNames_.setSize
(
mesh_.boundary().size()
- mesh_.globalData().processorPatches().size()
);
}
if (patches_)
{
@ -114,7 +117,6 @@ void Foam::ensightMesh::correct()
labelList& prisms = meshCellSets_.prisms;
labelList& wedges = meshCellSets_.wedges;
labelList& hexes = meshCellSets_.hexes;
labelList& hexesWedges = meshCellSets_.hexesWedges;
labelList& polys = meshCellSets_.polys;
label nTets = 0;
@ -122,7 +124,6 @@ void Foam::ensightMesh::correct()
label nPrisms = 0;
label nWedges = 0;
label nHexes = 0;
label nHexesWedges = 0;
label nPolys = 0;
forAll(cellShapes, cellI)
@ -145,12 +146,10 @@ void Foam::ensightMesh::correct()
else if (cellModel == wedge)
{
wedges[nWedges++] = cellI;
hexesWedges[nHexesWedges++] = cellI;
}
else if (cellModel == hex)
{
hexes[nHexes++] = cellI;
hexesWedges[nHexesWedges++] = cellI;
}
else
{
@ -163,7 +162,6 @@ void Foam::ensightMesh::correct()
prisms.setSize(nPrisms);
wedges.setSize(nWedges);
hexes.setSize(nHexes);
hexesWedges.setSize(nHexesWedges);
polys.setSize(nPolys);
meshCellSets_.nTets = nTets;
@ -175,7 +173,7 @@ void Foam::ensightMesh::correct()
meshCellSets_.nPrisms = nPrisms;
reduce(meshCellSets_.nPrisms, sumOp<label>());
meshCellSets_.nHexesWedges = nHexesWedges;
meshCellSets_.nHexesWedges = nWedges+nHexes;
reduce(meshCellSets_.nHexesWedges, sumOp<label>());
meshCellSets_.nPolys = nPolys;

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Selects a cell set through a dictionary.
Set values on a selected set of cells/patchfaces through a dictionary.
\*---------------------------------------------------------------------------*/
@ -32,12 +32,13 @@ Description
#include "fvMesh.H"
#include "topoSetSource.H"
#include "cellSet.H"
#include "faceSet.H"
#include "volFields.H"
using namespace Foam;
template<class Type>
bool setFieldType
bool setCellFieldType
(
const word& fieldTypeDesc,
const fvMesh& mesh,
@ -65,7 +66,8 @@ bool setFieldType
// Check field exists
if (fieldHeader.headerOk())
{
Info<< " Setting " << fieldHeader.headerClassName()
Info<< " Setting internal values of "
<< fieldHeader.headerClassName()
<< " " << fieldName << endl;
fieldType field(fieldHeader, mesh);
@ -96,7 +98,7 @@ bool setFieldType
{
WarningIn
(
"void setFieldType"
"void setCellFieldType"
"(const fvMesh& mesh, const labelList& selectedCells,"
"Istream& fieldValueStream)"
) << "Field " << fieldName << " not found" << endl;
@ -106,17 +108,17 @@ bool setFieldType
}
class setField
class setCellField
{
public:
setField()
setCellField()
{}
autoPtr<setField> clone() const
autoPtr<setCellField> clone() const
{
return autoPtr<setField>(new setField());
return autoPtr<setCellField>(new setCellField());
}
class iNew
@ -132,37 +134,200 @@ public:
selectedCells_(selectedCells)
{}
autoPtr<setField> operator()(Istream& fieldValues) const
autoPtr<setCellField> operator()(Istream& fieldValues) const
{
word fieldType(fieldValues);
if
(
!(
setFieldType<scalar>
setCellFieldType<scalar>
(fieldType, mesh_, selectedCells_, fieldValues)
|| setFieldType<vector>
|| setCellFieldType<vector>
(fieldType, mesh_, selectedCells_, fieldValues)
|| setFieldType<sphericalTensor>
|| setCellFieldType<sphericalTensor>
(fieldType, mesh_, selectedCells_, fieldValues)
|| setFieldType<symmTensor>
|| setCellFieldType<symmTensor>
(fieldType, mesh_, selectedCells_, fieldValues)
|| setFieldType<tensor>
|| setCellFieldType<tensor>
(fieldType, mesh_, selectedCells_, fieldValues)
)
)
{
WarningIn("setField::iNew::operator()(Istream& is)")
WarningIn("setCellField::iNew::operator()(Istream& is)")
<< "field type " << fieldType << " not currently supported"
<< endl;
}
return autoPtr<setField>(new setField());
return autoPtr<setCellField>(new setCellField());
}
};
};
template<class Type>
bool setFaceFieldType
(
const word& fieldTypeDesc,
const fvMesh& mesh,
const labelList& selectedFaces,
Istream& fieldValueStream
)
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
if (fieldTypeDesc != fieldType::typeName + "Value")
{
return false;
}
word fieldName(fieldValueStream);
IOobject fieldHeader
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ
);
// Check field exists
if (fieldHeader.headerOk())
{
Info<< " Setting patchField values of "
<< fieldHeader.headerClassName()
<< " " << fieldName << endl;
fieldType field(fieldHeader, mesh);
const Type& value = pTraits<Type>(fieldValueStream);
// Create flat list of selected faces and their value.
Field<Type> allBoundaryValues(mesh.nFaces()-mesh.nInternalFaces());
forAll(field.boundaryField(), patchi)
{
SubField<Type>
(
allBoundaryValues,
field.boundaryField()[patchi].size(),
field.boundaryField()[patchi].patch().start()
- mesh.nInternalFaces()
).assign(field.boundaryField()[patchi]);
}
// Override
labelList nChanged(field.boundaryField().size(), 0);
forAll(selectedFaces, i)
{
label facei = selectedFaces[i];
if (mesh.isInternalFace(facei))
{
WarningIn("setFaceFieldType(..)")
<< "Ignoring internal face " << facei << endl;
}
else
{
label bFaceI = facei-mesh.nInternalFaces();
allBoundaryValues[bFaceI] = value;
nChanged[mesh.boundaryMesh().patchID()[bFaceI]]++;
}
}
Pstream::listCombineGather(nChanged, plusEqOp<label>());
Pstream::listCombineScatter(nChanged);
// Reassign.
forAll(field.boundaryField(), patchi)
{
if (nChanged[patchi] > 0)
{
Info<< " On patch "
<< field.boundaryField()[patchi].patch().name()
<< " set " << nChanged[patchi] << " values" << endl;
field.boundaryField()[patchi] == SubField<Type>
(
allBoundaryValues,
field.boundaryField()[patchi].size(),
field.boundaryField()[patchi].patch().start()
- mesh.nInternalFaces()
);
}
}
field.write();
}
else
{
WarningIn
(
"void setFaceFieldType"
"(const fvMesh& mesh, const labelList& selectedFaces,"
"Istream& fieldValueStream)"
) << "Field " << fieldName << " not found" << endl;
}
return true;
}
class setFaceField
{
public:
setFaceField()
{}
autoPtr<setFaceField> clone() const
{
return autoPtr<setFaceField>(new setFaceField());
}
class iNew
{
const fvMesh& mesh_;
const labelList& selectedFaces_;
public:
iNew(const fvMesh& mesh, const labelList& selectedFaces)
:
mesh_(mesh),
selectedFaces_(selectedFaces)
{}
autoPtr<setFaceField> operator()(Istream& fieldValues) const
{
word fieldType(fieldValues);
if
(
!(
setFaceFieldType<scalar>
(fieldType, mesh_, selectedFaces_, fieldValues)
|| setFaceFieldType<vector>
(fieldType, mesh_, selectedFaces_, fieldValues)
|| setFaceFieldType<sphericalTensor>
(fieldType, mesh_, selectedFaces_, fieldValues)
|| setFaceFieldType<symmTensor>
(fieldType, mesh_, selectedFaces_, fieldValues)
|| setFaceFieldType<tensor>
(fieldType, mesh_, selectedFaces_, fieldValues)
)
)
{
WarningIn("setFaceField::iNew::operator()(Istream& is)")
<< "field type " << fieldType << " not currently supported"
<< endl;
}
return autoPtr<setFaceField>(new setFaceField());
}
};
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
@ -194,10 +359,10 @@ int main(int argc, char *argv[])
if (setFieldsDict.found("defaultFieldValues"))
{
Info<< "Setting field default values" << endl;
PtrList<setField> defaultFieldValues
PtrList<setCellField> defaultFieldValues
(
setFieldsDict.lookup("defaultFieldValues"),
setField::iNew(mesh, labelList(mesh.nCells()))
setCellField::iNew(mesh, labelList(mesh.nCells()))
);
Info<< endl;
}
@ -211,29 +376,54 @@ int main(int argc, char *argv[])
{
const entry& region = regions[regionI];
autoPtr<topoSetSource> cellSelector =
autoPtr<topoSetSource> source =
topoSetSource::New(region.keyword(), mesh, region.dict());
cellSet selectedCellSet
(
mesh,
"cellSet",
mesh.nCells()/10+1 // Reasonable size estimate.
);
if (source().setType() == topoSetSource::CELLSETSOURCE)
{
cellSet selectedCellSet
(
mesh,
"cellSet",
mesh.nCells()/10+1 // Reasonable size estimate.
);
cellSelector->applyToSet
(
topoSetSource::NEW,
selectedCellSet
);
source->applyToSet
(
topoSetSource::NEW,
selectedCellSet
);
PtrList<setField> fieldValues
(
region.dict().lookup("fieldValues"),
setField::iNew(mesh, selectedCellSet.toc())
);
PtrList<setCellField> fieldValues
(
region.dict().lookup("fieldValues"),
setCellField::iNew(mesh, selectedCellSet.toc())
);
}
else if (source().setType() == topoSetSource::FACESETSOURCE)
{
faceSet selectedFaceSet
(
mesh,
"faceSet",
(mesh.nFaces()-mesh.nInternalFaces())/10+1
);
source->applyToSet
(
topoSetSource::NEW,
selectedFaceSet
);
PtrList<setFaceField> fieldValues
(
region.dict().lookup("fieldValues"),
setFaceField::iNew(mesh, selectedFaceSet.toc())
);
}
}
Info<< "\nEnd\n" << endl;
return 0;

View File

@ -23,6 +23,8 @@ defaultFieldValues
regions
(
// Set cell values
// (does zerogradient on boundaries)
boxToCell
{
box (0 0 -1) (0.1461 0.292 1);
@ -32,6 +34,17 @@ regions
volScalarFieldValue gamma 1
);
}
// Set patch values (using ==)
boxToFace
{
box (0 0 -1) (0.1461 0.292 1);
fieldValues
(
volScalarFieldValue gamma 1
);
}
);
// ************************************************************************* //

View File

@ -48,11 +48,13 @@ int main(int argc, char *argv[])
OFstream reactionsFile(args[3]);
reactionsFile
<< "species" << cr.species() << token::END_STATEMENT << nl << nl
<< "reactions" << cr.reactions() << token::END_STATEMENT << endl;
<< "species" << cr.species() << token::END_STATEMENT << nl << nl;
cr.reactions().write(reactionsFile);
OFstream thermoFile(args[4]);
thermoFile<< cr.speciesThermo() << endl;
cr.speciesThermo().write(thermoFile);
Info<< "End\n" << endl;

View File

@ -56,7 +56,7 @@ cleanTimeDirectories()
zeros=`printf %0${nZeros}d 0`
nZeros=$(($nZeros + 1))
done
rm -rf ./{[1-9]*,-[1-9]*,log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.OpenFOAM} > /dev/null 2>&1
rm -rf ./[1-9]* ./-[1-9]* ./log ./log.* ./log-* ./logSummary.* ./.fxLock ./*.xml ./ParaView* ./paraFoam* ./*.OpenFOAM > /dev/null 2>&1
}
cleanCase()
@ -65,16 +65,20 @@ cleanCase()
rm -rf processor* > /dev/null 2>&1
rm -rf probes* > /dev/null 2>&1
rm -rf forces* > /dev/null 2>&1
rm -rf system/machines \
constant/polyMesh/{allOwner*,cell*,face*,meshModifiers*} \
constant/polyMesh/{owner*,neighbour*,point*,edge*} \
constant/polyMesh/{cellLevel*,pointLevel*,refinementHistory*,surfaceIndex*} \
constant/{cellToRegion,cellLevel*,pointLevel*} \
constant/polyMesh/sets/ \
VTK \
sets/streamLines \
> /dev/null 2>&1
rm -rf system/machines > /dev/null 2>&1
(cd constant/polyMesh && \
rm -rf \
allOwner* cell* face* meshModifiers* \
owner* neighbour* point* edge* \
cellLevel* pointLevel* refinementHistory* surfaceIndex* sets \
> /dev/null 2>&1 \
)
(cd constant && \
rm -rf \
cellToRegion cellLevel* pointLevel* \
> /dev/null 2>&1 \
)
rm -rf VTK > /dev/null 2>&1
if [ -e constant/polyMesh/blockMeshDict.m4 ]
then
@ -96,12 +100,12 @@ removeCase()
cleanSamples()
{
rm -rf {sets,samples,sampleSurfaces} > /dev/null 2>&1
rm -rf ./sets ./samples ./sampleSurfaces > /dev/null 2>&1
}
cleanUcomponents()
{
rm -rf 0/{Ux,Uy,Uz} > /dev/null 2>&1
rm -rf 0/Ux 0/Uy 0/Uz > /dev/null 2>&1
}
cleanApplication()

66
bin/tools/foamConfigurePaths Executable file → Normal file
View File

@ -34,10 +34,10 @@ usage() {
cat<<USAGE
usage: ${0##*/}
--foamInstall dir specify installation directory (e.g. /opt)
--projectName name specify project name (e.g. openfoam170)
--archOption arch specify architecture option (only 32 or 64 applicable)
--paraviewInstall dir specify ParaView_DIR (e.g. /opt/paraviewopenfoam380)
--foamInstall dir specify installation directory (e.g. /opt)
--projectName name specify project name (e.g. openfoam170)
--archOption arch specify architecture option (only 32 or 64 applicable)
--paraviewInstall dir specify ParaView_DIR (e.g. /opt/paraviewopenfoam380)
* hardcode paths to installation
@ -46,6 +46,17 @@ USAGE
}
# Function to do replacement on file. Checks if any replacement has been done.
# inlineSed <file> <sedCommand> <description>
_inlineSed()
{
backup=`tempfile`
cp $1 $backup
sed -i -e "$2" $1
cmp $1 $backup || usage "Failed : $3"
}
[ -f etc/bashrc -a -f etc/settings.sh ] || usage "Please run from top-level directory of installation"
unset foamInstall projectName archOption paraviewInstall
@ -59,30 +70,40 @@ do
;;
--foamInstall)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
foamInstall="$2"
echo "Replacing foamInstall setting by $foamInstall"
sed -i -e '/^[^#]/s@foamInstall=.*@foamInstall='"$foamInstall@" etc/bashrc
foamInstall="$2"
echo "** foamInstall:$foamInstall"
_inlineSed \
etc/bashrc \
'/^[^#]/s@foamInstall=.*@foamInstall='"$foamInstall@" \
"Replacing foamInstall setting by $foamInstall"
shift 2
;;
--projectName)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
projectName="$2"
echo "Replacing WM_PROJECT_DIR setting by $projectName"
sed -i -e '/^[^#]/s@WM_PROJECT_DIR=.*@WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/'"$projectName@" etc/bashrc
projectName="$2"
_inlineSed \
etc/bashrc \
'/^[^#]/s@WM_PROJECT_DIR=.*@WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/'"$projectName@" \
"Replacing WM_PROJECT_DIR setting by $projectName"
shift 2
;;
--archOption)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
archOption="$2"
echo "Replacing WM_ARCH_OPTION setting by $archOption"
sed -i -e '/^[^#]/s@: ${WM_ARCH_OPTION:=64}@WM_ARCH_OPTION='"$archOption@" etc/bashrc
archOption="$2"
_inlineSed \
etc/bashrc \
'/^[^#]/s@: ${WM_ARCH_OPTION:=64}@WM_ARCH_OPTION='"$archOption@" \
"Replacing WM_ARCH_OPTION setting by $archOption"
shift 2
;;
--paraviewInstall)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
paraviewInstall="$2"
echo "Replacing ParaView_DIR setting by $paraviewInstall"
sed -i -e '/^[^#]/s@ParaView_DIR=.*@ParaView_DIR='"$paraviewInstall@" etc/apps/paraview3/bashrc
paraviewInstall="$2"
_inlineSed \
etc/apps/paraview3/bashrc \
'/^[^#]/s@ParaView_DIR=.*@ParaView_DIR='"$paraviewInstall@" \
"Replacing ParaView_DIR setting by $paraviewInstall"
shift 2
;;
*)
@ -97,11 +118,14 @@ done
#sed -i -e 's@WM_PROJECT=.*@WM_PROJECT='"$projectName@" etc/bashrc
# Replace the WM_MPLIB always
echo "Replacing WM_MPLIB setting by SYSTEMOPENMPI"
sed -i -e '/^[^#]/s@: ${WM_MPLIB:=.*}@WM_MPLIB=SYSTEMOPENMPI@' etc/bashrc
_inlineSed \
etc/bashrc \
'/^[^#]/s@: ${WM_MPLIB:=.*}@WM_MPLIB=SYSTEMOPENMPI@' \
"Replacing WM_MPLIB setting by SYSTEMOPENMPI"
# Replace the compilerInstall always
echo "Replacing compilerInstall setting by system"
sed -i -e '/^[^#]/s@: ${compilerInstall:=.*}@compilerInstall=system@' etc/settings.sh
_inlineSed \
etc/settings.sh \
'/^[^#]/s@: ${compilerInstall:=.*}@compilerInstall=system@' \
"Replacing compilerInstall setting by system"
#------------------------------------------------------------------------------

View File

@ -574,12 +574,14 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
# INPUT = $(WM_PROJECT_DIR)/src \
#INPUT = $(WM_PROJECT_DIR)/src \
# $(WM_PROJECT_DIR)/applications/utilities \
# $(WM_PROJECT_DIR)/applications/solvers
# limit input for testing purposes
INPUT = $(WM_PROJECT_DIR)/src/OpenFOAM/global
INPUT = $(WM_PROJECT_DIR)/src/OpenFOAM/global \
$(WM_PROJECT_DIR)/src/OpenFOAM/containers \
$(WM_PROJECT_DIR)/src/OpenFOAM/primitives
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is

View File

@ -108,6 +108,12 @@ case OpenFOAM:
set gmp_version=gmp-4.2.4
set mpfr_version=mpfr-2.4.1
breaksw
case Clang:
# using clang - not gcc
setenv WM_CC 'clang'
setenv WM_CXX 'clang++'
set clang_version=llvm-2.8
breaksw
default:
echo
echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:"
@ -159,6 +165,25 @@ case OpenFOAM:
endif
unset gcc_version gccDir
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
if ( $?clang_version ) then
set clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version
# Check that the compiler directory can be found
if ( ! -d "$clangDir" ) then
echo
echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:"
echo " Cannot find $clangDir installation."
echo " Please install this compiler version or if you wish to use the system compiler,"
echo " change the 'compilerInstall' setting to 'system' in this file"
echo
endif
_foamAddMan $clangDir/man
_foamAddPath $clangDir/bin
endif
unset clang_version clangDir
breaksw
endsw

View File

@ -131,6 +131,12 @@ OpenFOAM)
gmp_version=gmp-4.2.4
mpfr_version=mpfr-2.4.1
;;
Clang)
# using clang - not gcc
export WM_CC='clang'
export WM_CXX='clang++'
clang_version=llvm-2.8
;;
*)
echo
echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
@ -183,6 +189,25 @@ OpenFOAM)
fi
unset gcc_version gccDir
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
if [ -n "$clang_version" ]
then
clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version
# Check that the compiler directory can be found
[ -d "$clangDir" ] || {
echo
echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
echo " Cannot find $clangDir installation."
echo " Please install this compiler version or if you wish to use the system compiler,"
echo " change the 'compilerInstall' setting to 'system' in this file"
echo
}
_foamAddMan $clangDir/share/man
_foamAddPath $clangDir/bin
fi
unset clang_version clangDir
;;
esac

View File

@ -39,7 +39,7 @@ Class
#else
# include <sys/inotify.h>
# include <sys/ioctl.h>
# include <errno.h>
# define EVENT_SIZE ( sizeof (struct inotify_event) )
# define EVENT_LEN (EVENT_SIZE + 16)
# define EVENT_BUF_LEN ( 1024 * EVENT_LEN )
@ -49,19 +49,19 @@ Class
defineTypeNameAndDebug(Foam::fileMonitor, 0);
template<>
const char* Foam::NamedEnum<Foam::fileMonitor::fileState, 3>::names[] =
{
"unmodified",
"modified",
"deleted"
};
const Foam::NamedEnum<Foam::fileMonitor::fileState, 3>
Foam::fileMonitor::fileStateNames_;
namespace Foam
{
template<>
const char* Foam::NamedEnum<Foam::fileMonitor::fileState, 3>::names[] =
{
"unmodified",
"modified",
"deleted"
};
//- Reduction operator for PackedList of fileState
class reduceFileStates
{
@ -144,7 +144,7 @@ namespace Foam
#else
//- File descriptor for the inotify instance
int fd;
int inotifyFd_;
//- Current watchIDs and corresponding directory id
DynamicList<label> dirWatches_;
@ -153,23 +153,45 @@ namespace Foam
//- initialise inotify
inline fileMonitorWatcher(const label sz = 20)
:
fd(inotify_init()),
inotifyFd_(inotify_init()),
dirWatches_(sz),
dirFiles_(sz)
{}
{
if (inotifyFd_ < 0)
{
static bool hasWarned = false;
if (!hasWarned)
{
hasWarned = true;
WarningIn("fileMonitorWatcher(const label)")
<< "Failed allocating an inotify descriptor : "
<< string(strerror(errno)) << endl
<< " Please increase the number of allowable "
<< "inotify instances" << endl
<< " (/proc/sys/fs/inotify/max_user_instances"
<< " on Linux)" << endl
<< " or switch off runTimeModifiable." << endl
<< " Continuing without additional file monitoring."
<< endl;
}
}
}
//- remove all watches
inline ~fileMonitorWatcher()
{
forAll(dirWatches_, i)
if (inotifyFd_ >= 0)
{
if (dirWatches_[i] >= 0)
forAll(dirWatches_, i)
{
if (inotify_rm_watch(fd, int(dirWatches_[i])))
if (dirWatches_[i] >= 0)
{
WarningIn("fileMonitor::~fileMonitor()")
<< "Failed deleting directory watch "
<< dirWatches_[i] << endl;
if (inotify_rm_watch(inotifyFd_, int(dirWatches_[i])))
{
WarningIn("fileMonitor::~fileMonitor()")
<< "Failed deleting directory watch "
<< dirWatches_[i] << endl;
}
}
}
}
@ -177,10 +199,15 @@ namespace Foam
inline bool addWatch(const label watchFd, const fileName& fName)
{
if (inotifyFd_ < 0)
{
return false;
}
// Add/retrieve watch on directory containing file
label dirWatchID = inotify_add_watch
(
fd,
inotifyFd_,
fName.path().c_str(),
IN_CLOSE_WRITE
);
@ -189,7 +216,8 @@ namespace Foam
{
FatalErrorIn("addWatch(const label, const fileName&)")
<< "Failed adding watch " << watchFd
<< " to directory " << fName
<< " to directory " << fName << " due to "
<< string(strerror(errno))
<< exit(FatalError);
}
@ -209,6 +237,11 @@ namespace Foam
inline bool removeWatch(const label watchFd)
{
if (inotifyFd_ < 0)
{
return false;
}
dirWatches_[watchFd] = -1;
return true;
}
@ -263,11 +296,11 @@ void Foam::fileMonitor::checkFiles() const
fd_set fdSet;
// Add notify descriptor to select fd_set
FD_ZERO(&fdSet);
FD_SET(watcher_->fd, &fdSet);
FD_SET(watcher_->inotifyFd_, &fdSet);
int ready = select
(
watcher_->fd+1, // num filedescriptors in fdSet
watcher_->inotifyFd_+1, // num filedescriptors in fdSet
&fdSet, // fdSet with only inotifyFd
NULL, // No writefds
NULL, // No errorfds
@ -280,15 +313,15 @@ void Foam::fileMonitor::checkFiles() const
<< "Problem in issuing select."
<< abort(FatalError);
}
else if (FD_ISSET(watcher_->fd, &fdSet))
else if (FD_ISSET(watcher_->inotifyFd_, &fdSet))
{
// Read events
ssize_t nBytes = read(watcher_->fd, buffer, EVENT_BUF_LEN);
ssize_t nBytes = read(watcher_->inotifyFd_, buffer, EVENT_BUF_LEN);
if (nBytes < 0)
{
FatalErrorIn("fileMonitor::updateStates(const fileName&)")
<< "read of " << watcher_->fd
<< "read of " << watcher_->inotifyFd_
<< " failed with " << label(nBytes)
<< abort(FatalError);
}
@ -364,6 +397,7 @@ Foam::label Foam::fileMonitor::addWatch(const fileName& fName)
label watchFd;
label sz = freeWatchFds_.size();
if (sz)
{
watchFd = freeWatchFds_[sz-1];

View File

@ -346,6 +346,7 @@ $(basicPolyPatches)/generic/genericPolyPatch.C
constraintPolyPatches = $(polyPatches)/constraint
$(constraintPolyPatches)/cyclic/cyclicPolyPatch.C
$(constraintPolyPatches)/cyclicSlip/cyclicSlipPolyPatch.C
$(constraintPolyPatches)/oldCyclic/oldCyclicPolyPatch.C
$(constraintPolyPatches)/empty/emptyPolyPatch.C
$(constraintPolyPatches)/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.C
$(constraintPolyPatches)/processorCyclic/processorCyclicPolyPatch.C

View File

@ -72,6 +72,11 @@ class HashPtrTable
template<class INew>
void read(Istream&, const INew& inewt);
//- Read from dictionary using given dictionary constructor class
template<class INew>
void read(const dictionary& dict, const INew& inewt);
public:
@ -91,6 +96,10 @@ public:
//- Construct from Istream using default Istream constructor class
HashPtrTable(Istream&);
//- Construct from dictionary using default dictionary constructor
// class
HashPtrTable(const dictionary& dict);
//- Construct as copy
HashPtrTable(const HashPtrTable<T, Key, Hash>&);
@ -112,6 +121,9 @@ public:
//- Clear all entries from table
void clear();
//- Write
void write(Ostream& os) const;
// Member Operators

View File

@ -27,6 +27,7 @@ License
#include "Istream.H"
#include "Ostream.H"
#include "INew.H"
#include "dictionary.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
@ -137,6 +138,39 @@ void Foam::HashPtrTable<T, Key, Hash>::read(Istream& is, const INew& inewt)
}
template<class T, class Key, class Hash>
template<class INew>
void Foam::HashPtrTable<T, Key, Hash>::read
(
const dictionary& dict,
const INew& inewt
)
{
forAllConstIter(dictionary, dict, iter)
{
insert(iter().keyword(), inewt(dict.subDict(iter().keyword())).ptr());
}
}
template<class T, class Key, class Hash>
void Foam::HashPtrTable<T, Key, Hash>::write(Ostream& os) const
{
for
(
typename HashPtrTable<T, Key, Hash>::const_iterator
iter = this->begin();
iter != this->end();
++iter
)
{
const T* ptr = iter();
ptr->write(os);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class T, class Key, class Hash>
@ -154,6 +188,13 @@ Foam::HashPtrTable<T, Key, Hash>::HashPtrTable(Istream& is)
}
template<class T, class Key, class Hash>
Foam::HashPtrTable<T, Key, Hash>::HashPtrTable(const dictionary& dict)
{
read(dict, INew<T>());
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class T, class Key, class Hash>

View File

@ -51,6 +51,12 @@ SeeAlso
namespace Foam
{
// Forward declaration
class PackedBoolList;
//- @typedef A List of PackedBoolList
typedef List<PackedBoolList> PackedBoolListList;
/*---------------------------------------------------------------------------*\
Class PackedBoolList Declaration
\*---------------------------------------------------------------------------*/

View File

@ -59,6 +59,7 @@ template<class T> class SubList;
template<class T> class UList;
template<class T> Ostream& operator<<(Ostream&, const UList<T>&);
typedef UList<label> labelUList;
/*---------------------------------------------------------------------------*\
Class UList Declaration

View File

@ -25,7 +25,7 @@ Class
Foam::INew
Description
A helper class when constructing from an Istream
A helper class when constructing from an Istream or dictionary
\*---------------------------------------------------------------------------*/
@ -52,18 +52,33 @@ class INew
public:
//- Construct null
INew()
{}
//- Construct from Istream
autoPtr<T> operator()(Istream& is) const
{
return T::New(is);
}
//- Construct from word and Istream
autoPtr<T> operator()(const word&, Istream& is) const
{
return T::New(is);
}
//- Construct from dictionary
autoPtr<T> operator()(const dictionary& dict) const
{
return T::New(dict);
}
//- Construct from word and dictionary
autoPtr<T> operator()(const word&, const dictionary& dict) const
{
return T::New(dict);
}
};

View File

@ -32,13 +32,17 @@ License
defineTypeNameAndDebug(Foam::UPstream, 0);
template<>
const char* Foam::NamedEnum<Foam::UPstream::commsTypes, 3>::names[] =
namespace Foam
{
"blocking",
"scheduled",
"nonBlocking"
};
template<>
const char* Foam::NamedEnum<Foam::UPstream::commsTypes, 3>::names[] =
{
"blocking",
"scheduled",
"nonBlocking"
};
}
const Foam::NamedEnum<Foam::UPstream::commsTypes, 3>
Foam::UPstream::commsTypeNames;

View File

@ -32,28 +32,31 @@ License
defineTypeNameAndDebug(Foam::Time, 0);
template<>
const char* Foam::NamedEnum<Foam::Time::stopAtControls, 4>::names[] =
namespace Foam
{
"endTime",
"noWriteNow",
"writeNow",
"nextWrite"
};
template<>
const char* Foam::NamedEnum<Foam::Time::stopAtControls, 4>::names[] =
{
"endTime",
"noWriteNow",
"writeNow",
"nextWrite"
};
template<>
const char* Foam::NamedEnum<Foam::Time::writeControls, 5>::names[] =
{
"timeStep",
"runTime",
"adjustableRunTime",
"clockTime",
"cpuTime"
};
}
const Foam::NamedEnum<Foam::Time::stopAtControls, 4>
Foam::Time::stopAtControlNames_;
template<>
const char* Foam::NamedEnum<Foam::Time::writeControls, 5>::names[] =
{
"timeStep",
"runTime",
"adjustableRunTime",
"clockTime",
"cpuTime"
};
const Foam::NamedEnum<Foam::Time::writeControls, 5>
Foam::Time::writeControlNames_;
@ -242,13 +245,14 @@ Foam::Time::Time
readLibs_(controlDict_, "libs"),
functionObjects_(*this)
{
setControls();
// Time objects not registered so do like objectRegistry::checkIn ourselves.
if (runTimeModifiable_)
{
monitorPtr_.reset(new fileMonitor());
controlDict_.watchIndex() = addWatch(controlDict_.filePath());
}
setControls();
}
@ -304,14 +308,20 @@ Foam::Time::Time
readLibs_(controlDict_, "libs"),
functionObjects_(*this)
{
setControls();
// Time objects not registered so do like objectRegistry::checkIn ourselves.
if (runTimeModifiable_)
{
controlDict_.watchIndex() = addWatch(controlDict_.filePath());
}
monitorPtr_.reset(new fileMonitor());
setControls();
// File might not exist yet.
fileName f(controlDict_.filePath());
if (f != fileName::null)
{
controlDict_.watchIndex() = addWatch(f);
}
}
}
@ -385,18 +395,18 @@ Foam::Time::~Time()
Foam::label Foam::Time::addWatch(const fileName& fName) const
{
return monitor_.addWatch(fName);
return monitorPtr_().addWatch(fName);
}
bool Foam::Time::removeWatch(const label watchIndex) const
{
return monitor_.removeWatch(watchIndex);
return monitorPtr_().removeWatch(watchIndex);
}
const Foam::fileName& Foam::Time::getFile(const label watchIndex) const
{
return monitor_.getFile(watchIndex);
return monitorPtr_().getFile(watchIndex);
}
@ -405,13 +415,13 @@ Foam::fileMonitor::fileState Foam::Time::getState
const label watchFd
) const
{
return monitor_.getState(watchFd);
return monitorPtr_().getState(watchFd);
}
void Foam::Time::setUnmodified(const label watchFd) const
{
monitor_.setUnmodified(watchFd);
monitorPtr_().setUnmodified(watchFd);
}

View File

@ -73,7 +73,7 @@ class Time
// Private data
//- file-change monitor for all registered files
mutable fileMonitor monitor_;
mutable autoPtr<fileMonitor> monitorPtr_;
//- The controlDict
IOdictionary controlDict_;

View File

@ -211,10 +211,7 @@ void Foam::Time::readModifiedObjects()
// valid filePath).
// Note: requires same ordering in objectRegistries on different
// processors!
monitor_.updateStates(Pstream::parRun());
//Pout<< "Time : runTimeModifiable_ and watchIndex:"
// << controlDict_.watchIndex() << endl;
monitorPtr_().updateStates(Pstream::parRun());
// Time handling is special since controlDict_ is the one dictionary
// that is not registered to any database.

View File

@ -111,6 +111,23 @@ public:
{
return name_;
}
//- Return the local dictionary name (final part of scoped name)
const word dictName() const
{
const word scopedName = name_.name();
string::size_type i = scopedName.rfind(':');
if (i == scopedName.npos)
{
return scopedName;
}
else
{
return scopedName.substr(i + 1, scopedName.npos);
}
}
};

View File

@ -106,13 +106,19 @@ public:
// Member functions
//- Return the dictionary name
//- Return the local dictionary name (final part of scoped name)
const word dictName() const
{
return dictionary::dictName();
}
//- Return the dictionary name (scoped, e.g. dictA::dictB::dictC)
const fileName& name() const
{
return dictionary::name();
}
//- Return the dictionary name
//- Return the dictionary name (scoped, e.g. dictA::dictB::dictC)
fileName& name()
{
return dictionary::name();

View File

@ -27,16 +27,19 @@ License
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
template<>
const char* Foam::NamedEnum
<
Foam::outputFilterOutputControl::outputControls,
2
>::names[] =
namespace Foam
{
"timeStep",
"outputTime"
};
template<>
const char* Foam::NamedEnum
<
Foam::outputFilterOutputControl::outputControls,
2
>::names[] =
{
"timeStep",
"outputTime"
};
}
const Foam::NamedEnum<Foam::outputFilterOutputControl::outputControls, 2>
Foam::outputFilterOutputControl::outputControlNames_;

View File

@ -42,7 +42,7 @@ namespace Foam
// Forward declaration of friend functions and operators
class lduScheduleEntry;
struct lduScheduleEntry;
Ostream& operator<<(Ostream& os, const lduScheduleEntry& lb);

View File

@ -44,16 +44,20 @@ namespace Foam
addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, word);
addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, dictionary);
}
template<>
const char* Foam::NamedEnum<Foam::cyclicPolyPatch::transformType, 4>::names[] =
{
"unknown",
"rotational",
"translational",
"noOrdering"
};
template<>
const char* Foam::NamedEnum
<
Foam::cyclicPolyPatch::transformType,
4
>::names[] =
{
"unknown",
"rotational",
"translational",
"noOrdering"
};
}
const Foam::NamedEnum<Foam::cyclicPolyPatch::transformType, 4>
Foam::cyclicPolyPatch::transformTypeNames;
@ -91,44 +95,58 @@ void Foam::cyclicPolyPatch::calcTransforms()
// Half0
const cyclicPolyPatch& half0 = *this;
const pointField& half0Ctrs = half0.faceCentres();
if (debug)
{
fileName casePath(boundaryMesh().mesh().time().path());
fileName nm0(casePath/name()+"_faces.obj");
Pout<< "cyclicPolyPatch::calcTransforms : Writing " << name()
<< " faces to OBJ file " << nm0 << endl;
writeOBJ(nm0, half0, half0.points());
}
vectorField half0Areas(half0.size());
forAll(half0, facei)
{
half0Areas[facei] = half0[facei].normal(half0.points());
}
// Half1
const cyclicPolyPatch& half1 = neighbPatch();
const pointField& half1Ctrs = half1.faceCentres();
// Dump halves
if (debug)
vectorField half1Areas(half1.size());
forAll(half1, facei)
{
fileName casePath(boundaryMesh().mesh().time().path());
half1Areas[facei] = half1[facei].normal(half1.points());
}
calcTransforms
(
half0,
half0.faceCentres(),
half0Areas,
half1.faceCentres(),
half1Areas
);
}
}
void Foam::cyclicPolyPatch::calcTransforms
(
const primitivePatch& half0,
const UList<point>& half0Ctrs,
const UList<point>& half0Areas,
const UList<point>& half1Ctrs,
const UList<point>& half1Areas
)
{
if (debug && owner())
{
fileName casePath(boundaryMesh().mesh().time().path());
{
fileName nm0(casePath/name()+"_faces.obj");
Pout<< "cyclicPolyPatch::calcTransforms : Writing " << name()
<< " faces to OBJ file " << nm0 << endl;
writeOBJ(nm0, half0, half0.points());
}
const cyclicPolyPatch& half1 = neighbPatch();
{
fileName nm1(casePath/half1.name()+"_faces.obj");
Pout<< "cyclicPolyPatch::calcTransforms : Writing " << half1.name()
<< " faces to OBJ file " << nm1 << endl;
writeOBJ(nm1, half1, half1.points());
}
{
OFstream str(casePath/name()+"_to_" + half1.name() + ".obj");
label vertI = 0;
Pout<< "cyclicPolyPatch::calcTransforms :"
@ -145,35 +163,10 @@ void Foam::cyclicPolyPatch::calcTransforms()
str << "l " << vertI-1 << ' ' << vertI << nl;
}
}
vectorField half1Areas(half1.size());
forAll(half1, facei)
{
half1Areas[facei] = half1[facei].normal(half1.points());
}
calcTransforms
(
half0,
half0Ctrs,
half0Areas,
half1Ctrs,
half1Areas
);
}
}
void Foam::cyclicPolyPatch::calcTransforms
(
const primitivePatch& half0,
const UList<point>& half0Ctrs,
const UList<point>& half0Areas,
const UList<point>& half1Ctrs,
const UList<point>& half1Areas
)
{
if (half0Ctrs.size() != half1Ctrs.size())
{
FatalErrorIn

View File

@ -0,0 +1,318 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::oldCyclicPolyPatch
Description
'old' style cyclic polyPatch with all faces in single patch. Does ordering
but cannot be used to run. Writes 'type cyclic' so foamUpgradeCyclics
can be run afterwards.
Used to get cyclics from mesh converters that assume cyclics in single
patch (e.g. fluent3DMeshToFoam)
SourceFiles
oldCyclicPolyPatch.C
\*---------------------------------------------------------------------------*/
#ifndef oldCyclicPolyPatch_H
#define oldCyclicPolyPatch_H
#include "coupledPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class oldCyclicPolyPatch Declaration
\*---------------------------------------------------------------------------*/
class oldCyclicPolyPatch
:
public coupledPolyPatch
{
public:
enum transformType
{
UNKNOWN,
ROTATIONAL,
TRANSLATIONAL
};
static const NamedEnum<transformType, 3> transformTypeNames;
private:
// Private data
//- Morph:angle between normals of neighbouring faces.
// Used to split cyclic into halves.
scalar featureCos_;
//- Type of transformation - rotational or translational
transformType transform_;
// For rotation
//- Axis of rotation for rotational cyclics
vector rotationAxis_;
//- point on axis of rotation for rotational cyclics
point rotationCentre_;
// For translation
//- Translation vector
vector separationVector_;
// Private member functions
//- Find amongst selected faces the one with the largest area
static label findMaxArea(const pointField&, const faceList&);
void calcTransforms();
//- Calculate face centres
static pointField calcFaceCentres
(
const UList<face>&,
const pointField&
);
//- Get f[0] for all faces
static pointField getAnchorPoints
(
const UList<face>&,
const pointField&
);
// Face ordering
//- Find the two parts of the faces of pp using feature edges.
// Returns true if successfull.
bool getGeometricHalves
(
const primitivePatch&,
labelList&,
labelList&
) const;
//- Calculate geometric factors of the two halves.
void getCentresAndAnchors
(
const primitivePatch&,
const faceList& half0Faces,
const faceList& half1Faces,
pointField& ppPoints,
pointField& half0Ctrs,
pointField& half1Ctrs,
pointField& anchors0,
scalarField& tols
) const;
//- Given matched faces matches the anchor point. Sets faceMap,
// rotation. Returns true if all matched.
bool matchAnchors
(
const bool report,
const primitivePatch&,
const labelList&,
const pointField&,
const labelList&,
const faceList&,
const labelList&,
const scalarField&,
labelList& faceMap,
labelList& rotation
) const;
//- For rotational cases, try to find a unique face on each side
// of the cyclic.
label getConsistentRotationFace
(
const pointField& faceCentres
) const;
protected:
// Protected Member functions
//- Initialise the calculation of the patch geometry
virtual void initGeometry(PstreamBuffers&);
//- Calculate the patch geometry
virtual void calcGeometry(PstreamBuffers&);
//- Initialise the patches for moving points
virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points
virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology
virtual void initUpdateMesh(PstreamBuffers&);
//- Update of the patch topology
virtual void updateMesh(PstreamBuffers&);
public:
//- Runtime type information
TypeName("oldCyclic");
// Constructors
//- Construct from components
oldCyclicPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm
);
//- Construct from dictionary
oldCyclicPolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm
);
//- Construct as copy, resetting the boundary mesh
oldCyclicPolyPatch(const oldCyclicPolyPatch&, const polyBoundaryMesh&);
//- Construct given the original patch and resetting the
// face list and boundary mesh information
oldCyclicPolyPatch
(
const oldCyclicPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
return autoPtr<polyPatch>(new oldCyclicPolyPatch(*this, bm));
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new oldCyclicPolyPatch(*this, bm, index, newSize, newStart)
);
}
// Destructor
virtual ~oldCyclicPolyPatch();
// Member Functions
// Access
//- Does this side own the patch ?
virtual bool owner() const
{
notImplemented("oldCyclicPolyPatch::owner()");
return true;
}
//- Transform a patch-based position from other side to this side
virtual void transformPosition(pointField& l) const
{
notImplemented("transformPosition(pointField&)");
}
//- Calculate the patch geometry
virtual void calcGeometry
(
const primitivePatch& referPatch,
const UList<point>& thisCtrs,
const UList<point>& thisAreas,
const UList<point>& thisCc,
const UList<point>& nbrCtrs,
const UList<point>& nbrAreas,
const UList<point>& nbrCc
);
//- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.)
virtual void initOrder
(
PstreamBuffers&,
const primitivePatch&
) const;
//- Return new ordering for primitivePatch.
// Ordering is -faceMap: for every face
// index of the new face -rotation:for every new face the clockwise
// shift of the original face. Return false if nothing changes
// (faceMap is identity, rotation is 0), true otherwise.
virtual bool order
(
PstreamBuffers&,
const primitivePatch&,
labelList& faceMap,
labelList& rotation
) const;
//- Write the polyPatch data as a dictionary
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -49,7 +49,7 @@ Foam::PatchTools::sortedEdgeFaces
const Field<PointType>& localPoints = p.localPoints();
// create the lists for the various results. (resized on completion)
labelListList& sortedEdgeFaces = labelListList(edgeFaces.size());
labelListList sortedEdgeFaces(edgeFaces.size());
forAll(edgeFaces, edgeI)
{

View File

@ -29,27 +29,29 @@ License
Foam::scalar Foam::intersection::planarTol_ = 0.2;
template<>
const char* Foam::NamedEnum<Foam::intersection::direction, 2>::names[] =
namespace Foam
{
"vector",
"contactSphere"
};
template<>
const char* Foam::NamedEnum<Foam::intersection::direction, 2>::names[] =
{
"vector",
"contactSphere"
};
template<>
const char* Foam::NamedEnum<Foam::intersection::algorithm, 3>::names[] =
{
"fullRay",
"halfRay",
"visible"
};
}
const Foam::NamedEnum<Foam::intersection::direction, 2>
Foam::intersection::directionNames_;
template<>
const char* Foam::NamedEnum<Foam::intersection::algorithm, 3>::names[] =
{
"fullRay",
"halfRay",
"visible"
};
const Foam::NamedEnum<Foam::intersection::algorithm, 3>
Foam::intersection::algorithmNames_;
// ************************************************************************* //

View File

@ -21,6 +21,12 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::boolUList
Description
A UList of bool
Typedef
Foam::boolList
@ -39,6 +45,8 @@ Description
namespace Foam
{
typedef UList<bool> boolUList;
typedef List<bool> boolList;
typedef List<List<bool> > boolListList;
}

View File

@ -21,11 +21,17 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::fileNameUList
Description
A UList of fileNames.
Typedef
Foam::fileNameList
Description
List of fileNames.
A List of fileNames.
\*---------------------------------------------------------------------------*/
@ -39,6 +45,8 @@ Description
namespace Foam
{
typedef UList<fileName> fileNameUList;
typedef List<fileName> fileNameList;
}

View File

@ -25,7 +25,19 @@ Typedef
Foam::labelList
Description
Label container classes
A List of labels
Typedef
Foam::labelListList
Description
A List of labelList
Typedef
Foam::labelListListList
Description
A List of labelListList
\*---------------------------------------------------------------------------*/
@ -39,11 +51,11 @@ Description
namespace Foam
{
// Note: frequently used UList version is located in container itself
typedef List<label> labelList;
typedef List<labelList> labelListList;
typedef List<labelListList> labelListListList;
typedef UList<label> unallocLabelList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -21,11 +21,17 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::scalarUList
Description
A UList of scalars.
Typedef
Foam::scalarList
Description
List of scalars.
A List of scalars.
\*---------------------------------------------------------------------------*/
@ -39,6 +45,8 @@ Description
namespace Foam
{
typedef UList<scalar> scalarUList;
typedef List<scalar> scalarList;
typedef List<scalarList> scalarListList;
}

View File

@ -21,11 +21,17 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::sphericalTensorUList
Description
A UList of sphericalTensors.
Typedef
Foam::sphericalTensorList
Description
List of sphericalTensors.
A List of sphericalTensors.
\*---------------------------------------------------------------------------*/
@ -39,6 +45,8 @@ Description
namespace Foam
{
typedef UList<sphericalTensor> sphericalTensorUList;
typedef List<sphericalTensor> sphericalTensorList;
}

View File

@ -21,11 +21,17 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::stringUList
Description
A UList of strings.
Typedef
Foam::stringList
Description
List of strings.
A List of strings.
\*---------------------------------------------------------------------------*/
@ -39,6 +45,8 @@ Description
namespace Foam
{
typedef UList<string> stringUList;
typedef List<string> stringList;
}

View File

@ -21,11 +21,17 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::symmTensorUList
Description
A UList of symmTensors.
Typedef
Foam::symmTensorList
Description
List of symmTensors.
A List of symmTensors.
\*---------------------------------------------------------------------------*/
@ -39,6 +45,8 @@ Description
namespace Foam
{
typedef UList<symmTensor> symmTensorUList;
typedef List<symmTensor> symmTensorList;
}

View File

@ -21,11 +21,17 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::tensorUList
Description
A UList of tensors.
Typedef
Foam::tensorList
Description
List of tensors.
A List of tensors.
\*---------------------------------------------------------------------------*/
@ -39,6 +45,8 @@ Description
namespace Foam
{
typedef UList<tensor> tensorUList;
typedef List<tensor> tensorList;
}

View File

@ -21,11 +21,17 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::vectorUList
Description
A UList of vectors.
Typedef
Foam::vectorList
Description
List of vectors.
A List of vectors.
\*---------------------------------------------------------------------------*/
@ -39,6 +45,8 @@ Description
namespace Foam
{
typedef UList<vector> vectorUList;
typedef List<vector> vectorList;
}

View File

@ -21,11 +21,17 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::wordUList
Description
A UList of words.
Typedef
Foam::wordList
Description
List of words.
A List of words.
\*---------------------------------------------------------------------------*/
@ -39,6 +45,8 @@ Description
namespace Foam
{
typedef UList<word> wordUList;
typedef List<word> wordList;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -21,11 +21,17 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::wordReUList
Description
A UList of wordRe (word or regular expression)
Typedef
Foam::wordReList
Description
List of wordRe (word or regular expression)
A List of wordRe (word or regular expression)
\*---------------------------------------------------------------------------*/
@ -39,6 +45,8 @@ Description
namespace Foam
{
typedef UList<wordRe> wordReUList;
typedef List<wordRe> wordReList;
}

View File

@ -28,32 +28,35 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char* const Foam::labelTensor::typeName = "labelTensor";
template<>
const char* Foam::labelTensor::componentNames[] =
namespace Foam
{
"xx", "xy", "xz",
"yx", "yy", "yz",
"zx", "zy", "zz"
};
template<>
const char* const Foam::labelTensor::typeName = "labelTensor";
template<>
const Foam::labelTensor Foam::labelTensor::zero
(
0, 0, 0,
0, 0, 0,
0, 0, 0
);
template<>
const char* Foam::labelTensor::componentNames[] =
{
"xx", "xy", "xz",
"yx", "yy", "yz",
"zx", "zy", "zz"
};
template<>
const Foam::labelTensor Foam::labelTensor::one
(
1, 1, 1,
1, 1, 1,
1, 1, 1
);
template<>
const Foam::labelTensor Foam::labelTensor::zero
(
0, 0, 0,
0, 0, 0,
0, 0, 0
);
template<>
const Foam::labelTensor Foam::labelTensor::one
(
1, 1, 1,
1, 1, 1,
1, 1, 1
);
}
// ************************************************************************* //

View File

@ -27,17 +27,19 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char* const Foam::labelVector::typeName = "labelVector";
namespace Foam
{
template<>
const char* const Foam::labelVector::typeName = "labelVector";
template<>
const char* Foam::labelVector::componentNames[] = {"x", "y", "z"};
template<>
const char* Foam::labelVector::componentNames[] = {"x", "y", "z"};
template<>
const Foam::labelVector Foam::labelVector::zero(0, 0, 0);
template<>
const Foam::labelVector Foam::labelVector::one(1, 1, 1);
template<>
const Foam::labelVector Foam::labelVector::zero(0, 0, 0);
template<>
const Foam::labelVector Foam::labelVector::one(1, 1, 1);
}
// ************************************************************************* //

View File

@ -111,6 +111,15 @@ Foam::Polynomial<PolySize>::Polynomial(const word& name, Istream& is)
}
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial(Istream& is)
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(is),
logActive_(false),
logCoeff_(0.0)
{}
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial
(

View File

@ -110,6 +110,9 @@ public:
//- Construct from a list of coefficients
explicit Polynomial(const UList<scalar>& coeffs);
//- Construct from Istream
Polynomial(Istream& is);
//- Construct from name and Istream
Polynomial(const word& name, Istream& is);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -32,22 +32,25 @@ License
#include "meshTools.H"
#include "hexMatcher.H"
#include "Switch.H"
#include "globalMeshData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char* Foam::NamedEnum<Foam::directions::directionType, 3>::names[] =
namespace Foam
{
"tan1",
"tan2",
"normal"
};
template<>
const char* Foam::NamedEnum<Foam::directions::directionType, 3>::names[] =
{
"tan1",
"tan2",
"normal"
};
}
const Foam::NamedEnum<Foam::directions::directionType, 3>
Foam::directions::directionTypeNames_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// For debugging
@ -204,7 +207,7 @@ Foam::vectorField Foam::directions::propagateDirection
mesh,
changedFaces,
changedFacesInfo,
mesh.nCells()
mesh.globalData().nTotalCells()+1
);
const List<directionInfo>& cellInfo = directionCalc.allCellInfo();

View File

@ -2332,7 +2332,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement
seedFacesInfo.clear();
// Iterate until no change. Now 2:1 face difference should be satisfied
levelCalc.iterate(mesh_.globalData().nTotalFaces());
levelCalc.iterate(mesh_.globalData().nTotalFaces()+1);
// Now check point-connected cells (face-connected cells already ok):
@ -2836,7 +2836,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
seedFacesInfo,
allFaceInfo,
allCellInfo,
mesh_.globalData().nTotalCells()
mesh_.globalData().nTotalCells()+1
);

View File

@ -45,17 +45,20 @@ namespace Foam
slidingInterface,
dictionary
);
template<>
const char* Foam::NamedEnum
<
Foam::slidingInterface::typeOfMatch,
2
>::names[] =
{
"integral",
"partial"
};
}
template<>
const char* Foam::NamedEnum<Foam::slidingInterface::typeOfMatch, 2>::names[] =
{
"integral",
"partial"
};
const Foam::NamedEnum<Foam::slidingInterface::typeOfMatch, 2>
Foam::slidingInterface::typeOfMatchNames_;

View File

@ -21,6 +21,12 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Namespace
Foam::porousMedia
Description
Namespace for models related to porous media
Class
Foam::porousZone

View File

@ -171,6 +171,23 @@ tmp<Field<Type> > cyclicFvPatchField<Type>::patchNeighbourField() const
}
template<class Type>
const cyclicFvPatchField<Type>& cyclicFvPatchField<Type>::neighbourPatchField()
const
{
const GeometricField<Type, fvPatchField, volMesh>& fld =
static_cast<const GeometricField<Type, fvPatchField, volMesh>&>
(
this->internalField()
);
return refCast<const cyclicFvPatchField<Type> >
(
fld.boundaryField()[this->cyclicPatch().neighbPatchID()]
);
}
template<class Type>
void cyclicFvPatchField<Type>::updateInterfaceMatrix
(

View File

@ -150,9 +150,12 @@ public:
// Evaluation functions
//- Return neighbour coupled given internal cell data
//- Return neighbour coupled internal cell data
tmp<Field<Type> > patchNeighbourField() const;
//- Return reference to neighbour patchField
const cyclicFvPatchField<Type>& neighbourPatchField() const;
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(

View File

@ -260,7 +260,7 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
allValues
);
newValues = this->patch().patchSlice(allValues);
newValues.transfer(allValues);
break;
}

View File

@ -25,7 +25,13 @@ Class
Foam::directMappedFixedValueFvPatchField
Description
Recycles the value at a set of internal faces back to *this.
Recycles the value at a set of cells or patch faces back to *this. Can not
sample internal faces (since volField not defined on faces).
mode = NEARESTCELL : sample nearest cell
mode = NEARESTPATCHFACE : sample nearest face on selected patch
mode = NEARESTFACE : sample nearest face on any patch. Note: does not
warn if nearest actually is on internal face!
SourceFiles
directMappedFixedValueFvPatchField.C

View File

@ -198,7 +198,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
distMap.constructMap(),
allUValues
);
newUValues = patch().patchSlice(allUValues);
newUValues.transfer(allUValues);
mapDistribute::distribute
(
@ -209,7 +209,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
distMap.constructMap(),
allPhiValues
);
newPhiValues = patch().patchSlice(allPhiValues);
newPhiValues.transfer(allPhiValues);
break;
}

View File

@ -27,6 +27,11 @@ Class
Description
Recycles the velocity and flux at a patch to this patch
mode = NEARESTCELL : sample nearest cell
mode = NEARESTPATCHFACE : sample nearest face on selected patch
mode = NEARESTFACE : sample nearest face on any patch. Note: does not
warn if nearest actually is on internal face!
SourceFiles
directMappedVelocityFluxFixedValueFvPatchField.C

View File

@ -140,7 +140,17 @@ public:
//- Return the "jump" across the patch.
virtual tmp<Field<Type> > jump() const
{
return jump_;
if (this->cyclicPatch().owner())
{
return jump_;
}
else
{
return refCast<const fanFvPatchField<Type> >
(
this->neighbourPatchField()
).jump();
}
}

View File

@ -108,7 +108,7 @@ public:
}
//- Return processor number
virtual const cyclicLduInterface& neighbPatch() const
virtual const cyclicFvPatch& neighbPatch() const
{
return refCast<const cyclicFvPatch>
(

View File

@ -115,7 +115,7 @@ void Foam::inverseFaceDistanceDiffusivity::correct()
mesh,
changedFaces,
faceDist,
mesh.globalData().nTotalCells() // max iterations
mesh.globalData().nTotalCells()+1 // max iterations
);
const List<wallPoint>& faceInfo = waveInfo.allFaceInfo();

View File

@ -27,15 +27,17 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char* Foam::NamedEnum<Foam::phaseProperties::phaseType, 4>::names[] =
namespace Foam
{
"gas",
"liquid",
"solid",
"unknown"
};
template<>
const char* Foam::NamedEnum<Foam::phaseProperties::phaseType, 4>::names[] =
{
"gas",
"liquid",
"solid",
"unknown"
};
}
const Foam::NamedEnum<Foam::phaseProperties::phaseType, 4>
Foam::phaseProperties::phaseTypeNames_;

View File

@ -34,15 +34,19 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char*
Foam::NamedEnum<Foam::refinementSurfaces::areaSelectionAlgo, 4>::names[] =
namespace Foam
{
"inside",
"outside",
"insidePoint",
"none"
};
template<>
const char*
Foam::NamedEnum<Foam::refinementSurfaces::areaSelectionAlgo, 4>::names[] =
{
"inside",
"outside",
"insidePoint",
"none"
};
}
const Foam::NamedEnum<Foam::refinementSurfaces::areaSelectionAlgo, 4>
Foam::refinementSurfaces::areaSelectionAlgoNames;
@ -388,7 +392,7 @@ Foam::labelList Foam::refinementSurfaces::getClosedNamedSurfaces() const
}
// Get indices of named surfaces with a
// Get indices of named surfaces with a
Foam::labelList Foam::refinementSurfaces::getInsidePointNamedSurfaces() const
{
labelList closed(cellZoneNames_.size());
@ -411,9 +415,9 @@ Foam::labelList Foam::refinementSurfaces::getInsidePointNamedSurfaces() const
// Foam::labelList Foam::refinementSurfaces::countRegions(const triSurface& s)
// {
// const geometricSurfacePatchList& regions = s.patches();
//
//
// labelList nTris(regions.size(), 0);
//
//
// forAll(s, triI)
// {
// nTris[s[triI].region()]++;
@ -433,15 +437,15 @@ Foam::labelList Foam::refinementSurfaces::getInsidePointNamedSurfaces() const
// ) const
// {
// const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
//
//
// // Get per element the region
// labelList region;
// geom.getRegion(info, region);
//
//
// // Initialise fields to region wise minLevel
// minLevelField.setSize(ctrs.size());
// minLevelField = -1;
//
//
// forAll(minLevelField, i)
// {
// if (info[i].hit())
@ -449,12 +453,12 @@ Foam::labelList Foam::refinementSurfaces::getInsidePointNamedSurfaces() const
// minLevelField[i] = minLevel(surfI, region[i]);
// }
// }
//
//
// // Find out if triangle inside shell with higher level
// // What level does shell want to refine fc to?
// labelList shellLevel;
// shells.findHigherLevel(ctrs, minLevelField, shellLevel);
//
//
// forAll(minLevelField, i)
// {
// minLevelField[i] = max(minLevelField[i], shellLevel[i]);

View File

@ -322,7 +322,7 @@ void Foam::cellClassification::markCells
changedFaces, // Labels of changed faces
changedFacesInfo, // Information on changed faces
cellInfoList, // Information on all cells
mesh_.globalData().nTotalCells() // max iterations
mesh_.globalData().nTotalCells()+1 // max iterations
);
// Get information out of cellInfoList

View File

@ -225,7 +225,7 @@ void Foam::patchDataWave<TransferType>::correct()
mesh(),
changedFaces,
faceDist,
mesh().globalData().nTotalCells() // max iterations
mesh().globalData().nTotalCells()+1 // max iterations
);

View File

@ -186,7 +186,7 @@ void Foam::patchWave::correct()
mesh(),
changedFaces,
faceDist,
mesh().globalData().nTotalCells() // max iterations
mesh().globalData().nTotalCells()+1 // max iterations
);

View File

@ -66,9 +66,9 @@ public:
//- Mesh items to sample
enum sampleMode
{
NEARESTCELL,
NEARESTPATCHFACE,
NEARESTFACE
NEARESTCELL, // nearest cell
NEARESTPATCHFACE, // faces on selected patch
NEARESTFACE // nearest face
};
private:
@ -201,7 +201,7 @@ public:
return sampleRegion_;
}
//- Patch (only if NEARESTBOUNDARY)
//- Patch (only if NEARESTPATCHFACE)
const word& samplePatch() const
{
return samplePatch_;

View File

@ -102,6 +102,11 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -93,6 +93,11 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -109,6 +109,11 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -33,13 +33,18 @@ License
namespace Foam
{
defineTypeNameAndDebug(faceToCell, 0);
addToRunTimeSelectionTable(topoSetSource, faceToCell, word);
addToRunTimeSelectionTable(topoSetSource, faceToCell, istream);
defineTypeNameAndDebug(faceToCell, 0);
addToRunTimeSelectionTable(topoSetSource, faceToCell, word);
addToRunTimeSelectionTable(topoSetSource, faceToCell, istream);
template<>
const char* Foam::NamedEnum<Foam::faceToCell::faceAction, 4>::names[] =
{
"neighbour",
"owner",
"any",
"all"
};
}
@ -51,15 +56,6 @@ Foam::topoSetSource::addToUsageTable Foam::faceToCell::usage_
" of the faces in the faceSet or where all faces are in the faceSet\n\n"
);
template<>
const char* Foam::NamedEnum<Foam::faceToCell::faceAction, 4>::names[] =
{
"neighbour",
"owner",
"any",
"all"
};
const Foam::NamedEnum<Foam::faceToCell::faceAction, 4>
Foam::faceToCell::faceActionNames_;

View File

@ -119,6 +119,11 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -32,13 +32,16 @@ License
namespace Foam
{
defineTypeNameAndDebug(faceZoneToCell, 0);
addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, word);
addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, istream);
defineTypeNameAndDebug(faceZoneToCell, 0);
addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, word);
addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, istream);
template<>
const char* Foam::NamedEnum<Foam::faceZoneToCell::faceAction, 2>::names[] =
{
"master",
"slave"
};
}
@ -51,14 +54,6 @@ Foam::topoSetSource::addToUsageTable Foam::faceZoneToCell::usage_
);
template<>
const char* Foam::NamedEnum<Foam::faceZoneToCell::faceAction, 2>::names[] =
{
"master",
"slave"
};
const Foam::NamedEnum<Foam::faceZoneToCell::faceAction, 2>
Foam::faceZoneToCell::faceActionNames_;

View File

@ -116,6 +116,11 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -115,6 +115,11 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -100,6 +100,11 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -101,6 +101,11 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -100,6 +100,11 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -33,13 +33,15 @@ License
namespace Foam
{
defineTypeNameAndDebug(pointToCell, 0);
addToRunTimeSelectionTable(topoSetSource, pointToCell, word);
addToRunTimeSelectionTable(topoSetSource, pointToCell, istream);
defineTypeNameAndDebug(pointToCell, 0);
addToRunTimeSelectionTable(topoSetSource, pointToCell, word);
addToRunTimeSelectionTable(topoSetSource, pointToCell, istream);
template<>
const char* Foam::NamedEnum<Foam::pointToCell::pointAction, 1>::names[] =
{
"any"
};
}
@ -50,13 +52,6 @@ Foam::topoSetSource::addToUsageTable Foam::pointToCell::usage_
" Select all cells with any point in the pointSet\n\n"
);
template<>
const char* Foam::NamedEnum<Foam::pointToCell::pointAction, 1>::names[] =
{
"any"
};
const Foam::NamedEnum<Foam::pointToCell::pointAction, 1>
Foam::pointToCell::pointActionNames_;

View File

@ -115,6 +115,11 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -105,6 +105,11 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet(const topoSetSource::setAction action, topoSet&)
const;

View File

@ -111,6 +111,11 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -109,6 +109,11 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -105,6 +105,11 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

View File

@ -195,6 +195,11 @@ public:
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,

Some files were not shown because too many files have changed in this diff Show More