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>
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_;

View File

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

View File

@ -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)
{}
// Constructors
label size() const
{
return size(mesh_);
}
//- Construct finite-area mesh from faMesh reference
explicit areaMesh(const faMesh& mesh)
:
GeoMesh<faMesh>(mesh)
{}
static label size(const Mesh& mesh)
{
return mesh.nFaces();
}
const areaVectorField& C()
{
return mesh_.areaCentres();
}
// 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();
}
};

View File

@ -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)
{}
// Constructors
label size() const
{
return size(mesh_);
}
//- Construct finite-area edge mesh faMesh reference
explicit edgeMesh(const faMesh& mesh)
:
GeoMesh<faMesh>(mesh)
{}
static label size(const Mesh& mesh)
{
return mesh.nInternalEdges();
}
// Member Functions
const edgeVectorField& C()
{
return mesh_.edgeCentres();
}
//- 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();
}
};

View File

@ -51,28 +51,36 @@ class surfaceMesh
:
public GeoMesh<fvMesh>
{
public:
explicit surfaceMesh(const fvMesh& mesh)
:
GeoMesh<fvMesh>(mesh)
{}
// Constructors
label size() const
{
return size(mesh_);
}
//- Construct surface mesh from fvMesh reference
explicit surfaceMesh(const fvMesh& mesh)
:
GeoMesh<fvMesh>(mesh)
{}
static label size(const Mesh& mesh)
{
return mesh.nInternalFaces();
}
const surfaceVectorField& C()
{
return mesh_.Cf();
}
// 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();
}
};

View File

@ -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();
}

View File

@ -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_);

View File

@ -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_);

View File

@ -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_);

View File

@ -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_);

View File

@ -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_);

View File

@ -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

View File

@ -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