Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
eda13117
Commit
eda13117
authored
Sep 19, 2018
by
Mark OLESEN
Browse files
STYLE: explicitly use degrees in arcEdge coordinate system (
#1015
)
- safeguard against any change in the default in cylindricalCS
parent
6cd953ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.C
View file @
eda13117
...
...
@@ -43,15 +43,15 @@ namespace blockEdges
Foam
::
cylindricalCS
Foam
::
blockEdges
::
arcEdge
::
calcAngle
()
{
vector
a
=
p2_
-
p1_
;
vector
b
=
p3_
-
p1_
;
const
vector
a
=
p2_
-
p1_
;
const
vector
b
=
p3_
-
p1_
;
//
f
ind centre of arcEdge
scalar
asqr
=
a
&
a
;
scalar
bsqr
=
b
&
b
;
scalar
adotb
=
a
&
b
;
//
F
ind centre of arcEdge
const
scalar
asqr
=
a
&
a
;
const
scalar
bsqr
=
b
&
b
;
const
scalar
adotb
=
a
&
b
;
scalar
denom
=
asqr
*
bsqr
-
adotb
*
adotb
;
const
scalar
denom
=
asqr
*
bsqr
-
adotb
*
adotb
;
if
(
mag
(
denom
)
<
VSMALL
)
{
...
...
@@ -60,46 +60,46 @@ Foam::cylindricalCS Foam::blockEdges::arcEdge::calcAngle()
<<
abort
(
FatalError
);
}
scalar
fact
=
0
.
5
*
(
bsqr
-
adotb
)
/
denom
;
const
scalar
fact
=
0
.
5
*
(
bsqr
-
adotb
)
/
denom
;
point
centre
=
0
.
5
*
a
+
fact
*
((
a
^
b
)
^
a
);
centre
+=
p1_
;
//
f
ind position vectors w.r.t. the arcEdge centre
vector
r1
(
p1_
-
centre
);
vector
r2
(
p2_
-
centre
);
vector
r3
(
p3_
-
centre
);
//
F
ind position vectors w.r.t. the arcEdge centre
const
vector
r1
(
p1_
-
centre
);
const
vector
r2
(
p2_
-
centre
);
const
vector
r3
(
p3_
-
centre
);
//
f
ind angle
s
//
F
ind angle
(in degrees)
angle_
=
radToDeg
(
acos
((
r3
&
r1
)
/
(
mag
(
r3
)
*
mag
(
r1
))));
//
c
heck if the vectors define an exterior or an interior arcEdge
//
C
heck if the vectors define an exterior or an interior arcEdge
if
(((
r1
^
r2
)
&
(
r1
^
r3
))
<
0
.
0
)
{
angle_
=
360
.
0
-
angle_
;
}
vector
temp
Axis
;
vector
arc
Axis
;
if
(
angle_
<=
180
.
0
)
{
temp
Axis
=
r1
^
r3
;
arc
Axis
=
r1
^
r3
;
if
(
mag
(
temp
Axis
)
/
(
mag
(
r1
)
*
mag
(
r3
))
<
0
.
001
)
if
(
mag
(
arc
Axis
)
/
(
mag
(
r1
)
*
mag
(
r3
))
<
0
.
001
)
{
temp
Axis
=
r1
^
r2
;
arc
Axis
=
r1
^
r2
;
}
}
else
{
temp
Axis
=
r3
^
r1
;
arc
Axis
=
r3
^
r1
;
}
radius_
=
mag
(
r3
);
//
set up and return the lo
cal coordinate system
return
cylindricalCS
(
"arcEdgeCS"
,
centre
,
temp
Axis
,
r1
);
//
The corresponding local cylindri
cal coordinate system
(degrees)
return
cylindricalCS
(
"arcEdgeCS"
,
centre
,
arc
Axis
,
r1
,
true
);
}
...
...
@@ -157,10 +157,8 @@ Foam::point Foam::blockEdges::arcEdge::position(const scalar lambda) const
{
return
p3_
;
}
else
{
return
cs_
.
globalPosition
(
vector
(
radius_
,
lambda
*
angle_
,
0
.
0
));
}
return
cs_
.
globalPosition
(
vector
(
radius_
,
lambda
*
angle_
,
0
.
0
));
}
...
...
src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.H
View file @
eda13117
...
...
@@ -55,15 +55,23 @@ class arcEdge
{
// Private data
// Begin, mid, end points
point
p1_
,
p2_
,
p3_
;
//- The arc angle (in degrees)
scalar
angle_
;
//- The arc radius
scalar
radius_
;
//- The local cylindrical coordinate system (degrees)
cylindricalCS
cs_
;
// Private Member Functions
//- Calculate the coordinate system, angle and radius
//- Calculate the angle, radius and axis
// \return the coordinate system
cylindricalCS
calcAngle
();
//- No copy construct
...
...
@@ -85,7 +93,8 @@ public:
arcEdge
(
const
pointField
&
points
,
const
label
start
,
const
label
end
,
const
label
start
,
const
label
end
,
const
point
&
pMid
);
...
...
@@ -101,17 +110,15 @@ public:
//- Destructor
virtual
~
arcEdge
()
{}
virtual
~
arcEdge
()
=
default
;
// Member Functions
//- Return the point position corresponding to the curve parameter
// 0 <= lambda <= 1
point
position
(
const
scalar
)
const
;
//- The point corresponding to the curve parameter [0-1]
point
position
(
const
scalar
lambda
)
const
;
//-
Return t
he length of the curve
//-
T
he length of the curve
scalar
length
()
const
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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