mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
allow construction of face() from triFace()
This commit is contained in:
@ -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 * * * * * * * * * * * * //
|
||||
|
||||
|
||||
|
||||
@ -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&);
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user