Skip to content
Snippets Groups Projects
Commit 91ede995 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

STYLE: consistency for usage of GeoMesh

- add const qualifiers on C() methods
parent 662bed74
Branches
Tags
No related merge requests found
Showing
with 134 additions and 115 deletions
......@@ -48,10 +48,9 @@ namespace Foam
template<class MESH>
class GeoMesh
{
protected:
// Protected data
// Protected Data
//- Reference to Mesh
const MESH& mesh_;
......@@ -59,7 +58,7 @@ protected:
public:
// Public typedefs
// Public Typedefs
typedef MESH Mesh;
typedef typename MESH::BoundaryMesh BoundaryMesh;
......@@ -67,7 +66,7 @@ public:
// Constructors
//- Construct from MESH
//- Construct from mesh reference
explicit GeoMesh(const MESH& mesh)
:
mesh_(mesh)
......@@ -91,7 +90,7 @@ public:
// Member Operators
//- Return reference to polyMesh
//- Return reference to the underlying mesh
const MESH& operator()() const
{
return mesh_;
......
......@@ -93,16 +93,16 @@ public:
// Member Functions
//- Return number of points
label size() const
//- Return size. Number of points
static label size(const Mesh& mesh)
{
return size(*this);
return mesh.GeoMesh<polyMesh>::mesh_.nPoints();
}
//- Return number of points
static label size(const Mesh& mesh)
//- Return size. Number of points
label size() const
{
return mesh.GeoMesh<polyMesh>::mesh_.nPoints();
return size(*this);
}
//- Return reference to boundary mesh
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -54,28 +55,36 @@ class areaMesh
:
public GeoMesh<faMesh>
{
public:
explicit areaMesh(const faMesh& mesh)
:
GeoMesh<faMesh>(mesh)
{}
label size() const
{
return size(mesh_);
}
static label size(const Mesh& mesh)
{
return mesh.nFaces();
}
const areaVectorField& C()
{
return mesh_.areaCentres();
}
// Constructors
//- Construct finite-area mesh from faMesh reference
explicit areaMesh(const faMesh& mesh)
:
GeoMesh<faMesh>(mesh)
{}
// Member Functions
//- Return size. Number of faces
static label size(const Mesh& mesh)
{
return mesh.nFaces();
}
//- Return size. Number of faces
label size() const
{
return size(mesh_);
}
//- Field of face centres
const areaVectorField& C() const
{
return mesh_.areaCentres();
}
};
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -54,28 +55,35 @@ class edgeMesh
:
public GeoMesh<faMesh>
{
public:
explicit edgeMesh(const faMesh& mesh)
:
GeoMesh<faMesh>(mesh)
{}
label size() const
{
return size(mesh_);
}
static label size(const Mesh& mesh)
{
return mesh.nInternalEdges();
}
const edgeVectorField& C()
{
return mesh_.edgeCentres();
}
// Constructors
//- Construct finite-area edge mesh faMesh reference
explicit edgeMesh(const faMesh& mesh)
:
GeoMesh<faMesh>(mesh)
{}
// Member Functions
//- Return size. Number of internal edges
static label size(const Mesh& mesh)
{
return mesh.nInternalEdges();
}
//- Return size. Number of internal edges
label size() const
{
return size(mesh_);
}
//- Field of edge centres
const edgeVectorField& C() const
{
return mesh_.edgeCentres();
}
};
......
......@@ -51,28 +51,36 @@ class surfaceMesh
:
public GeoMesh<fvMesh>
{
public:
explicit surfaceMesh(const fvMesh& mesh)
:
GeoMesh<fvMesh>(mesh)
{}
label size() const
{
return size(mesh_);
}
static label size(const Mesh& mesh)
{
return mesh.nInternalFaces();
}
const surfaceVectorField& C()
{
return mesh_.Cf();
}
// Constructors
//- Construct surface mesh from fvMesh reference
explicit surfaceMesh(const fvMesh& mesh)
:
GeoMesh<fvMesh>(mesh)
{}
// Member Functions
//- Return size. Number of internal faces
static label size(const Mesh& mesh)
{
return mesh.nInternalFaces();
}
//- Return size. Number of internal faces
label size() const
{
return size(mesh_);
}
//- Field of face centres
const surfaceVectorField& C() const
{
return mesh_.Cf();
}
};
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -65,20 +66,20 @@ public:
// Member Functions
//- Return size
//- Return size. Number of cells
static label size(const Mesh& mesh)
{
return mesh.nCells();
}
//- Return size
//- Return size. Number of cells
label size() const
{
return size(mesh_);
}
//- Return cell centres
const volVectorField& C()
//- Field of cell centres
const volVectorField& C() const
{
return mesh_.C();
}
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -63,13 +63,13 @@ public:
// Member Functions
//- Return size
static label size(const polyMesh& mesh)
//- Return size. Number of cells
static label size(const Mesh& mesh)
{
return mesh.nCells();
}
//- Return size
//- Return size. Number of cells
label size() const
{
return size(mesh_);
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -63,13 +63,13 @@ public:
// Member Functions
//- Return size
static label size(const polySurface& mesh)
//- Return size. Number of faces
static label size(const Mesh& mesh)
{
return mesh.faces().size();
return mesh.nFaces();
}
//- Return size
//- Return size. Number of faces
label size() const
{
return size(mesh_);
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -63,13 +63,13 @@ public:
// Member Functions
//- Return size
static label size(const polySurface& mesh)
//- Return size. Number of points
static label size(const Mesh& mesh)
{
return mesh.points().size();
return mesh.nPoints();
}
//- Return size
//- Return size. Number of points
label size() const
{
return size(mesh_);
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -29,8 +30,6 @@ Class
Description
The surfMesh GeoMesh (for holding fields).
Similar to the volGeoMesh used for the Finite Volume discretization.
\*---------------------------------------------------------------------------*/
#ifndef surfGeoMesh_H
......@@ -52,7 +51,6 @@ class surfGeoMesh
:
public GeoMesh<surfMesh>
{
public:
// Constructors
......@@ -66,13 +64,13 @@ public:
// Member Functions
//- Return size
static label size(const surfMesh& mesh)
//- Return size. Number of faces
static label size(const Mesh& mesh)
{
return mesh.nFaces();
}
//- Return size
//- Return size. Number of faces
label size() const
{
return size(mesh_);
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -52,7 +53,6 @@ class surfPointGeoMesh
:
public GeoMesh<surfMesh>
{
public:
// Constructors
......@@ -66,13 +66,13 @@ public:
// Member Functions
//- Return size
static label size(const surfMesh& mesh)
//- Return size. Number of points
static label size(const Mesh& mesh)
{
return mesh.nPoints();
}
//- Return size
//- Return size. Number of points
label size() const
{
return size(mesh_);
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -27,9 +28,7 @@ Class
Foam::triSurfaceGeoMesh
Description
The triSurface GeoMesh (for holding fields).
Similar to the volGeoMesh used for the Finite Volume discretization.
The triSurface GeoMesh (for holding face fields).
\*---------------------------------------------------------------------------*/
......@@ -50,7 +49,6 @@ class triSurfaceGeoMesh
:
public GeoMesh<triSurface>
{
public:
// Constructors
......@@ -64,20 +62,20 @@ public:
// Member Functions
//- Return size
static label size(const triSurface& mesh)
//- Return size. Numer of faces
static label size(const Mesh& mesh)
{
return mesh.size();
}
//- Return size
//- Return size. Numer of faces
label size() const
{
return size(mesh_);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -27,9 +28,7 @@ Class
Foam::triSurfaceGeoMesh
Description
The triSurface point GeoMesh (for holding vertex fields).
Similar to the volMesh used for the Finite Volume discretization.
The triSurface point GeoMesh (for holding point fields).
\*---------------------------------------------------------------------------*/
......@@ -50,7 +49,6 @@ class triSurfacePointGeoMesh
:
public GeoMesh<triSurface>
{
public:
// Constructors
......@@ -64,20 +62,20 @@ public:
// Member Functions
//- Return size
static label size(const triSurface& mesh)
//- Return size. Number of points
static label size(const Mesh& mesh)
{
return mesh.points().size();
}
//- Return size
//- Return size. Number of points
label size() const
{
return size(mesh_);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment