mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
move reconstructPar 'guts' to src/parallel/reconstruct
- in preparation for adding an optional '-reconstruct' to a few utilities
re-use as -lreconstruct library
- move related stuff there too
src/decompositionMethods/decompositionMethods
-> src/parallel/decompositionMethods
- added missing namespace qualifiers
This commit is contained in:
@ -1,7 +1,3 @@
|
||||
processorMeshes.C
|
||||
fvFieldReconstructor.C
|
||||
pointFieldReconstructor.C
|
||||
reconstructLagrangianPositions.C
|
||||
reconstructPar.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/reconstructPar
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/parallel/reconstruct/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lgenericPatchFields \
|
||||
-llagrangian \
|
||||
-lmeshTools
|
||||
-lmeshTools \
|
||||
-lreconstruct
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvFieldReconstructor.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fvFieldReconstructor::fvFieldReconstructor
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const PtrList<fvMesh>& procMeshes,
|
||||
const PtrList<labelIOList>& faceProcAddressing,
|
||||
const PtrList<labelIOList>& cellProcAddressing,
|
||||
const PtrList<labelIOList>& boundaryProcAddressing
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
procMeshes_(procMeshes),
|
||||
faceProcAddressing_(faceProcAddressing),
|
||||
cellProcAddressing_(cellProcAddressing),
|
||||
boundaryProcAddressing_(boundaryProcAddressing)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,186 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::fvFieldReconstructor
|
||||
|
||||
Description
|
||||
FV volume and surface field reconstructor.
|
||||
|
||||
SourceFiles
|
||||
fvFieldReconstructor.C
|
||||
fvFieldReconstructorReconstructFields.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fvFieldReconstructor_H
|
||||
#define fvFieldReconstructor_H
|
||||
|
||||
#include "PtrList.H"
|
||||
#include "fvMesh.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "labelIOList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fvFieldReconstructor Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fvFieldReconstructor
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reconstructed mesh reference
|
||||
fvMesh& mesh_;
|
||||
|
||||
//- List of processor meshes
|
||||
const PtrList<fvMesh>& procMeshes_;
|
||||
|
||||
//- List of processor face addressing lists
|
||||
const PtrList<labelIOList>& faceProcAddressing_;
|
||||
|
||||
//- List of processor cell addressing lists
|
||||
const PtrList<labelIOList>& cellProcAddressing_;
|
||||
|
||||
//- List of processor boundary addressing lists
|
||||
const PtrList<labelIOList>& boundaryProcAddressing_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
fvFieldReconstructor(const fvFieldReconstructor&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const fvFieldReconstructor&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
class fvPatchFieldReconstructor
|
||||
:
|
||||
public fvPatchFieldMapper
|
||||
{
|
||||
label size_;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given size
|
||||
fvPatchFieldReconstructor(const label size)
|
||||
:
|
||||
size_(size)
|
||||
{}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
label size() const
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
|
||||
bool direct() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const unallocLabelList& directAddressing() const
|
||||
{
|
||||
return unallocLabelList::null();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
fvFieldReconstructor
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const PtrList<fvMesh>& procMeshes,
|
||||
const PtrList<labelIOList>& faceProcAddressing,
|
||||
const PtrList<labelIOList>& cellProcAddressing,
|
||||
const PtrList<labelIOList>& boundaryProcAddressing
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Reconstruct volume field
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||
reconstructFvVolumeField
|
||||
(
|
||||
const IOobject& fieldIoObject
|
||||
);
|
||||
|
||||
//- Reconstruct surface field
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
|
||||
reconstructFvSurfaceField
|
||||
(
|
||||
const IOobject& fieldIoObject
|
||||
);
|
||||
|
||||
//- Reconstruct and write all/selected volume fields
|
||||
template<class Type>
|
||||
void reconstructFvVolumeFields
|
||||
(
|
||||
const IOobjectList& objects,
|
||||
const HashSet<word>& selectedFields
|
||||
);
|
||||
|
||||
//- Reconstruct and write all/selected volume fields
|
||||
template<class Type>
|
||||
void reconstructFvSurfaceFields
|
||||
(
|
||||
const IOobjectList& objects,
|
||||
const HashSet<word>& selectedFields
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "fvFieldReconstructorReconstructFields.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,524 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvFieldReconstructor.H"
|
||||
#include "Time.H"
|
||||
#include "PtrList.H"
|
||||
#include "fvPatchFields.H"
|
||||
#include "emptyFvPatch.H"
|
||||
#include "emptyFvPatchField.H"
|
||||
#include "emptyFvsPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
|
||||
Foam::fvFieldReconstructor::reconstructFvVolumeField
|
||||
(
|
||||
const IOobject& fieldIoObject
|
||||
)
|
||||
{
|
||||
// Read the field for all the processors
|
||||
PtrList<GeometricField<Type, fvPatchField, volMesh> > procFields
|
||||
(
|
||||
procMeshes_.size()
|
||||
);
|
||||
|
||||
forAll (procMeshes_, procI)
|
||||
{
|
||||
procFields.set
|
||||
(
|
||||
procI,
|
||||
new GeometricField<Type, fvPatchField, volMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldIoObject.name(),
|
||||
procMeshes_[procI].time().timeName(),
|
||||
procMeshes_[procI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
procMeshes_[procI]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Create the internalField
|
||||
Field<Type> internalField(mesh_.nCells());
|
||||
|
||||
// Create the patch fields
|
||||
PtrList<fvPatchField<Type> > patchFields(mesh_.boundary().size());
|
||||
|
||||
|
||||
forAll (procMeshes_, procI)
|
||||
{
|
||||
const GeometricField<Type, fvPatchField, volMesh>& procField =
|
||||
procFields[procI];
|
||||
|
||||
// Set the cell values in the reconstructed field
|
||||
internalField.rmap
|
||||
(
|
||||
procField.internalField(),
|
||||
cellProcAddressing_[procI]
|
||||
);
|
||||
|
||||
// Set the boundary patch values in the reconstructed field
|
||||
forAll(boundaryProcAddressing_[procI], patchI)
|
||||
{
|
||||
// Get patch index of the original patch
|
||||
const label curBPatch = boundaryProcAddressing_[procI][patchI];
|
||||
|
||||
// Get addressing slice for this patch
|
||||
const labelList::subList cp =
|
||||
procMeshes_[procI].boundary()[patchI].patchSlice
|
||||
(
|
||||
faceProcAddressing_[procI]
|
||||
);
|
||||
|
||||
// check if the boundary patch is not a processor patch
|
||||
if (curBPatch >= 0)
|
||||
{
|
||||
// Regular patch. Fast looping
|
||||
|
||||
if (!patchFields(curBPatch))
|
||||
{
|
||||
patchFields.set
|
||||
(
|
||||
curBPatch,
|
||||
fvPatchField<Type>::New
|
||||
(
|
||||
procField.boundaryField()[patchI],
|
||||
mesh_.boundary()[curBPatch],
|
||||
DimensionedField<Type, volMesh>::null(),
|
||||
fvPatchFieldReconstructor
|
||||
(
|
||||
mesh_.boundary()[curBPatch].size()
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const label curPatchStart =
|
||||
mesh_.boundaryMesh()[curBPatch].start();
|
||||
|
||||
labelList reverseAddressing(cp.size());
|
||||
|
||||
forAll(cp, faceI)
|
||||
{
|
||||
// Subtract one to take into account offsets for
|
||||
// face direction.
|
||||
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
|
||||
}
|
||||
|
||||
patchFields[curBPatch].rmap
|
||||
(
|
||||
procField.boundaryField()[patchI],
|
||||
reverseAddressing
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
const Field<Type>& curProcPatch =
|
||||
procField.boundaryField()[patchI];
|
||||
|
||||
// In processor patches, there's a mix of internal faces (some
|
||||
// of them turned) and possible cyclics. Slow loop
|
||||
forAll(cp, faceI)
|
||||
{
|
||||
// Subtract one to take into account offsets for
|
||||
// face direction.
|
||||
label curF = cp[faceI] - 1;
|
||||
|
||||
// Is the face on the boundary?
|
||||
if (curF >= mesh_.nInternalFaces())
|
||||
{
|
||||
label curBPatch = mesh_.boundaryMesh().whichPatch(curF);
|
||||
|
||||
if (!patchFields(curBPatch))
|
||||
{
|
||||
patchFields.set
|
||||
(
|
||||
curBPatch,
|
||||
fvPatchField<Type>::New
|
||||
(
|
||||
mesh_.boundary()[curBPatch].type(),
|
||||
mesh_.boundary()[curBPatch],
|
||||
DimensionedField<Type, volMesh>::null()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// add the face
|
||||
label curPatchFace =
|
||||
mesh_.boundaryMesh()
|
||||
[curBPatch].whichFace(curF);
|
||||
|
||||
patchFields[curBPatch][curPatchFace] =
|
||||
curProcPatch[faceI];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
forAll(mesh_.boundary(), patchI)
|
||||
{
|
||||
// add empty patches
|
||||
if
|
||||
(
|
||||
isType<emptyFvPatch>(mesh_.boundary()[patchI])
|
||||
&& !patchFields(patchI)
|
||||
)
|
||||
{
|
||||
patchFields.set
|
||||
(
|
||||
patchI,
|
||||
fvPatchField<Type>::New
|
||||
(
|
||||
emptyFvPatchField<Type>::typeName,
|
||||
mesh_.boundary()[patchI],
|
||||
DimensionedField<Type, volMesh>::null()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Now construct and write the field
|
||||
// setting the internalField and patchFields
|
||||
return tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||
(
|
||||
new GeometricField<Type, fvPatchField, volMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldIoObject.name(),
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
procFields[0].dimensions(),
|
||||
internalField,
|
||||
patchFields
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
|
||||
Foam::fvFieldReconstructor::reconstructFvSurfaceField
|
||||
(
|
||||
const IOobject& fieldIoObject
|
||||
)
|
||||
{
|
||||
// Read the field for all the processors
|
||||
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh> > procFields
|
||||
(
|
||||
procMeshes_.size()
|
||||
);
|
||||
|
||||
forAll (procMeshes_, procI)
|
||||
{
|
||||
procFields.set
|
||||
(
|
||||
procI,
|
||||
new GeometricField<Type, fvsPatchField, surfaceMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldIoObject.name(),
|
||||
procMeshes_[procI].time().timeName(),
|
||||
procMeshes_[procI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
procMeshes_[procI]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Create the internalField
|
||||
Field<Type> internalField(mesh_.nInternalFaces());
|
||||
|
||||
// Create the patch fields
|
||||
PtrList<fvsPatchField<Type> > patchFields(mesh_.boundary().size());
|
||||
|
||||
|
||||
forAll (procMeshes_, procI)
|
||||
{
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& procField =
|
||||
procFields[procI];
|
||||
|
||||
// Set the face values in the reconstructed field
|
||||
|
||||
// It is necessary to create a copy of the addressing array to
|
||||
// take care of the face direction offset trick.
|
||||
//
|
||||
{
|
||||
labelList curAddr(faceProcAddressing_[procI]);
|
||||
|
||||
forAll (curAddr, addrI)
|
||||
{
|
||||
curAddr[addrI] -= 1;
|
||||
}
|
||||
|
||||
internalField.rmap
|
||||
(
|
||||
procField.internalField(),
|
||||
curAddr
|
||||
);
|
||||
}
|
||||
|
||||
// Set the boundary patch values in the reconstructed field
|
||||
forAll(boundaryProcAddressing_[procI], patchI)
|
||||
{
|
||||
// Get patch index of the original patch
|
||||
const label curBPatch = boundaryProcAddressing_[procI][patchI];
|
||||
|
||||
// Get addressing slice for this patch
|
||||
const labelList::subList cp =
|
||||
procMeshes_[procI].boundary()[patchI].patchSlice
|
||||
(
|
||||
faceProcAddressing_[procI]
|
||||
);
|
||||
|
||||
// check if the boundary patch is not a processor patch
|
||||
if (curBPatch >= 0)
|
||||
{
|
||||
// Regular patch. Fast looping
|
||||
|
||||
if (!patchFields(curBPatch))
|
||||
{
|
||||
patchFields.set
|
||||
(
|
||||
curBPatch,
|
||||
fvsPatchField<Type>::New
|
||||
(
|
||||
procField.boundaryField()[patchI],
|
||||
mesh_.boundary()[curBPatch],
|
||||
DimensionedField<Type, surfaceMesh>::null(),
|
||||
fvPatchFieldReconstructor
|
||||
(
|
||||
mesh_.boundary()[curBPatch].size()
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const label curPatchStart =
|
||||
mesh_.boundaryMesh()[curBPatch].start();
|
||||
|
||||
labelList reverseAddressing(cp.size());
|
||||
|
||||
forAll(cp, faceI)
|
||||
{
|
||||
// Subtract one to take into account offsets for
|
||||
// face direction.
|
||||
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
|
||||
}
|
||||
|
||||
patchFields[curBPatch].rmap
|
||||
(
|
||||
procField.boundaryField()[patchI],
|
||||
reverseAddressing
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
const Field<Type>& curProcPatch =
|
||||
procField.boundaryField()[patchI];
|
||||
|
||||
// In processor patches, there's a mix of internal faces (some
|
||||
// of them turned) and possible cyclics. Slow loop
|
||||
forAll(cp, faceI)
|
||||
{
|
||||
label curF = cp[faceI] - 1;
|
||||
|
||||
// Is the face turned the right side round
|
||||
if (curF >= 0)
|
||||
{
|
||||
// Is the face on the boundary?
|
||||
if (curF >= mesh_.nInternalFaces())
|
||||
{
|
||||
label curBPatch =
|
||||
mesh_.boundaryMesh().whichPatch(curF);
|
||||
|
||||
if (!patchFields(curBPatch))
|
||||
{
|
||||
patchFields.set
|
||||
(
|
||||
curBPatch,
|
||||
fvsPatchField<Type>::New
|
||||
(
|
||||
mesh_.boundary()[curBPatch].type(),
|
||||
mesh_.boundary()[curBPatch],
|
||||
DimensionedField<Type, surfaceMesh>
|
||||
::null()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// add the face
|
||||
label curPatchFace =
|
||||
mesh_.boundaryMesh()
|
||||
[curBPatch].whichFace(curF);
|
||||
|
||||
patchFields[curBPatch][curPatchFace] =
|
||||
curProcPatch[faceI];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Internal face
|
||||
internalField[curF] = curProcPatch[faceI];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
forAll(mesh_.boundary(), patchI)
|
||||
{
|
||||
// add empty patches
|
||||
if
|
||||
(
|
||||
isType<emptyFvPatch>(mesh_.boundary()[patchI])
|
||||
&& !patchFields(patchI)
|
||||
)
|
||||
{
|
||||
patchFields.set
|
||||
(
|
||||
patchI,
|
||||
fvsPatchField<Type>::New
|
||||
(
|
||||
emptyFvsPatchField<Type>::typeName,
|
||||
mesh_.boundary()[patchI],
|
||||
DimensionedField<Type, surfaceMesh>::null()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Now construct and write the field
|
||||
// setting the internalField and patchFields
|
||||
return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
|
||||
(
|
||||
new GeometricField<Type, fvsPatchField, surfaceMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldIoObject.name(),
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
procFields[0].dimensions(),
|
||||
internalField,
|
||||
patchFields
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Reconstruct and write all/selected volume fields
|
||||
template<class Type>
|
||||
void Foam::fvFieldReconstructor::reconstructFvVolumeFields
|
||||
(
|
||||
const IOobjectList& objects,
|
||||
const HashSet<word>& selectedFields
|
||||
)
|
||||
{
|
||||
const word& fieldClassName =
|
||||
GeometricField<Type, fvPatchField, volMesh>::typeName;
|
||||
|
||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
||||
|
||||
if (fields.size())
|
||||
{
|
||||
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
||||
|
||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
||||
{
|
||||
if
|
||||
(
|
||||
!selectedFields.size()
|
||||
|| selectedFields.found(fieldIter()->name())
|
||||
)
|
||||
{
|
||||
Info<< " " << fieldIter()->name() << endl;
|
||||
|
||||
reconstructFvVolumeField<Type>(*fieldIter())().write();
|
||||
}
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Reconstruct and write all/selected surface fields
|
||||
template<class Type>
|
||||
void Foam::fvFieldReconstructor::reconstructFvSurfaceFields
|
||||
(
|
||||
const IOobjectList& objects,
|
||||
const HashSet<word>& selectedFields
|
||||
)
|
||||
{
|
||||
const word& fieldClassName =
|
||||
GeometricField<Type, fvsPatchField, surfaceMesh>::typeName;
|
||||
|
||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
||||
|
||||
if (fields.size())
|
||||
{
|
||||
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
||||
|
||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
||||
{
|
||||
if
|
||||
(
|
||||
!selectedFields.size()
|
||||
|| selectedFields.found(fieldIter()->name())
|
||||
)
|
||||
{
|
||||
Info<< " " << fieldIter()->name() << endl;
|
||||
|
||||
reconstructFvSurfaceField<Type>(*fieldIter())().write();
|
||||
}
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,105 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "pointFieldReconstructor.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::pointFieldReconstructor::pointFieldReconstructor
|
||||
(
|
||||
const pointMesh& mesh,
|
||||
const PtrList<pointMesh>& procMeshes,
|
||||
const PtrList<labelIOList>& pointProcAddressing,
|
||||
const PtrList<labelIOList>& boundaryProcAddressing
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
procMeshes_(procMeshes),
|
||||
pointProcAddressing_(pointProcAddressing),
|
||||
boundaryProcAddressing_(boundaryProcAddressing),
|
||||
patchPointAddressing_(procMeshes.size())
|
||||
{
|
||||
// Inverse-addressing of the patch point labels.
|
||||
labelList pointMap(mesh_.size(), -1);
|
||||
|
||||
// Create the pointPatch addressing
|
||||
forAll(procMeshes_, proci)
|
||||
{
|
||||
const pointMesh& procMesh = procMeshes_[proci];
|
||||
|
||||
patchPointAddressing_[proci].setSize(procMesh.boundary().size());
|
||||
|
||||
forAll(procMesh.boundary(), patchi)
|
||||
{
|
||||
if (boundaryProcAddressing_[proci][patchi] >= 0)
|
||||
{
|
||||
labelList& procPatchAddr = patchPointAddressing_[proci][patchi];
|
||||
procPatchAddr.setSize(procMesh.boundary()[patchi].size(), -1);
|
||||
|
||||
const labelList& patchPointLabels =
|
||||
mesh_.boundary()[boundaryProcAddressing_[proci][patchi]]
|
||||
.meshPoints();
|
||||
|
||||
// Create the inverse-addressing of the patch point labels.
|
||||
forAll (patchPointLabels, pointi)
|
||||
{
|
||||
pointMap[patchPointLabels[pointi]] = pointi;
|
||||
}
|
||||
|
||||
const labelList& procPatchPoints =
|
||||
procMesh.boundary()[patchi].meshPoints();
|
||||
|
||||
forAll (procPatchPoints, pointi)
|
||||
{
|
||||
procPatchAddr[pointi] =
|
||||
pointMap
|
||||
[
|
||||
pointProcAddressing_[proci][procPatchPoints[pointi]]
|
||||
];
|
||||
}
|
||||
|
||||
if (procPatchAddr.size() && min(procPatchAddr) < 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"pointFieldReconstructor::pointFieldReconstructor"
|
||||
"(\n"
|
||||
" const pointMesh& mesh,\n"
|
||||
" const PtrList<pointMesh>& procMeshes,\n"
|
||||
" const PtrList<labelIOList>& pointProcAddressing,\n"
|
||||
" const PtrList<labelIOList>& "
|
||||
"boundaryProcAddressing\n"
|
||||
")"
|
||||
) << "Incomplete patch point addressing"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,162 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::pointFieldReconstructor
|
||||
|
||||
Description
|
||||
Point field reconstructor.
|
||||
|
||||
SourceFiles
|
||||
pointFieldReconstructor.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef pointFieldReconstructor_H
|
||||
#define pointFieldReconstructor_H
|
||||
|
||||
#include "pointMesh.H"
|
||||
#include "pointFields.H"
|
||||
#include "pointPatchFieldMapperPatchRef.H"
|
||||
#include "IOobjectList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class pointFieldReconstructor Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class pointFieldReconstructor
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reconstructed mesh reference
|
||||
const pointMesh& mesh_;
|
||||
|
||||
//- List of processor meshes
|
||||
const PtrList<pointMesh>& procMeshes_;
|
||||
|
||||
//- List of processor point addressing lists
|
||||
const PtrList<labelIOList>& pointProcAddressing_;
|
||||
|
||||
//- List of processor boundary addressing lists
|
||||
const PtrList<labelIOList>& boundaryProcAddressing_;
|
||||
|
||||
//- Point patch addressing
|
||||
labelListListList patchPointAddressing_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
pointFieldReconstructor
|
||||
(
|
||||
const pointFieldReconstructor&
|
||||
);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const pointFieldReconstructor&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
class pointPatchFieldReconstructor
|
||||
:
|
||||
public pointPatchFieldMapper
|
||||
{
|
||||
label size_;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given size
|
||||
pointPatchFieldReconstructor(const label size)
|
||||
:
|
||||
size_(size)
|
||||
{}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
label size() const
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
|
||||
bool direct() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const unallocLabelList& directAddressing() const
|
||||
{
|
||||
return unallocLabelList::null();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
pointFieldReconstructor
|
||||
(
|
||||
const pointMesh& mesh,
|
||||
const PtrList<pointMesh>& procMeshes,
|
||||
const PtrList<labelIOList>& pointProcAddressing,
|
||||
const PtrList<labelIOList>& boundaryProcAddressing
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Reconstruct field
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, pointPatchField, pointMesh> >
|
||||
reconstructField(const IOobject& fieldIoObject);
|
||||
|
||||
//- Reconstruct and write all fields
|
||||
template<class Type>
|
||||
void reconstructFields(const IOobjectList& objects);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "pointFieldReconstructorReconstructFields.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,177 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "pointFieldReconstructor.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
|
||||
Foam::pointFieldReconstructor::reconstructField(const IOobject& fieldIoObject)
|
||||
{
|
||||
// Read the field for all the processors
|
||||
PtrList<GeometricField<Type, pointPatchField, pointMesh> > procFields
|
||||
(
|
||||
procMeshes_.size()
|
||||
);
|
||||
|
||||
forAll (procMeshes_, proci)
|
||||
{
|
||||
procFields.set
|
||||
(
|
||||
proci,
|
||||
new GeometricField<Type, pointPatchField, pointMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldIoObject.name(),
|
||||
procMeshes_[proci]().time().timeName(),
|
||||
procMeshes_[proci](),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
procMeshes_[proci]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Create the internalField
|
||||
Field<Type> internalField(mesh_.size());
|
||||
|
||||
// Create the patch fields
|
||||
PtrList<pointPatchField<Type> > patchFields(mesh_.boundary().size());
|
||||
|
||||
|
||||
forAll (procMeshes_, proci)
|
||||
{
|
||||
const GeometricField<Type, pointPatchField, pointMesh>&
|
||||
procField = procFields[proci];
|
||||
|
||||
// Get processor-to-global addressing for use in rmap
|
||||
const labelList& procToGlobalAddr = pointProcAddressing_[proci];
|
||||
|
||||
// Set the cell values in the reconstructed field
|
||||
internalField.rmap
|
||||
(
|
||||
procField.internalField(),
|
||||
procToGlobalAddr
|
||||
);
|
||||
|
||||
// Set the boundary patch values in the reconstructed field
|
||||
forAll(boundaryProcAddressing_[proci], patchi)
|
||||
{
|
||||
// Get patch index of the original patch
|
||||
const label curBPatch = boundaryProcAddressing_[proci][patchi];
|
||||
|
||||
// check if the boundary patch is not a processor patch
|
||||
if (curBPatch >= 0)
|
||||
{
|
||||
if (!patchFields(curBPatch))
|
||||
{
|
||||
patchFields.set(
|
||||
curBPatch,
|
||||
pointPatchField<Type>::New
|
||||
(
|
||||
procField.boundaryField()[patchi],
|
||||
mesh_.boundary()[curBPatch],
|
||||
DimensionedField<Type, pointMesh>::null(),
|
||||
pointPatchFieldReconstructor
|
||||
(
|
||||
mesh_.boundary()[curBPatch].size()
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
patchFields[curBPatch].rmap
|
||||
(
|
||||
procField.boundaryField()[patchi],
|
||||
patchPointAddressing_[proci][patchi]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Construct and write the field
|
||||
// setting the internalField and patchFields
|
||||
return tmp<GeometricField<Type, pointPatchField, pointMesh> >
|
||||
(
|
||||
new GeometricField<Type, pointPatchField, pointMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldIoObject.name(),
|
||||
mesh_().time().timeName(),
|
||||
mesh_(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
procFields[0].dimensions(),
|
||||
internalField,
|
||||
patchFields
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Reconstruct and write all point fields
|
||||
template<class Type>
|
||||
void Foam::pointFieldReconstructor::reconstructFields
|
||||
(
|
||||
const IOobjectList& objects
|
||||
)
|
||||
{
|
||||
word fieldClassName
|
||||
(
|
||||
GeometricField<Type, pointPatchField, pointMesh>::typeName
|
||||
);
|
||||
|
||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
||||
|
||||
if (fields.size())
|
||||
{
|
||||
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
||||
|
||||
for
|
||||
(
|
||||
IOobjectList::iterator fieldIter = fields.begin();
|
||||
fieldIter != fields.end();
|
||||
++fieldIter
|
||||
)
|
||||
{
|
||||
Info<< " " << fieldIter()->name() << endl;
|
||||
|
||||
reconstructField<Type>(*fieldIter())().write();
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,254 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "processorMeshes.H"
|
||||
#include "Time.H"
|
||||
#include "primitiveMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::processorMeshes::read()
|
||||
{
|
||||
forAll (databases_, procI)
|
||||
{
|
||||
meshes_.set
|
||||
(
|
||||
procI,
|
||||
new fvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
meshName_,
|
||||
databases_[procI].timeName(),
|
||||
databases_[procI]
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
pointProcAddressing_.set
|
||||
(
|
||||
procI,
|
||||
new labelIOList
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pointProcAddressing",
|
||||
meshes_[procI].facesInstance(),
|
||||
meshes_[procI].meshSubDir,
|
||||
meshes_[procI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
faceProcAddressing_.set
|
||||
(
|
||||
procI,
|
||||
new labelIOList
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"faceProcAddressing",
|
||||
meshes_[procI].facesInstance(),
|
||||
meshes_[procI].meshSubDir,
|
||||
meshes_[procI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
cellProcAddressing_.set
|
||||
(
|
||||
procI,
|
||||
new labelIOList
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cellProcAddressing",
|
||||
meshes_[procI].facesInstance(),
|
||||
meshes_[procI].meshSubDir,
|
||||
meshes_[procI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
boundaryProcAddressing_.set
|
||||
(
|
||||
procI,
|
||||
new labelIOList
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"boundaryProcAddressing",
|
||||
meshes_[procI].facesInstance(),
|
||||
meshes_[procI].meshSubDir,
|
||||
meshes_[procI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::processorMeshes::processorMeshes
|
||||
(
|
||||
PtrList<Time>& databases,
|
||||
const word& meshName
|
||||
)
|
||||
:
|
||||
databases_(databases),
|
||||
meshName_(meshName),
|
||||
meshes_(databases.size()),
|
||||
pointProcAddressing_(databases.size()),
|
||||
faceProcAddressing_(databases.size()),
|
||||
cellProcAddressing_(databases.size()),
|
||||
boundaryProcAddressing_(databases.size())
|
||||
{
|
||||
read();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fvMesh::readUpdateState Foam::processorMeshes::readUpdate()
|
||||
{
|
||||
fvMesh::readUpdateState stat = fvMesh::UNCHANGED;
|
||||
|
||||
forAll (databases_, procI)
|
||||
{
|
||||
// Check if any new meshes need to be read.
|
||||
fvMesh::readUpdateState procStat = meshes_[procI].readUpdate();
|
||||
|
||||
/*
|
||||
if (procStat != fvMesh::UNCHANGED)
|
||||
{
|
||||
Info<< "Processor " << procI
|
||||
<< " at time " << databases_[procI].timeName()
|
||||
<< " detected mesh change " << procStat
|
||||
<< endl;
|
||||
}
|
||||
*/
|
||||
|
||||
// Combine into overall mesh change status
|
||||
if (stat == fvMesh::UNCHANGED)
|
||||
{
|
||||
stat = procStat;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stat != procStat)
|
||||
{
|
||||
FatalErrorIn("processorMeshes::readUpdate()")
|
||||
<< "Processor " << procI
|
||||
<< " has a different polyMesh at time "
|
||||
<< databases_[procI].timeName()
|
||||
<< " compared to any previous processors." << nl
|
||||
<< "Please check time " << databases_[procI].timeName()
|
||||
<< " directories on all processors for consistent"
|
||||
<< " mesh files."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
stat == fvMesh::TOPO_CHANGE
|
||||
|| stat == fvMesh::TOPO_PATCH_CHANGE
|
||||
)
|
||||
{
|
||||
// Reread all meshes and addresssing
|
||||
read();
|
||||
}
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorMeshes::reconstructPoints(fvMesh& mesh)
|
||||
{
|
||||
// Read the field for all the processors
|
||||
PtrList<pointIOField> procsPoints(meshes_.size());
|
||||
|
||||
forAll (meshes_, procI)
|
||||
{
|
||||
procsPoints.set
|
||||
(
|
||||
procI,
|
||||
new pointIOField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
meshes_[procI].time().timeName(),
|
||||
polyMesh::meshSubDir,
|
||||
meshes_[procI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Create the new points
|
||||
vectorField newPoints(mesh.nPoints());
|
||||
|
||||
forAll (meshes_, procI)
|
||||
{
|
||||
const vectorField& procPoints = procsPoints[procI];
|
||||
|
||||
// Set the cell values in the reconstructed field
|
||||
|
||||
const labelList& pointProcAddressingI = pointProcAddressing_[procI];
|
||||
|
||||
if (pointProcAddressingI.size() != procPoints.size())
|
||||
{
|
||||
FatalErrorIn("processorMeshes")
|
||||
<< "problem :"
|
||||
<< " pointProcAddressingI:" << pointProcAddressingI.size()
|
||||
<< " procPoints:" << procPoints.size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
forAll(pointProcAddressingI, pointI)
|
||||
{
|
||||
newPoints[pointProcAddressingI[pointI]] = procPoints[pointI];
|
||||
}
|
||||
}
|
||||
|
||||
mesh.movePoints(newPoints);
|
||||
mesh.write();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,141 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::processorMeshes
|
||||
|
||||
Description
|
||||
Container for processor mesh addressing.
|
||||
|
||||
SourceFiles
|
||||
processorMeshes.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorMeshes_H
|
||||
#define processorMeshes_H
|
||||
|
||||
#include "PtrList.H"
|
||||
#include "fvMesh.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "labelIOList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class processorMeshes Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class processorMeshes
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Processor databases
|
||||
PtrList<Time>& databases_;
|
||||
|
||||
const word meshName_;
|
||||
|
||||
//- List of processor meshes
|
||||
PtrList<fvMesh> meshes_;
|
||||
|
||||
//- List of processor point addressing lists
|
||||
PtrList<labelIOList> pointProcAddressing_;
|
||||
|
||||
//- List of processor face addressing lists
|
||||
PtrList<labelIOList> faceProcAddressing_;
|
||||
|
||||
//- List of processor cell addressing lists
|
||||
PtrList<labelIOList> cellProcAddressing_;
|
||||
|
||||
//- List of processor boundary addressing lists
|
||||
PtrList<labelIOList> boundaryProcAddressing_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Read all meshes
|
||||
void read();
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
processorMeshes(const processorMeshes&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const processorMeshes&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
processorMeshes(PtrList<Time>& databases, const word& meshName);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Update the meshes based on the mesh files saved in
|
||||
// time directories
|
||||
fvMesh::readUpdateState readUpdate();
|
||||
|
||||
//- Reconstruct point position after motion in parallel
|
||||
void reconstructPoints(fvMesh& mesh);
|
||||
|
||||
PtrList<fvMesh>& meshes()
|
||||
{
|
||||
return meshes_;
|
||||
}
|
||||
const PtrList<labelIOList>& pointProcAddressing() const
|
||||
{
|
||||
return pointProcAddressing_;
|
||||
}
|
||||
PtrList<labelIOList>& faceProcAddressing()
|
||||
{
|
||||
return faceProcAddressing_;
|
||||
}
|
||||
const PtrList<labelIOList>& cellProcAddressing() const
|
||||
{
|
||||
return cellProcAddressing_;
|
||||
}
|
||||
const PtrList<labelIOList>& boundaryProcAddressing() const
|
||||
{
|
||||
return boundaryProcAddressing_;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,95 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
InClass
|
||||
Foam::reconstructLagrangian
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
reconstructLagrangianPositions.C
|
||||
reconstructLagrangianFields.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef reconstructLagrangian_H
|
||||
#define reconstructLagrangian_H
|
||||
|
||||
#include "cloud.H"
|
||||
#include "polyMesh.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "fvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void reconstructLagrangianPositions
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& cloudName,
|
||||
const PtrList<fvMesh>& meshes,
|
||||
const PtrList<labelIOList>& faceProcAddressing,
|
||||
const PtrList<labelIOList>& cellProcAddressing
|
||||
);
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<IOField<Type> > reconstructLagrangianField
|
||||
(
|
||||
const word& cloudName,
|
||||
const polyMesh& mesh,
|
||||
const PtrList<fvMesh>& meshes,
|
||||
const word& fieldName
|
||||
);
|
||||
|
||||
|
||||
template<class Type>
|
||||
void reconstructLagrangianFields
|
||||
(
|
||||
const word& cloudName,
|
||||
const polyMesh& mesh,
|
||||
const PtrList<fvMesh>& meshes,
|
||||
const IOobjectList& objects
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "reconstructLagrangianFields.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,126 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "IOField.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::IOField<Type> > Foam::reconstructLagrangianField
|
||||
(
|
||||
const word& cloudName,
|
||||
const polyMesh& mesh,
|
||||
const PtrList<fvMesh>& meshes,
|
||||
const word& fieldName
|
||||
)
|
||||
{
|
||||
// Construct empty field on mesh
|
||||
tmp<IOField<Type> > tfield
|
||||
(
|
||||
new IOField<Type>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
mesh.time().timeName(),
|
||||
cloud::prefix/cloudName,
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
Field<Type>(0)
|
||||
)
|
||||
);
|
||||
Field<Type>& field = tfield();
|
||||
|
||||
forAll(meshes, i)
|
||||
{
|
||||
// Check object on local mesh
|
||||
IOobject localIOobject
|
||||
(
|
||||
fieldName,
|
||||
meshes[i].time().timeName(),
|
||||
cloud::prefix/cloudName,
|
||||
meshes[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (localIOobject.headerOk())
|
||||
{
|
||||
IOField<Type> fieldi(localIOobject);
|
||||
|
||||
label offset = field.size();
|
||||
field.setSize(offset + fieldi.size());
|
||||
|
||||
forAll(fieldi, j)
|
||||
{
|
||||
field[offset + j] = fieldi[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tfield;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::reconstructLagrangianFields
|
||||
(
|
||||
const word& cloudName,
|
||||
const polyMesh& mesh,
|
||||
const PtrList<fvMesh>& meshes,
|
||||
const IOobjectList& objects
|
||||
)
|
||||
{
|
||||
word fieldClassName(IOField<Type>::typeName);
|
||||
|
||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
||||
|
||||
if (fields.size())
|
||||
{
|
||||
Info<< " Reconstructing lagrangian "
|
||||
<< fieldClassName << "s\n" << endl;
|
||||
|
||||
forAllIter(IOobjectList, fields, fieldIter)
|
||||
{
|
||||
Info<< " " << fieldIter()->name() << endl;
|
||||
reconstructLagrangianField<Type>
|
||||
(
|
||||
cloudName,
|
||||
mesh,
|
||||
meshes,
|
||||
fieldIter()->name()
|
||||
)().write();
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,76 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "reconstructLagrangian.H"
|
||||
#include "labelIOList.H"
|
||||
#include "Cloud.H"
|
||||
#include "passiveParticle.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::reconstructLagrangianPositions
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& cloudName,
|
||||
const PtrList<fvMesh>& meshes,
|
||||
const PtrList<labelIOList>& faceProcAddressing,
|
||||
const PtrList<labelIOList>& cellProcAddressing
|
||||
)
|
||||
{
|
||||
Cloud<passiveParticle> lagrangianPositions
|
||||
(
|
||||
mesh,
|
||||
cloudName,
|
||||
IDLList<passiveParticle>()
|
||||
);
|
||||
|
||||
forAll(meshes, i)
|
||||
{
|
||||
const labelList& cellMap = cellProcAddressing[i];
|
||||
|
||||
Cloud<passiveParticle> lpi(meshes[i], cloudName, false);
|
||||
|
||||
forAllIter(Cloud<passiveParticle>, lpi, iter)
|
||||
{
|
||||
const passiveParticle& ppi = iter();
|
||||
|
||||
lagrangianPositions.append
|
||||
(
|
||||
new passiveParticle
|
||||
(
|
||||
lagrangianPositions,
|
||||
ppi.position(),
|
||||
cellMap[ppi.cell()]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
IOPosition<passiveParticle>(lagrangianPositions).write();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user