STYLE: consistency for usage of GeoMesh

- add const qualifiers on C() methods
This commit is contained in:
Mark Olesen
2021-05-01 18:21:52 +02:00
parent 662bed74f6
commit 91ede9957c
13 changed files with 126 additions and 107 deletions

View File

@ -48,10 +48,9 @@ namespace Foam
template<class MESH> template<class MESH>
class GeoMesh class GeoMesh
{ {
protected: protected:
// Protected data // Protected Data
//- Reference to Mesh //- Reference to Mesh
const MESH& mesh_; const MESH& mesh_;
@ -59,7 +58,7 @@ protected:
public: public:
// Public typedefs // Public Typedefs
typedef MESH Mesh; typedef MESH Mesh;
typedef typename MESH::BoundaryMesh BoundaryMesh; typedef typename MESH::BoundaryMesh BoundaryMesh;
@ -67,7 +66,7 @@ public:
// Constructors // Constructors
//- Construct from MESH //- Construct from mesh reference
explicit GeoMesh(const MESH& mesh) explicit GeoMesh(const MESH& mesh)
: :
mesh_(mesh) mesh_(mesh)
@ -91,7 +90,7 @@ public:
// Member Operators // Member Operators
//- Return reference to polyMesh //- Return reference to the underlying mesh
const MESH& operator()() const const MESH& operator()() const
{ {
return mesh_; return mesh_;

View File

@ -93,18 +93,18 @@ public:
// Member Functions // Member Functions
//- Return number of points //- Return size. Number of points
label size() const
{
return size(*this);
}
//- Return number of points
static label size(const Mesh& mesh) static label size(const Mesh& mesh)
{ {
return mesh.GeoMesh<polyMesh>::mesh_.nPoints(); return mesh.GeoMesh<polyMesh>::mesh_.nPoints();
} }
//- Return size. Number of points
label size() const
{
return size(*this);
}
//- Return reference to boundary mesh //- Return reference to boundary mesh
const pointBoundaryMesh& boundary() const const pointBoundaryMesh& boundary() const
{ {

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -54,25 +55,33 @@ class areaMesh
: :
public GeoMesh<faMesh> public GeoMesh<faMesh>
{ {
public: public:
// Constructors
//- Construct finite-area mesh from faMesh reference
explicit areaMesh(const faMesh& mesh) explicit areaMesh(const faMesh& mesh)
: :
GeoMesh<faMesh>(mesh) GeoMesh<faMesh>(mesh)
{} {}
label size() const
{
return size(mesh_);
}
// Member Functions
//- Return size. Number of faces
static label size(const Mesh& mesh) static label size(const Mesh& mesh)
{ {
return mesh.nFaces(); return mesh.nFaces();
} }
const areaVectorField& C() //- Return size. Number of faces
label size() const
{
return size(mesh_);
}
//- Field of face centres
const areaVectorField& C() const
{ {
return mesh_.areaCentres(); return mesh_.areaCentres();
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -54,25 +55,32 @@ class edgeMesh
: :
public GeoMesh<faMesh> public GeoMesh<faMesh>
{ {
public: public:
// Constructors
//- Construct finite-area edge mesh faMesh reference
explicit edgeMesh(const faMesh& mesh) explicit edgeMesh(const faMesh& mesh)
: :
GeoMesh<faMesh>(mesh) GeoMesh<faMesh>(mesh)
{} {}
label size() const // Member Functions
{
return size(mesh_);
}
//- Return size. Number of internal edges
static label size(const Mesh& mesh) static label size(const Mesh& mesh)
{ {
return mesh.nInternalEdges(); return mesh.nInternalEdges();
} }
const edgeVectorField& C() //- Return size. Number of internal edges
label size() const
{
return size(mesh_);
}
//- Field of edge centres
const edgeVectorField& C() const
{ {
return mesh_.edgeCentres(); return mesh_.edgeCentres();
} }

View File

@ -51,25 +51,33 @@ class surfaceMesh
: :
public GeoMesh<fvMesh> public GeoMesh<fvMesh>
{ {
public: public:
// Constructors
//- Construct surface mesh from fvMesh reference
explicit surfaceMesh(const fvMesh& mesh) explicit surfaceMesh(const fvMesh& mesh)
: :
GeoMesh<fvMesh>(mesh) GeoMesh<fvMesh>(mesh)
{} {}
label size() const
{
return size(mesh_);
}
// Member Functions
//- Return size. Number of internal faces
static label size(const Mesh& mesh) static label size(const Mesh& mesh)
{ {
return mesh.nInternalFaces(); return mesh.nInternalFaces();
} }
const surfaceVectorField& C() //- Return size. Number of internal faces
label size() const
{
return size(mesh_);
}
//- Field of face centres
const surfaceVectorField& C() const
{ {
return mesh_.Cf(); return mesh_.Cf();
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -65,20 +66,20 @@ public:
// Member Functions // Member Functions
//- Return size //- Return size. Number of cells
static label size(const Mesh& mesh) static label size(const Mesh& mesh)
{ {
return mesh.nCells(); return mesh.nCells();
} }
//- Return size //- Return size. Number of cells
label size() const label size() const
{ {
return size(mesh_); return size(mesh_);
} }
//- Return cell centres //- Field of cell centres
const volVectorField& C() const volVectorField& C() const
{ {
return mesh_.C(); return mesh_.C();
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -63,13 +63,13 @@ public:
// Member Functions // Member Functions
//- Return size //- Return size. Number of cells
static label size(const polyMesh& mesh) static label size(const Mesh& mesh)
{ {
return mesh.nCells(); return mesh.nCells();
} }
//- Return size //- Return size. Number of cells
label size() const label size() const
{ {
return size(mesh_); return size(mesh_);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -63,13 +63,13 @@ public:
// Member Functions // Member Functions
//- Return size //- Return size. Number of faces
static label size(const polySurface& mesh) static label size(const Mesh& mesh)
{ {
return mesh.faces().size(); return mesh.nFaces();
} }
//- Return size //- Return size. Number of faces
label size() const label size() const
{ {
return size(mesh_); return size(mesh_);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -63,13 +63,13 @@ public:
// Member Functions // Member Functions
//- Return size //- Return size. Number of points
static label size(const polySurface& mesh) static label size(const Mesh& mesh)
{ {
return mesh.points().size(); return mesh.nPoints();
} }
//- Return size //- Return size. Number of points
label size() const label size() const
{ {
return size(mesh_); return size(mesh_);

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -29,8 +30,6 @@ Class
Description Description
The surfMesh GeoMesh (for holding fields). The surfMesh GeoMesh (for holding fields).
Similar to the volGeoMesh used for the Finite Volume discretization.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef surfGeoMesh_H #ifndef surfGeoMesh_H
@ -52,7 +51,6 @@ class surfGeoMesh
: :
public GeoMesh<surfMesh> public GeoMesh<surfMesh>
{ {
public: public:
// Constructors // Constructors
@ -66,13 +64,13 @@ public:
// Member Functions // Member Functions
//- Return size //- Return size. Number of faces
static label size(const surfMesh& mesh) static label size(const Mesh& mesh)
{ {
return mesh.nFaces(); return mesh.nFaces();
} }
//- Return size //- Return size. Number of faces
label size() const label size() const
{ {
return size(mesh_); return size(mesh_);

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -52,7 +53,6 @@ class surfPointGeoMesh
: :
public GeoMesh<surfMesh> public GeoMesh<surfMesh>
{ {
public: public:
// Constructors // Constructors
@ -66,13 +66,13 @@ public:
// Member Functions // Member Functions
//- Return size //- Return size. Number of points
static label size(const surfMesh& mesh) static label size(const Mesh& mesh)
{ {
return mesh.nPoints(); return mesh.nPoints();
} }
//- Return size //- Return size. Number of points
label size() const label size() const
{ {
return size(mesh_); return size(mesh_);

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,9 +28,7 @@ Class
Foam::triSurfaceGeoMesh Foam::triSurfaceGeoMesh
Description Description
The triSurface GeoMesh (for holding fields). The triSurface GeoMesh (for holding face fields).
Similar to the volGeoMesh used for the Finite Volume discretization.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -50,7 +49,6 @@ class triSurfaceGeoMesh
: :
public GeoMesh<triSurface> public GeoMesh<triSurface>
{ {
public: public:
// Constructors // Constructors
@ -64,20 +62,20 @@ public:
// Member Functions // Member Functions
//- Return size //- Return size. Numer of faces
static label size(const triSurface& mesh) static label size(const Mesh& mesh)
{ {
return mesh.size(); return mesh.size();
} }
//- Return size //- Return size. Numer of faces
label size() const label size() const
{ {
return size(mesh_); return size(mesh_);
} }
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,9 +28,7 @@ Class
Foam::triSurfaceGeoMesh Foam::triSurfaceGeoMesh
Description Description
The triSurface point GeoMesh (for holding vertex fields). The triSurface point GeoMesh (for holding point fields).
Similar to the volMesh used for the Finite Volume discretization.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -50,7 +49,6 @@ class triSurfacePointGeoMesh
: :
public GeoMesh<triSurface> public GeoMesh<triSurface>
{ {
public: public:
// Constructors // Constructors
@ -64,20 +62,20 @@ public:
// Member Functions // Member Functions
//- Return size //- Return size. Number of points
static label size(const triSurface& mesh) static label size(const Mesh& mesh)
{ {
return mesh.points().size(); return mesh.points().size();
} }
//- Return size //- Return size. Number of points
label size() const label size() const
{ {
return size(mesh_); return size(mesh_);
} }
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam