Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
03bae684
Commit
03bae684
authored
Apr 12, 2011
by
Mark Olesen
Browse files
STYLE: drop face::area() and triFace::area() - less useful than expected
parent
1d4fdf1b
Changes
5
Hide whitespace changes
Inline
Side-by-side
applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C
View file @
03bae684
...
...
@@ -147,7 +147,7 @@ int main(int argc, char *argv[])
forAll
(
surf
,
faceI
)
{
const
scalar
fArea
(
Foam
::
mag
(
surf
[
faceI
].
area
(
surf
.
points
()))
)
;
const
scalar
fArea
(
surf
[
faceI
].
mag
(
surf
.
points
()));
areaTotal
+=
fArea
;
if
(
writeAreas
)
...
...
src/OpenFOAM/meshes/meshShapes/face/face.C
View file @
03bae684
...
...
@@ -555,95 +555,6 @@ Foam::point Foam::face::centre(const pointField& points) const
}
Foam
::
vector
Foam
::
face
::
area
(
const
pointField
&
points
,
point
&
centrePt
)
const
{
const
label
nPoints
=
this
->
size
();
const
labelList
&
f
=
*
this
;
// If the face is a triangle, do a direct calculation for efficiency
// and to avoid round-off error-related problems
if
(
nPoints
==
3
)
{
// return centre point information?
if
(
&
centrePt
)
{
centrePt
=
(
(
1
.
0
/
3
.
0
)
*
(
points
[
f
[
0
]]
+
points
[
f
[
1
]]
+
points
[
f
[
2
]])
);
}
return
(
0
.
5
*
(
(
points
[
f
[
1
]]
-
points
[
f
[
0
]])
^
(
points
[
f
[
2
]]
-
points
[
f
[
0
]])
)
);
}
point
fCentre
=
points
[
f
[
0
]];
for
(
label
pI
=
1
;
pI
<
nPoints
;
++
pI
)
{
fCentre
+=
points
[
f
[
pI
]];
}
fCentre
/=
nPoints
;
vector
sumN2
=
vector
::
zero
;
scalar
sumA
=
0
.
0
;
vector
sumAc
=
vector
::
zero
;
// for area-weighted centre
for
(
label
pI
=
0
;
pI
<
nPoints
;
++
pI
)
{
const
point
&
nextPoint
=
points
[
f
[(
pI
+
1
)
%
nPoints
]];
// Calculate 3*triangle centre
const
vector
ttc
(
points
[
f
[
pI
]]
+
nextPoint
+
fCentre
);
// Calculate 2*triangle normal
const
vector
n2
(
(
nextPoint
-
points
[
f
[
pI
]])
^
(
fCentre
-
points
[
f
[
pI
]])
);
// 2*triangle area
const
scalar
ta
(
Foam
::
mag
(
n2
));
sumN2
+=
n2
;
sumA
+=
ta
;
sumAc
+=
ta
*
ttc
;
}
// return centre point information?
if
(
&
centrePt
)
{
if
(
sumA
>
VSMALL
)
{
centrePt
=
sumAc
/
(
3
.
0
*
sumA
);
}
else
{
centrePt
=
fCentre
;
}
}
return
0
.
5
*
sumN2
;
}
Foam
::
vector
Foam
::
face
::
normal
(
const
pointField
&
p
)
const
{
const
label
nPoints
=
size
();
...
...
src/OpenFOAM/meshes/meshShapes/face/face.H
View file @
03bae684
...
...
@@ -183,18 +183,11 @@ public:
//- Centre point of face
point
centre
(
const
pointField
&
)
const
;
//- Area of face, optionally return centre point as well
vector
area
(
const
pointField
&
,
point
&
centrePt
=
*
reinterpret_cast
<
point
*>
(
0
)
)
const
;
//- Calculate average value at centroid of face
template
<
class
Type
>
Type
average
(
const
pointField
&
,
const
Field
<
Type
>&
)
const
;
//-
Scalar magnitude
//-
Magnitude of face area
inline
scalar
mag
(
const
pointField
&
)
const
;
//- Vector normal; magnitude is equal to area of face
...
...
src/OpenFOAM/meshes/meshShapes/triFace/triFace.H
View file @
03bae684
...
...
@@ -114,21 +114,14 @@ public:
//- Return centre (centroid)
inline
point
centre
(
const
pointField
&
)
const
;
//- Area, optionally return centre point as well
inline
vector
area
(
const
pointField
&
,
point
&
centrePt
=
*
reinterpret_cast
<
point
*>
(
0
)
)
const
;
//- Calculate average value at centroid of face
template
<
class
Type
>
Type
average
(
const
pointField
&
,
const
Field
<
Type
>&
)
const
;
//-
Return scalar magnitude
//-
Magnitude of face area
inline
scalar
mag
(
const
pointField
&
)
const
;
//-
Return vector normal
//-
Vector normal; magnitude is equal to area of face
inline
vector
normal
(
const
pointField
&
)
const
;
//- Number of triangles after splitting
...
...
src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H
View file @
03bae684
...
...
@@ -171,27 +171,12 @@ inline Foam::point Foam::triFace::centre(const pointField& points) const
}
inline
Foam
::
vector
Foam
::
triFace
::
area
(
const
pointField
&
points
,
point
&
centrePt
)
const
{
// return centre point information?
if
(
&
centrePt
)
{
centrePt
=
this
->
centre
(
points
);
}
return
this
->
normal
(
points
);
}
inline
Foam
::
scalar
Foam
::
triFace
::
mag
(
const
pointField
&
points
)
const
{
return
::
Foam
::
mag
(
normal
(
points
));
}
// could also delegate to triPointRef(...).normal()
inline
Foam
::
vector
Foam
::
triFace
::
normal
(
const
pointField
&
points
)
const
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment