From b2dfd709ec209bfd794faa64d3050dbd2a16300b Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 27 Dec 2010 11:47:20 +0000 Subject: [PATCH] Added inline function for centroid --- .../meshes/primitiveShapes/tetrahedron/tetrahedron.H | 3 +++ .../meshes/primitiveShapes/tetrahedron/tetrahedronI.H | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedron.H b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedron.H index 832993a19..cf02efd92 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedron.H +++ b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedron.H @@ -138,6 +138,9 @@ public: //- Return volume inline scalar mag() const; + //- Return centre + inline vector centre() const; + //- Return circum-centre inline vector circumCentre() const; diff --git a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H index 9ffce00f7..31cba4f77 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H +++ b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H @@ -133,6 +133,13 @@ inline scalar tetrahedron::mag() const } +template +inline vector tetrahedron::centre() const +{ + return 0.25*(a_ + b_ + c_ + d_); +} + + template inline vector tetrahedron::circumCentre() const {