remove meshCutSurface

This commit is contained in:
mattijs
2008-11-05 15:38:27 +00:00
parent c8d4ea0e43
commit 81bd77b8ad
18 changed files with 0 additions and 3939 deletions

View File

@ -297,15 +297,4 @@ cfdTools/general/SRF/SRFModel/SRFModel/newSRFModel.C
cfdTools/general/SRF/SRFModel/rpm/rpm.C
cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
fvMeshCutSurface = fvMesh/fvMeshCutSurface
meshCut = $(fvMeshCutSurface)/meshCut
$(meshCut)/meshCutSurface.C
$(meshCut)/cellAddressing.C
edgeCuts = $(fvMeshCutSurface)/edgeCuts
$(edgeCuts)/meshEdgeCuts.C
$(edgeCuts)/faceDecompIsoSurfaceCuts.C
$(edgeCuts)/cellDecompIsoSurfaceCuts.C
LIB = $(FOAM_LIBBIN)/libfiniteVolume

View File

@ -1,161 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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::cellDecompCuts
Description
Container for cuts of edges of (implicit) tet decomposition.
Used to collect data for meshCut.
As much as possible, cuts are defined using mesh information:
- cut (exactly) through mesh vertex
- cut (exactly) through cell centre
- cut through mesh edge. Both edge label and position on edge given.
- cut through tet pyramidEdge (edge between vertex and cell centre).
Edge and position on edge given.
- cut through diagonalEdge (edge between vertices of a face)
Edge and position on edge given.
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef cellDecompCuts_H
#define cellDecompCuts_H
#include "meshEdgeCuts.H"
#include "pyramidEdge.H"
#include "diagonalEdge.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
/*---------------------------------------------------------------------------*\
Class cellDecompCuts Declaration
\*---------------------------------------------------------------------------*/
class cellDecompCuts
:
public meshEdgeCuts
{
protected:
labelList meshCellCentres_;
List<pyramidEdge> pyrEdges_;
scalarField pyrEdgeWeights_;
List<diagonalEdge> diagEdges_;
scalarField diagEdgeWeights_;
// Private Member Functions
public:
// Constructors
//- Construct from components
cellDecompCuts
(
const primitiveMesh& mesh,
const labelList& cells,
const labelList& meshVerts,
const labelList& meshCellCentres,
const labelList& meshEdges,
const scalarField& meshEdgeWeights,
const List<pyramidEdge>& pyrEdges,
const scalarField& pyrEdgeWeights,
const List<diagonalEdge>& diagEdges,
const scalarField& diagEdgeWeights
)
:
meshEdgeCuts(mesh, cells, meshVerts, meshEdges, meshEdgeWeights),
meshCellCentres_(meshCellCentres),
pyrEdges_(pyrEdges),
pyrEdgeWeights_(pyrEdgeWeights),
diagEdges_(diagEdges),
diagEdgeWeights_(diagEdgeWeights)
{}
// Member Functions
const labelList& meshCellCentres() const
{
return meshCellCentres_;
}
const List<pyramidEdge>& pyrEdges() const
{
return pyrEdges_;
}
const scalarField& pyrEdgeWeights() const
{
return pyrEdgeWeights_;
}
const List<diagonalEdge>& diagEdges() const
{
return diagEdges_;
}
const scalarField& diagEdgeWeights() const
{
return diagEdgeWeights_;
}
label size() const
{
return
meshEdgeCuts::size() + meshCellCentres_.size()
+ pyrEdges_.size() + diagEdges_.size();
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,267 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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
Description
\*---------------------------------------------------------------------------*/
#include "cellDecompIsoSurfaceCuts.H"
#include "volPointInterpolation.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::cellDecompIsoSurfaceCuts::constructEdgeCuts
(
const volScalarField& volField,
const pointScalarField& ptField,
const scalar isoVal,
const scalar tol
)
{
const primitiveMesh& mesh = volField.mesh();
// Intermediate storage for labels of cut edges and cut points
label nBFaces = mesh.nFaces() - mesh.nInternalFaces();
labelHashSet cutCells(nBFaces);
labelHashSet cutVerts(nBFaces);
labelHashSet cutCellCentres(nBFaces);
DynamicList<label> meshCutEdges(nBFaces);
DynamicList<scalar> meshEdgeWeights(nBFaces);
DynamicList<pyramidEdge> cutPyrEdges(nBFaces);
DynamicList<scalar> pyrEdgeWeights(nBFaces);
DynamicList<diagonalEdge> cutDiagEdges(nBFaces);
DynamicList<scalar> diagEdgeWeights(nBFaces);
// Walk over faces
forAll(mesh.faces(), faceI)
{
const face& f = mesh.faces()[faceI];
label ownerI = mesh.faceOwner()[faceI];
label neighbourI = -1;
if (mesh.isInternalFace(faceI))
{
neighbourI = mesh.faceNeighbour()[faceI];
}
scalar weight;
//
// Check face diagonal. Simple triangulation from f[0]
//
for(label fp = 2; fp < f.size() - 1; fp++)
{
if (crosses(isoVal, ptField[f[0]], ptField[f[fp]], weight))
{
mark(ownerI, cutCells);
if (neighbourI != -1)
{
mark(neighbourI, cutCells);
}
if (weight < tol)
{
mark(f[0], cutVerts);
}
else if (weight > 1-tol)
{
mark(f[fp], cutVerts);
}
else
{
cutDiagEdges.append(diagonalEdge(faceI, 0, fp));
diagEdgeWeights.append(weight);
}
}
}
}
// Walk over all mesh points
forAll(mesh.points(), pointI)
{
const labelList& myCells = mesh.pointCells()[pointI];
forAll(myCells, myCellI)
{
label cellI = myCells[myCellI];
//
// Check pyramid edge crossing
//
scalar weight;
if (crosses(isoVal, ptField[pointI], volField[cellI], weight))
{
mark(cellI, cutCells);
if (weight < tol)
{
mark(pointI, cutVerts);
}
else if (weight > 1-tol)
{
mark(cellI, cutCellCentres);
}
else
{
cutPyrEdges.append(pyramidEdge(pointI, cellI));
pyrEdgeWeights.append(weight);
}
}
}
}
// Walk over all mesh edges
forAll(mesh.edges(), edgeI)
{
const edge& e = mesh.edges()[edgeI];
scalar weight;
if (crosses(isoVal, ptField[e.start()], ptField[e.end()], weight))
{
mark(mesh.edgeCells()[edgeI], cutCells);
if (weight < tol)
{
mark(e.start(), cutVerts);
}
else if (weight > 1-tol)
{
mark(e.end(), cutVerts);
}
else
{
meshCutEdges.append(edgeI);
meshEdgeWeights.append(weight);
}
}
}
meshCutEdges.shrink();
meshEdgeWeights.shrink();
cutPyrEdges.shrink();
pyrEdgeWeights.shrink();
cutDiagEdges.shrink();
diagEdgeWeights.shrink();
// Tranfer lists to cellDecompCuts
cells_ = cutCells.toc();
meshVerts_ = cutVerts.toc();
meshCellCentres_ = cutCellCentres.toc();
meshEdges_.transfer(meshCutEdges);
meshEdgeWeights_.transfer(meshEdgeWeights);
pyrEdges_.transfer(cutPyrEdges);
pyrEdgeWeights_.transfer(pyrEdgeWeights);
diagEdges_.transfer(cutDiagEdges);
diagEdgeWeights_.transfer(diagEdgeWeights);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cellDecompIsoSurfaceCuts::cellDecompIsoSurfaceCuts
(
const volScalarField& volField,
const pointScalarField& ptField,
const scalar isoVal,
const scalar tol
)
:
cellDecompCuts
(
volField.mesh(),
labelList(),
labelList(), // mesh vertices
labelList(), // mesh cell centres
labelList(), // mesh edges
scalarField(),
List<pyramidEdge>(), // pyramid edges
scalarField(),
List<diagonalEdge>(), // face diagonal edges
scalarField()
)
{
constructEdgeCuts(volField, ptField, isoVal, tol);
}
// Construct from interpolator and field (does interpolation)
Foam::cellDecompIsoSurfaceCuts::cellDecompIsoSurfaceCuts
(
const volScalarField& volField,
const volPointInterpolation& pInterp,
const scalar isoVal,
const scalar tol
)
:
cellDecompCuts
(
volField.mesh(),
labelList(),
labelList(), // mesh vertices
labelList(), // mesh cell centres
labelList(), // mesh edges
scalarField(),
List<pyramidEdge>(), // pyramid edges
scalarField(),
List<diagonalEdge>(), // face diagonal edges
scalarField()
)
{
// Get field on vertices
tmp<pointScalarField> tptField = pInterp.interpolate(volField);
const pointScalarField& ptField = tptField();
constructEdgeCuts(volField, ptField, isoVal, tol);
}
// ************************************************************************* //

View File

@ -1,101 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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::cellDecompIsoSurfaceCuts
Description
cellCuts resulting from isoSurface reconstruction on cellDecomp tet mesh
SourceFiles
cellDecompIsoSurfaceCuts.C
\*---------------------------------------------------------------------------*/
#ifndef cellDecompIsoSurfaceCuts_H
#define cellDecompIsoSurfaceCuts_H
#include "cellDecompCuts.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class volPointInterpolation;
/*---------------------------------------------------------------------------*\
Class cellDecompIsoSurfaceCuts Declaration
\*---------------------------------------------------------------------------*/
class cellDecompIsoSurfaceCuts
:
public cellDecompCuts
{
// Private Member Functions
//- Do all the hard work: determine edge crossings
void constructEdgeCuts
(
const volScalarField&,
const pointScalarField&,
const scalar,
const scalar
);
public:
// Constructors
//- Construct from field on cells and field on vertices
cellDecompIsoSurfaceCuts
(
const volScalarField&,
const pointScalarField&,
const scalar isoValue,
const scalar tol
);
//- Construct from interpolator and field (does interpolation)
cellDecompIsoSurfaceCuts
(
const volScalarField&,
const volPointInterpolation&,
const scalar isoValue,
const scalar tol
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,200 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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::faceDecompCuts
Description
Container for cuts of edges of (implicit) tet decomposition. Used to
collect data for meshCut. As much as possible cuts are defined using
mesh information:
- cut (exactly) through mesh vertex
- ,, ,, cell centre
- ,, ,, face centre
- cut through mesh edge. Both edge label and position on edge given.
- cut through tet pyramidEdge (edge between vertex and cell centre).
Edge and position on edge given.
- cut through tet faceEdge (edge between vertex and face centre).
Edge and position on edge given.
- cut through tet centreEdge (edge between face centre and cell centre).
Edge and position on edge given.
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef faceDecompCuts_H
#define faceDecompCuts_H
#include "meshEdgeCuts.H"
#include "pyramidEdge.H"
#include "faceEdge.H"
#include "centreEdge.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
/*---------------------------------------------------------------------------*\
Class faceDecompCuts Declaration
\*---------------------------------------------------------------------------*/
class faceDecompCuts
:
public meshEdgeCuts
{
protected:
//- List of faces whose centre is exactly cut
labelList meshFaceCentres_;
//- List of cells whose centre is exactly cut
labelList meshCellCentres_;
//- List of pyramid edge descriptions
List<pyramidEdge> pyrEdges_;
//- For each pyramid edge description the position of the cut
scalarField pyrEdgeWeights_;
//- List of face edge descriptions
List<faceEdge> faceEdges_;
//- For each face edge description the position of the cut
scalarField faceEdgeWeights_;
//- List of centre edge descriptions
List<centreEdge> centreEdges_;
//- For each centre edge description the position of the cut
scalarField centreEdgeWeights_;
public:
// Constructors
//- Construct from components
faceDecompCuts
(
const primitiveMesh& mesh,
const labelList& cells,
const labelList& meshVerts,
const labelList& meshFaceCentres,
const labelList& meshCellCentres,
const labelList& meshEdges,
const scalarField& meshEdgeWeights,
const List<pyramidEdge>& pyrEdges,
const scalarField& pyrEdgeWeights,
const List<faceEdge>& faceEdges,
const scalarField& faceEdgeWeights,
const List<centreEdge>& centreEdges,
const scalarField& centreEdgeWeights
)
:
meshEdgeCuts(mesh, cells, meshVerts, meshEdges, meshEdgeWeights),
meshFaceCentres_(meshFaceCentres),
meshCellCentres_(meshCellCentres),
pyrEdges_(pyrEdges),
pyrEdgeWeights_(pyrEdgeWeights),
faceEdges_(faceEdges),
faceEdgeWeights_(faceEdgeWeights),
centreEdges_(centreEdges),
centreEdgeWeights_(centreEdgeWeights)
{}
// Member Functions
const labelList& meshFaceCentres() const
{
return meshFaceCentres_;
}
const labelList& meshCellCentres() const
{
return meshCellCentres_;
}
const List<pyramidEdge>& pyrEdges() const
{
return pyrEdges_;
}
const scalarField& pyrEdgeWeights() const
{
return pyrEdgeWeights_;
}
const List<centreEdge>& centreEdges() const
{
return centreEdges_;
}
const scalarField& centreEdgeWeights() const
{
return centreEdgeWeights_;
}
const List<faceEdge>& faceEdges() const
{
return faceEdges_;
}
const scalarField& faceEdgeWeights() const
{
return faceEdgeWeights_;
}
label size() const
{
return
meshEdgeCuts::size()
+ meshFaceCentres_.size() + meshCellCentres_.size()
+ pyrEdges_.size() + centreEdges_.size() + faceEdges_.size();
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,342 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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
Description
\*---------------------------------------------------------------------------*/
#include "faceDecompIsoSurfaceCuts.H"
#include "volPointInterpolation.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::faceDecompIsoSurfaceCuts::constructEdgeCuts
(
const volScalarField& volField,
const pointScalarField& ptField,
const scalar isoVal,
const scalar tol
)
{
const primitiveMesh& mesh = volField.mesh();
// Intermediate storage for labels of cut edges and cut points
label nBFaces = mesh.nFaces() - mesh.nInternalFaces();
labelHashSet cutCells(nBFaces);
labelHashSet cutVerts(nBFaces);
labelHashSet cutFaceCentres(nBFaces);
labelHashSet cutCellCentres(nBFaces);
DynamicList<label> meshCutEdges(nBFaces);
DynamicList<scalar> meshEdgeWeights(nBFaces);
DynamicList<pyramidEdge> cutPyrEdges(nBFaces);
DynamicList<scalar> pyrEdgeWeights(nBFaces);
DynamicList<faceEdge> cutFaceEdges(nBFaces);
DynamicList<scalar> faceEdgeWeights(nBFaces);
DynamicList<centreEdge> cutCentreEdges(nBFaces);
DynamicList<scalar> centreEdgeWeights(nBFaces);
// Walk over faces
forAll(mesh.faces(), faceI)
{
const face& f = mesh.faces()[faceI];
// Face centre value
scalar fcVal = 0;
forAll(f, fp)
{
fcVal += ptField[f[fp]];
}
fcVal /= f.size();
label ownerI = mesh.faceOwner()[faceI];
label neighbourI = -1;
if (mesh.isInternalFace(faceI))
{
neighbourI = mesh.faceNeighbour()[faceI];
}
scalar weight;
//
// Check faceCentre-cellCentre crossing for owner and neigbour
//
if (crosses(isoVal, fcVal, volField[ownerI], weight))
{
mark(ownerI, cutCells);
if (weight < tol)
{
mark(faceI, cutFaceCentres);
}
else if (weight > 1-tol)
{
mark(ownerI, cutCellCentres);
}
else
{
cutCentreEdges.append(centreEdge(faceI, true));
centreEdgeWeights.append(weight);
}
}
if (neighbourI != -1)
{
if (crosses(isoVal, fcVal, volField[neighbourI], weight))
{
mark(neighbourI, cutCells);
if (weight < tol)
{
mark(faceI, cutFaceCentres);
}
else if (weight > 1-tol)
{
mark(neighbourI, cutCellCentres);
}
else
{
cutCentreEdges.append(centreEdge(faceI, false));
centreEdgeWeights.append(weight);
}
}
}
forAll(f, fp)
{
//
// Check face internal (faceEdge) edge crossing
//
if (crosses(isoVal, ptField[f[fp]], fcVal, weight))
{
mark(ownerI, cutCells);
if (neighbourI != -1)
{
mark(neighbourI, cutCells);
}
if (weight < tol)
{
mark(f[fp], cutVerts);
}
else if (weight > 1-tol)
{
mark(faceI, cutFaceCentres);
}
else
{
cutFaceEdges.append(faceEdge(faceI, fp));
faceEdgeWeights.append(weight);
}
}
}
}
// Walk over all mesh points
forAll(mesh.points(), pointI)
{
const labelList& myCells = mesh.pointCells()[pointI];
forAll(myCells, myCellI)
{
label cellI = myCells[myCellI];
//
// Check pyramid edge crossing
//
scalar weight;
if (crosses(isoVal, ptField[pointI], volField[cellI], weight))
{
mark(cellI, cutCells);
if (weight < tol)
{
mark(pointI, cutVerts);
}
else if (weight > 1-tol)
{
mark(cellI, cutCellCentres);
}
else
{
cutPyrEdges.append(pyramidEdge(pointI, cellI));
pyrEdgeWeights.append(weight);
}
}
}
}
// Walk over all mesh edges
forAll(mesh.edges(), edgeI)
{
const edge& e = mesh.edges()[edgeI];
scalar weight;
if (crosses(isoVal, ptField[e.start()], ptField[e.end()], weight))
{
mark(mesh.edgeCells()[edgeI], cutCells);
if (weight < tol)
{
mark(e.start(), cutVerts);
}
else if (weight > 1-tol)
{
mark(e.end(), cutVerts);
}
else
{
meshCutEdges.append(edgeI);
meshEdgeWeights.append(weight);
}
}
}
meshCutEdges.shrink();
meshEdgeWeights.shrink();
cutPyrEdges.shrink();
pyrEdgeWeights.shrink();
cutFaceEdges.shrink();
faceEdgeWeights.shrink();
cutCentreEdges.shrink();
centreEdgeWeights.shrink();
// Tranfer lists to faceDecompCuts
cells_ = cutCells.toc();
meshVerts_ = cutVerts.toc();
meshFaceCentres_ = cutFaceCentres.toc();
meshCellCentres_ = cutCellCentres.toc();
meshEdges_.transfer(meshCutEdges);
meshEdgeWeights_.transfer(meshEdgeWeights);
pyrEdges_.transfer(cutPyrEdges);
pyrEdgeWeights_.transfer(pyrEdgeWeights);
faceEdges_.transfer(cutFaceEdges);
faceEdgeWeights_.transfer(faceEdgeWeights);
centreEdges_.transfer(cutCentreEdges);
centreEdgeWeights_.transfer(centreEdgeWeights);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::faceDecompIsoSurfaceCuts::faceDecompIsoSurfaceCuts
(
const volScalarField& volField,
const pointScalarField& ptField,
const scalar isoVal,
const scalar tol
)
:
faceDecompCuts
(
volField.mesh(),
labelList(),
labelList(),
labelList(),
labelList(),
labelList(), // mesh edges
scalarField(),
List<pyramidEdge>(), // pyramid edges
scalarField(),
List<faceEdge>(), // face edges
scalarField(),
List<centreEdge>(), // cell centre edges
scalarField()
)
{
constructEdgeCuts(volField, ptField, isoVal, tol);
}
// Construct from interpolator and field (does interpolation)
Foam::faceDecompIsoSurfaceCuts::faceDecompIsoSurfaceCuts
(
const volScalarField& volField,
const volPointInterpolation& pInterp,
const scalar isoVal,
const scalar tol
)
:
faceDecompCuts
(
volField.mesh(),
labelList(),
labelList(),
labelList(),
labelList(),
labelList(), // mesh edges
scalarField(),
List<pyramidEdge>(), // pyramid edges
scalarField(),
List<faceEdge>(), // face edges
scalarField(),
List<centreEdge>(), // cell centre edges
scalarField()
)
{
// Get field on vertices
tmp<pointScalarField> tptField = pInterp.interpolate(volField);
const pointScalarField& ptField = tptField();
constructEdgeCuts(volField, ptField, isoVal, tol);
}
// ************************************************************************* //

View File

@ -1,102 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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::faceDecompIsoSurfaceCuts
Description
List of triangles based on isoSurface reconstruction on faceDecomp mesh.
SourceFiles
faceDecompIsoSurfaceCuts.C
\*---------------------------------------------------------------------------*/
#ifndef faceDecompIsoSurfaceCuts_H
#define faceDecompIsoSurfaceCuts_H
#include "faceDecompCuts.H"
#include "labelHashSet.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class volPointInterpolation;
/*---------------------------------------------------------------------------*\
Class faceDecompIsoSurfaceCuts Declaration
\*---------------------------------------------------------------------------*/
class faceDecompIsoSurfaceCuts
:
public faceDecompCuts
{
// Private Member Functions
//- Do all the hard work: determine edge crossings
void constructEdgeCuts
(
const volScalarField&,
const pointScalarField&,
const scalar isoVal,
const scalar tol
);
public:
// Constructors
//- Construct from field on cells and field on vertices
faceDecompIsoSurfaceCuts
(
const volScalarField&,
const pointScalarField&,
const scalar isoVal,
const scalar tol
);
//- Construct from interpolator and field (does interpolation)
faceDecompIsoSurfaceCuts
(
const volScalarField&,
const volPointInterpolation&,
const scalar isoVal,
const scalar tol
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,109 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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
Description
\*---------------------------------------------------------------------------*/
#include "meshEdgeCuts.H"
// * * * * * * * * * * * * * Private Static Functions * * * * * * * * * * * //
void Foam::meshEdgeCuts::mark(const label elem, labelHashSet& markedElems)
{
labelHashSet::const_iterator iter = markedElems.find(elem);
if (iter == markedElems.end())
{
markedElems.insert(elem);
}
}
void Foam::meshEdgeCuts::mark
(
const labelList& elems,
labelHashSet& markedElems
)
{
forAll(elems, elemI)
{
mark(elems[elemI], markedElems);
}
}
bool Foam::meshEdgeCuts::crosses
(
const scalar isoVal,
const scalar val0,
const scalar val1,
scalar& weight
)
{
if
(
((val0 <= isoVal) && (val1 >= isoVal))
|| ((val1 <= isoVal) && (val0 >= isoVal))
)
{
if (val0 == val1)
{
return false;
}
else
{
weight = (isoVal - val0)/((val1 - val0) + VSMALL);
return true;
}
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::meshEdgeCuts::meshEdgeCuts
(
const primitiveMesh& mesh,
const labelList& cells,
const labelList& meshVerts,
const labelList& meshEdges,
const scalarField& meshEdgeWeights
)
:
mesh_(mesh),
cells_(cells),
meshVerts_(meshVerts),
meshEdges_(meshEdges),
meshEdgeWeights_(meshEdgeWeights)
{}
// ************************************************************************* //

View File

@ -1,161 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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::meshEdgeCuts
Description
Container for cuts of edges of mesh. Cuts either exactly through existing
vertices or through edges.
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef meshEdgeCuts_H
#define meshEdgeCuts_H
#include "labelList.H"
#include "labelHashSet.H"
#include "scalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class primitiveMesh;
/*---------------------------------------------------------------------------*\
Class meshEdgeCuts Declaration
\*---------------------------------------------------------------------------*/
class meshEdgeCuts
{
// Private data
const primitiveMesh& mesh_;
// Private Member Functions
//- Disallow default bitwise copy construct
meshEdgeCuts(const meshEdgeCuts&);
//- Disallow default bitwise assignment
void operator=(const meshEdgeCuts&);
protected:
//- List of cells containing the cuts
labelList cells_;
//- Points exactly cut by cuts
labelList meshVerts_;
//- List of edge labels cut
labelList meshEdges_;
//- Positions on edges
scalarField meshEdgeWeights_;
// Protected Static Functions
//- Mark element in a hashSet
static void mark(const label elem, labelHashSet& markedElems);
//- Mark list of elements in a hashSet
static void mark(const labelList& elems, labelHashSet& markedElems);
//- Return true and set weight if linear interpolation between
// val0 and val1 crosses isoVal. weight=1 if isoVal==val1
static bool crosses
(
const scalar isoVal,
const scalar val0,
const scalar val1,
scalar& weight
);
public:
// Constructors
//- Construct from components
meshEdgeCuts
(
const primitiveMesh& mesh,
const labelList& cells,
const labelList& meshVerts,
const labelList& meshEdges,
const scalarField& meshEdgeWeights
);
// Member Functions
const primitiveMesh& mesh() const
{
return mesh_;
}
const labelList& cells() const
{
return cells_;
}
const labelList& meshVerts() const
{
return meshVerts_;
}
const labelList& meshEdges() const
{
return meshEdges_;
}
const scalarField& meshEdgeWeights() const
{
return meshEdgeWeights_;
}
label size() const
{
return meshVerts_.size() + meshEdges_.size();
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,132 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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
Description
\*---------------------------------------------------------------------------*/
#include "cellAddressing.H"
#include "labelHashSet.H"
#include "cellModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
Foam::labelList Foam::cellAddressing::makeIdentity(const label size)
{
labelList result(size);
forAll(result, resultI)
{
result[resultI] = resultI;
}
return result;
}
Foam::label Foam::cellAddressing::findEdge(const edge& e)
{
forAll(edges_, edgeI)
{
if (edges_[edgeI] == e)
{
return edgeI;
}
}
FatalErrorIn
(
"cellAddressing::findEdge(const edge&)"
) << "Problem: cannot find edge " << e << " in edges " << edges_
<< exit(FatalError);
return -1;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::cellAddressing::cellAddressing(const Foam::cellModel& model)
:
modelFaces_(model.modelFaces()),
edges_(model.edges(makeIdentity(model.nPoints()))),
edgeFaces_(model.nEdges()),
faceEdges_(model.nFaces()),
pointEdges_(model.nPoints())
{
List<labelHashSet > dynEdgeFaces(edgeFaces_.size());
forAll(faceEdges_, faceI)
{
DynamicList<label> fEdges;
const face& f = modelFaces_[faceI];
forAll(f, fp)
{
label edgeI = findEdge(edge(f[fp], f[(fp+1)%f.size()]));
// Append to faceEdges
fEdges.append(edgeI);
// Append to edgefaces
labelHashSet& eFaces = dynEdgeFaces[edgeI];
if (!eFaces.found(faceI))
{
eFaces.insert(faceI);
}
}
fEdges.shrink();
// Copy into faceEdges_
faceEdges_[faceI].transfer(fEdges.shrink());
}
// Convert dynEdgeFaces into edgeFaces_
forAll(dynEdgeFaces, edgeI)
{
edgeFaces_[edgeI] = dynEdgeFaces[edgeI].toc();
}
// Convert edges_ into pointEdges
List<DynamicList<label> > dynPointEdges(model.nPoints());
forAll(edges_, edgeI)
{
const edge& e = edges_[edgeI];
dynPointEdges[e.start()].append(edgeI);
dynPointEdges[e.end()].append(edgeI);
}
forAll(dynPointEdges, pointI)
{
pointEdges_[pointI].transfer(dynPointEdges[pointI].shrink());
}
}
// ************************************************************************* //

View File

@ -1,145 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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::cellAddressing
Description
Additional addressing for a cellModel. (cellModel themselves only
contain cell-points). Used in cellFeatures class.
SourceFiles
cellAddressing.C
\*---------------------------------------------------------------------------*/
#ifndef cellAddressing_H
#define cellAddressing_H
#include "cellModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class cellModel;
/*---------------------------------------------------------------------------*\
Class cellAddressing Declaration
\*---------------------------------------------------------------------------*/
class cellAddressing
{
// Private data
faceList modelFaces_;
edgeList edges_;
labelListList edgeFaces_;
labelListList faceEdges_;
labelListList pointEdges_;
// Private static functions
static labelList makeIdentity(const label size);
// Private static functions
label findEdge(const edge& e);
public:
// Constructors
//- Construct from components
cellAddressing(const cellModel& model);
// Destructor
// Member Functions
// Access
inline const faceList& modelFaces() const
{
return modelFaces_;
}
inline const edgeList& edges() const
{
return edges_;
}
inline const labelListList& edgeFaces() const
{
return edgeFaces_;
}
inline const labelListList& faceEdges() const
{
return faceEdges_;
}
inline const labelListList& pointEdges() const
{
return pointEdges_;
}
// Check
// Edit
// Write
// Member Operators
// Friend Functions
// Friend Operators
// IOstream Operators
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//#include "cellAddressingI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,209 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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::meshCutSurface
Description
Description of surface resulting from cuts through mesh. Region on
labelledTris is the cell the triangle is resulting from.
SourceFiles
meshCutSurface.C
\*---------------------------------------------------------------------------*/
#ifndef meshCutSurface_H
#define meshCutSurface_H
#include "labelList.H"
#include "HashTable.H"
#include "pointField.H"
#include "triSurface.H"
#include "boolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class primitiveMesh;
class cellAddressing;
class faceDecompCuts;
class cellDecompCuts;
/*---------------------------------------------------------------------------*\
Class meshCutSurface Declaration
\*---------------------------------------------------------------------------*/
class meshCutSurface
:
public triSurface
{
// Static data members
//- Symbolic names of tet vertices
static label FP0;
static label FC;
static label FP1;
static label CC;
//- Symbolic names of tet edges
static label FP0_FC;
static label FP0_FP1;
static label FP0_CC;
static label FC_CC;
static label FC_FP1;
static label FP1_CC;
// Private Static Functions
//- Find key in hashtable. Returns value or -1 if not found
template<class T, class Hash>
static label find
(
const HashTable<label, T, Hash>& table,
const T& key
);
//- Find edge in subset edgeLabels of edges.
static label findEdge
(
const edgeList& edges,
const labelList& edgeLabels,
const edge& e
);
//- Find the other (i.e. not cutEdgeI) cut-edge on faceI of cell model
static label findCutEdge
(
const cellAddressing& model,
const labelList& tetEdgeCuts,
const label faceI,
const label cutEdgeI
);
// Private Member Functions
//- Remove duplicate faces (resulting from 3 meshVerts cut - is seen
// from both sides)
static triSurface removeDuplicates(const triSurface& surf);
public:
//- Generic tet cutting routine.
// Generate triangles given the cut vertices and edges of the tet.
// (Triangles can be incorrectly oriented)
void cutTet
(
const cellAddressing& model,
const labelList& tetVertCuts,
const labelList& tetEdgeCuts,
const label cellI,
List<labelledTri>& tris,
label& triI
);
//- Tet cutting when cuts are only through edges.
void cutTetThroughEdges
(
const cellAddressing& model,
const labelList& tetEdgeCuts,
const label nEdgeCuts,
const label cellI,
List<labelledTri>& tris,
label& triI
);
//- Tet cutting when cuts are through corner vertices (and possibly
// edges)
void cutTetThroughVerts
(
const cellAddressing& model,
const labelList& tetVertCuts,
const label nVertCuts,
const labelList& tetEdgeCuts,
const label nEdgeCuts,
const label cellI,
List<labelledTri>& tris,
label& triI
);
// Static functions
//- Interpolate onto points given edge weights, cell centre values,
// face centre values and vertex values
template <class T>
static tmp<Field<T> > interpolate
(
const faceDecompCuts& cuts,
const Field<T>& vField,
const Field<T>& fField,
const Field<T>& pField
);
//- Interpolate onto points given edge weights, cell centre values,
// and vertex values
template <class T>
static tmp<Field<T> > interpolate
(
const cellDecompCuts& cuts,
const Field<T>& vField,
const Field<T>& pField
);
// Constructors
//- Construct from cuts on faceDecomp tet decomposition
// (introduces cellcentres and facecentres)
meshCutSurface(const faceDecompCuts& cuts);
//- Construct from cuts on cellDecomp tet decomposition
// (introduces cellcentres but not facecentres)
meshCutSurface(const cellDecompCuts& cuts);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "meshCutSurfaceInterpolate.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,174 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 "meshCutSurface.H"
#include "pyramidEdge.H"
#include "faceEdge.H"
#include "centreEdge.H"
#include "diagonalEdge.H"
#include "faceDecompCuts.H"
#include "cellDecompCuts.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template <class T>
Foam::tmp<Foam::Field<T> > Foam::meshCutSurface::interpolate
(
const faceDecompCuts& cuts,
const Field<T>& vField,
const Field<T>& fField,
const Field<T>& pField
)
{
const primitiveMesh& mesh = cuts.mesh();
tmp<Field<T> > tvals(new Field<T>(cuts.size()));
Field<T>& vals = tvals();
label pointI = 0;
forAll(cuts.meshVerts(), cutVertI)
{
vals[pointI++] = pField[cuts.meshVerts()[cutVertI]];
}
forAll(cuts.meshFaceCentres(), cutFaceCentreI)
{
label faceI = cuts.meshFaceCentres()[cutFaceCentreI];
vals[pointI++] = fField[faceI];
}
forAll(cuts.meshCellCentres(), cutCellCentreI)
{
label cellI = cuts.meshCellCentres()[cutCellCentreI];
vals[pointI++] = vField[cellI];
}
forAll(cuts.meshEdges(), meshCutSurfaceEdgeI)
{
label edgeI = cuts.meshEdges()[meshCutSurfaceEdgeI];
const edge& e = mesh.edges()[edgeI];
scalar weight = cuts.meshEdgeWeights()[meshCutSurfaceEdgeI];
vals[pointI++] = weight*pField[e.start()] + (1-weight)*pField[e.end()];
}
forAll(cuts.pyrEdges(), edgeI)
{
const pyramidEdge& e = cuts.pyrEdges()[edgeI];
scalar weight = cuts.pyrEdgeWeights()[edgeI];
vals[pointI++] = e.interpolate(vField, pField, weight);
}
forAll(cuts.centreEdges(), edgeI)
{
const centreEdge& e = cuts.centreEdges()[edgeI];
scalar weight = cuts.centreEdgeWeights()[edgeI];
vals[pointI++] = e.interpolate(mesh, vField, fField, weight);
}
forAll(cuts.faceEdges(), edgeI)
{
const faceEdge& e = cuts.faceEdges()[edgeI];
scalar weight = cuts.faceEdgeWeights()[edgeI];
vals[pointI++] = e.interpolate(mesh, fField, pField, weight);
}
return tvals;
}
template <class T>
Foam::tmp<Foam::Field<T> > Foam::meshCutSurface::interpolate
(
const cellDecompCuts& cuts,
const Field<T>& vField,
const Field<T>& pField
)
{
const primitiveMesh& mesh = cuts.mesh();
tmp<Field<T> > tvals(new Field<T>(cuts.size()));
Field<T>& vals = tvals();
label pointI = 0;
forAll(cuts.meshVerts(), cutVertI)
{
vals[pointI++] = pField[cuts.meshVerts()[cutVertI]];
}
forAll(cuts.meshCellCentres(), cutCellCentreI)
{
label cellI = cuts.meshCellCentres()[cutCellCentreI];
vals[pointI++] = vField[cellI];
}
forAll(cuts.meshEdges(), meshCutSurfaceEdgeI)
{
label edgeI = cuts.meshEdges()[meshCutSurfaceEdgeI];
const edge& e = mesh.edges()[edgeI];
scalar weight = cuts.meshEdgeWeights()[meshCutSurfaceEdgeI];
vals[pointI++] = weight*pField[e.start()] + (1-weight)*pField[e.end()];
}
forAll(cuts.pyrEdges(), edgeI)
{
const pyramidEdge& e = cuts.pyrEdges()[edgeI];
scalar weight = cuts.pyrEdgeWeights()[edgeI];
vals[pointI++] = e.interpolate(vField, pField, weight);
}
forAll(cuts.diagEdges(), edgeI)
{
const diagonalEdge& e = cuts.diagEdges()[edgeI];
scalar weight = cuts.diagEdgeWeights()[edgeI];
vals[pointI++] = e.interpolate(mesh, pField, weight);
}
return tvals;
}
// ************************************************************************* //

View File

@ -1,187 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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::centreEdge
Description
Implicit description of faceCentre to cellCentre edge
(from tet decomposition).
Stores
- face label
- whether in owner or neighbour of face
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef centreEdge_H
#define centreEdge_H
#include "label.H"
#include "primitiveMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
/*---------------------------------------------------------------------------*\
Class centreEdge Declaration
\*---------------------------------------------------------------------------*/
class centreEdge
{
// Private data
//- face label
label faceLabel_;
//- is in owner or neighbour of face
bool inOwner_;
public:
// Public classes
//- Hash function
class centreEdgeHash
{
public:
centreEdgeHash()
{}
//- simple hashing function of labels
label operator()(const centreEdge& ce, const label tableSize) const
{
return (ce.faceLabel() + ce.inOwner()) % tableSize;
}
};
// Constructors
//- Construct null
inline centreEdge()
:
faceLabel_(-1),
inOwner_(-1)
{}
//- Construct from components
inline centreEdge(const label faceLabel, const bool inOwner)
:
faceLabel_(faceLabel),
inOwner_(inOwner)
{}
// Member Functions
label faceLabel() const
{
return faceLabel_;
}
bool inOwner() const
{
return inOwner_;
}
template <class T>
T interpolate
(
const primitiveMesh& mesh,
const Field<T>& cellField,
const Field<T>& faceField,
const scalar weight
) const
{
label cellI;
if (inOwner_)
{
cellI = mesh.faceOwner()[faceLabel_];
}
else
{
cellI = mesh.faceNeighbour()[faceLabel_];
}
return
(1-weight)*faceField[faceLabel_]
+ weight*cellField[cellI];
}
point coord(const primitiveMesh& mesh, const scalar weight) const
{
return interpolate
(
mesh,
mesh.cellCentres(),
mesh.faceCentres(),
weight
);
}
// Member Operators
bool operator==(const centreEdge& ce) const
{
return
(faceLabel() == ce.faceLabel())
&& (inOwner() == ce.inOwner());
}
// IOstream Operators
inline friend Ostream& operator<<(Ostream& os, const centreEdge& ce)
{
os << token::BEGIN_LIST
<< ce.faceLabel_ << token::SPACE
<< ce.inOwner_
<< token::END_LIST;
// Check state of Ostream
os.check("Ostream& operator<<(Ostream&, const centreEdge&)");
return os;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,199 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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::diagonalEdge
Description
Implicit description of diagonal edge (from tet decomposition).
Diangonal edge is edge between two vertices of same face.
Stores
- face label
- indices in face
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef diagonalEdge_H
#define diagonalEdge_H
#include "label.H"
#include "primitiveMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class diagonalEdge Declaration
\*---------------------------------------------------------------------------*/
class diagonalEdge
{
// Private data
//- face label
label faceLabel_;
//- index in face
label faceIndex0_;
//- index in face
label faceIndex1_;
public:
// Public classes
//- Hash function
class diagonalEdgeHash
{
public:
diagonalEdgeHash()
{}
//- simple hashing function of labels. Commutative on face indices
// since edge is same.
label operator()(const diagonalEdge& de, const label tableSize)
const
{
// Note: mag since multiply might overflow and produce
// negative numbers
return
mag
(
de.faceLabel()
+ (de.faceLabel()*de.faceLabel())
+ de.faceIndex0() * de.faceIndex1()
+ (de.faceIndex0() + de.faceIndex1())
)
% tableSize;
}
};
// Constructors
//- Construct null
inline diagonalEdge()
:
faceLabel_(-1),
faceIndex0_(-1),
faceIndex1_(-1)
{}
//- Construct from components
inline diagonalEdge
(
const label faceLabel,
const label faceIndex0,
const label faceIndex1
)
:
faceLabel_(faceLabel),
faceIndex0_(faceIndex0),
faceIndex1_(faceIndex1)
{}
// Member Functions
label faceLabel() const
{
return faceLabel_;
}
label faceIndex0() const
{
return faceIndex0_;
}
label faceIndex1() const
{
return faceIndex1_;
}
template <class T>
T interpolate
(
const primitiveMesh& mesh,
const Field<T>& vertField,
const scalar weight
) const
{
const face& f = mesh.faces()[faceLabel_];
return
(1-weight)*vertField[f[faceIndex0_]]
+ weight*vertField[f[faceIndex1_]];
}
point coord(const primitiveMesh& mesh, const scalar weight) const
{
return interpolate(mesh, mesh.points(), weight);
}
// Member Operators
bool operator==(const diagonalEdge& de) const
{
return
(faceLabel() == de.faceLabel())
&& (faceIndex0() == de.faceIndex0())
&& (faceIndex1() == de.faceIndex1());
}
// IOstream Operators
inline friend Ostream& operator<<(Ostream& os, const diagonalEdge& de)
{
os << token::BEGIN_LIST
<< de.faceLabel_ << token::SPACE
<< de.faceIndex0_ << token::SPACE
<< de.faceIndex1_
<< token::END_LIST;
// Check state of Ostream
os.check("Ostream& operator<<(Ostream&, const diagonalEdge&)");
return os;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,186 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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::faceEdge
Description
Implicit description of face edge (from tet decomposition).
Face edge is edge between vertex of face and face centre.
Stores
- face label
- index in face (gives the mesh vertex)
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef faceEdge_H
#define faceEdge_H
#include "label.H"
#include "primitiveMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
/*---------------------------------------------------------------------------*\
Class faceEdge Declaration
\*---------------------------------------------------------------------------*/
class faceEdge
{
// Private data
//- face label
label faceLabel_;
//- index in face
label faceIndex_;
public:
// Public classes
//- Hash function
class faceEdgeHash
{
public:
faceEdgeHash()
{}
//- simple hashing function of labels
label operator()(const faceEdge& fe, const label tableSize)
const
{
// Note: mag since multiply might overflow and produce
// negative numbers
return
mag
(
fe.faceLabel()
+ (fe.faceLabel() * fe.faceLabel())
+ fe.faceIndex()
+ (fe.faceIndex() * fe.faceIndex())
)
% tableSize;
}
};
// Constructors
//- Construct null
inline faceEdge()
:
faceLabel_(-1),
faceIndex_(-1)
{}
//- Construct from components
inline faceEdge(const label faceLabel, const label faceIndex)
:
faceLabel_(faceLabel),
faceIndex_(faceIndex)
{}
// Member Functions
label faceLabel() const
{
return faceLabel_;
}
label faceIndex() const
{
return faceIndex_;
}
template <class T>
T interpolate
(
const primitiveMesh& mesh,
const Field<T>& faceField,
const Field<T>& vertField,
const scalar weight
) const
{
const face& f = mesh.faces()[faceLabel_];
return
(1-weight)*vertField[f[faceIndex_]]
+ weight*faceField[faceLabel_];
}
point coord(const primitiveMesh& mesh, const scalar weight) const
{
return interpolate(mesh, mesh.faceCentres(), mesh.points(), weight);
}
// Member Operators
bool operator==(const faceEdge& fe) const
{
return
(faceLabel() == fe.faceLabel())
&& (faceIndex() == fe.faceIndex());
}
// IOstream Operators
inline friend Ostream& operator<<(Ostream& os, const faceEdge& fe)
{
os << token::BEGIN_LIST
<< fe.faceLabel_ << token::SPACE
<< fe.faceIndex_
<< token::END_LIST;
// Check state of Ostream
os.check("Ostream& operator<<(Ostream&, const faceEdge&)");
return os;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,185 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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::pyramidEdge
Description
Implicit description of pyramid edge (from tet decomposition).
Pyramid edge is edge between mesh vertex and cell centre.
Stores
- vertex label
- cell label
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef pyramidEdge_H
#define pyramidEdge_H
#include "label.H"
#include "primitiveMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
/*---------------------------------------------------------------------------*\
Class pyramidEdge Declaration
\*---------------------------------------------------------------------------*/
class pyramidEdge
{
// Private data
//- vertex label
label vertexLabel_;
//- cell label
label cellLabel_;
public:
// Public classes
//- Hash function
class pyramidEdgeHash
{
public:
pyramidEdgeHash()
{}
//- simple hashing function of labels
label operator()(const pyramidEdge& pe, const label tableSize) const
{
// Note: mag since multiply might overflow and produce
// negative numbers
return
mag
(
pe.vertexLabel()
+ (pe.vertexLabel() * pe.vertexLabel())
+ pe.cellLabel()
+ (pe.cellLabel() * pe.cellLabel())
)
% tableSize;
}
};
// Constructors
//- Construct null
inline pyramidEdge()
:
vertexLabel_(-1),
cellLabel_(-1)
{}
//- Construct from components
inline pyramidEdge
(
const label vertexLabel,
const label cellLabel
)
:
vertexLabel_(vertexLabel),
cellLabel_(cellLabel)
{}
// Member Functions
label vertexLabel() const
{
return vertexLabel_;
}
label cellLabel() const
{
return cellLabel_;
}
template <class T>
T interpolate
(
const Field<T>& cellField,
const Field<T>& vertField,
const scalar weight
) const
{
return
(1-weight)*vertField[vertexLabel_]
+ weight*cellField[cellLabel_];
}
point coord(const primitiveMesh& mesh, const scalar weight) const
{
return interpolate(mesh.cellCentres(), mesh.points(), weight);
}
// Member Operators
bool operator==(const pyramidEdge& pe) const
{
return
(vertexLabel() == pe.vertexLabel())
&& (cellLabel() == pe.cellLabel());
}
// IOstream Operators
inline friend Ostream& operator<<(Ostream& os, const pyramidEdge& pe)
{
os << token::BEGIN_LIST
<< pe.vertexLabel_ << token::SPACE
<< pe.cellLabel_
<< token::END_LIST;
// Check state of Ostream
os.check("Ostream& operator<<(Ostream&, const pyramidEdge&)");
return os;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //