diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.C b/src/OpenFOAM/meshes/meshShapes/face/face.C index b34f838b6a298fa194690f5bec0f269fc216a741..16d71fe9b06d83481672e25290f2b1f017cdcbd2 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.C +++ b/src/OpenFOAM/meshes/meshShapes/face/face.C @@ -25,6 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "face.H" +#include "triFace.H" #include "triPointRef.H" #include "mathematicalConstants.H" @@ -283,6 +284,14 @@ void Foam::face::split } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::face::face(const triFace& f) +: + labelList(f) +{} + + // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.H b/src/OpenFOAM/meshes/meshShapes/face/face.H index fe9570e2b99e3bec32d49f65456e9ddbcb4910ee..875df604959d4219250b86307638d6d4a0c6501a 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.H +++ b/src/OpenFOAM/meshes/meshShapes/face/face.H @@ -56,6 +56,7 @@ namespace Foam // Forward declaration of friend functions and operators class face; +class triFace; inline bool operator==(const face& a, const face& b); inline bool operator!=(const face& a, const face& b); inline Istream& operator>>(Istream&, face&); @@ -135,12 +136,18 @@ public: //- Construct given size explicit inline face(label); - //- Construct from labelList + //- Construct from list of labels + explicit inline face(const UList<label>&); + + //- Construct from list of labels explicit inline face(const labelList&); //- Construct by transferring the parameter contents explicit inline face(const xfer<labelList>&); + //- Copy construct from triFace + face(const triFace&); + //- Construct from Istream inline face(Istream&); diff --git a/src/OpenFOAM/meshes/meshShapes/face/faceI.H b/src/OpenFOAM/meshes/meshShapes/face/faceI.H index 50d1787a000f342d5374c85e4b33cf30e18814cf..8b1d9a38ab8d0f4d7ab25bb302b81bf46ba4c730 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/faceI.H +++ b/src/OpenFOAM/meshes/meshShapes/face/faceI.H @@ -42,32 +42,34 @@ inline Foam::label Foam::face::left(const label i) const // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct NULL inline Foam::face::face() {} -// Construct given size inline Foam::face::face(label s) : labelList(s, -1) {} -// Construct from components +inline Foam::face::face(const UList<label>& lst) +: + labelList(lst) +{} + + inline Foam::face::face(const labelList& lst) : labelList(lst) {} -// Construct from components + inline Foam::face::face(const xfer<labelList>& lst) : labelList(lst) {} -// Construct from Istream inline Foam::face::face(Istream& is) { is >> *this; diff --git a/src/OpenFOAM/meshes/meshShapes/face/faceTemplates.C b/src/OpenFOAM/meshes/meshShapes/face/faceTemplates.C index bfb9c751603b76266db5f81586f112ccdc33bdcf..5d48a8d14702ea4319f249519945a5834bb9a136 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/faceTemplates.C +++ b/src/OpenFOAM/meshes/meshShapes/face/faceTemplates.C @@ -26,15 +26,14 @@ License #include "face.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -Type face::average(const pointField& meshPoints, const Field<Type>& f) const +Type Foam::face::average +( + const pointField& meshPoints, + const Field<Type>& f +) const { // Calculate the average by breaking the face into triangles and // area-weighted averaging their averages @@ -42,7 +41,7 @@ Type face::average(const pointField& meshPoints, const Field<Type>& f) const // If the face is a triangle, do a direct calculation if (size() == 3) { - return + return (1.0/3.0) *( f[operator[](0)] @@ -71,7 +70,7 @@ Type face::average(const pointField& meshPoints, const Field<Type>& f) const for (register label pI=0; pI<nPoints; pI++) { // Calculate 3*triangle centre field value - Type ttcf = + Type ttcf = ( f[operator[](pI)] + f[operator[]((pI + 1) % nPoints)] @@ -99,9 +98,4 @@ Type face::average(const pointField& meshPoints, const Field<Type>& f) const } } - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* //