Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenFOAM-plus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Development
OpenFOAM-plus
Commits
39d8a9e6
Commit
39d8a9e6
authored
7 years ago
by
Mark OLESEN
Browse files
Options
Downloads
Patches
Plain Diff
BUG: array-bound error for SphericalTensor component-wise functions
STYEL: use constexpr for VectorSpaceOps
parent
b4a047eb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/OpenFOAM/primitives/SphericalTensor/SphericalTensorI.H
+28
-0
28 additions, 0 deletions
src/OpenFOAM/primitives/SphericalTensor/SphericalTensorI.H
src/OpenFOAM/primitives/VectorSpace/VectorSpaceOps.H
+18
-7
18 additions, 7 deletions
src/OpenFOAM/primitives/VectorSpace/VectorSpaceOps.H
with
46 additions
and
7 deletions
src/OpenFOAM/primitives/SphericalTensor/SphericalTensorI.H
+
28
−
0
View file @
39d8a9e6
...
...
@@ -157,6 +157,34 @@ inline Cmpt magSqr(const SphericalTensor<Cmpt>& st)
}
template
<
class
Cmpt
>
inline
Cmpt
cmptMax
(
const
SphericalTensor
<
Cmpt
>&
st
)
{
return
st
.
ii
();
}
template
<
class
Cmpt
>
inline
Cmpt
cmptMin
(
const
SphericalTensor
<
Cmpt
>&
st
)
{
return
st
.
ii
();
}
template
<
class
Cmpt
>
inline
Cmpt
cmptSum
(
const
SphericalTensor
<
Cmpt
>&
st
)
{
return
3
*
st
.
ii
();
}
template
<
class
Cmpt
>
inline
Cmpt
cmptAv
(
const
SphericalTensor
<
Cmpt
>&
st
)
{
return
st
.
ii
();
}
//- Return the trace of a spherical tensor
template
<
class
Cmpt
>
inline
Cmpt
tr
(
const
SphericalTensor
<
Cmpt
>&
st
)
...
...
This diff is collapsed.
Click to expand it.
src/OpenFOAM/primitives/VectorSpace/VectorSpaceOps.H
+
18
−
7
View file @
39d8a9e6
...
...
@@ -44,27 +44,37 @@ class VectorSpaceOps
{
public:
static
const
int
endLoop
=
(
I
<
N
-
1
)
?
1
:
0
;
//- End for next loop. Is 0 for loop termination.
static
constexpr
direction
loopN
()
noexcept
{
return
(
I
+
1
<
N
)
?
N
:
0
;
}
//- Index for next loop. Is 0 for loop termination.
static
constexpr
direction
loopI1
()
noexcept
{
return
(
I
+
1
<
N
)
?
I
+
1
:
0
;
}
template
<
class
V
,
class
S
,
class
EqOp
>
static
inline
void
eqOpS
(
V
&
vs
,
const
S
&
s
,
EqOp
eo
)
{
eo
(
vs
.
v_
[
I
],
s
);
VectorSpaceOps
<
endLoop
*
N
,
endLoop
*
(
I
+
1
)
>::
eqOpS
(
vs
,
s
,
eo
);
VectorSpaceOps
<
loopN
(),
loopI1
(
)
>::
eqOpS
(
vs
,
s
,
eo
);
}
template
<
class
S
,
class
V
,
class
EqOp
>
static
inline
void
SeqOp
(
S
&
s
,
const
V
&
vs
,
EqOp
eo
)
{
eo
(
s
,
vs
.
v_
[
I
]);
VectorSpaceOps
<
endLoop
*
N
,
endLoop
*
(
I
+
1
)
>::
SeqOp
(
s
,
vs
,
eo
);
VectorSpaceOps
<
loopN
(),
loopI1
(
)
>::
SeqOp
(
s
,
vs
,
eo
);
}
template
<
class
V1
,
class
V2
,
class
EqOp
>
static
inline
void
eqOp
(
V1
&
vs1
,
const
V2
&
vs2
,
EqOp
eo
)
{
eo
(
vs1
.
v_
[
I
],
vs2
.
v_
[
I
]);
VectorSpaceOps
<
endLoop
*
N
,
endLoop
*
(
I
+
1
)
>::
eqOp
(
vs1
,
vs2
,
eo
);
VectorSpaceOps
<
loopN
(),
loopI1
(
)
>::
eqOp
(
vs1
,
vs2
,
eo
);
}
...
...
@@ -72,25 +82,26 @@ public:
static
inline
void
opVS
(
V
&
vs
,
const
V1
&
vs1
,
const
S
&
s
,
Op
o
)
{
vs
.
v_
[
I
]
=
o
(
vs1
.
v_
[
I
],
s
);
VectorSpaceOps
<
endLoop
*
N
,
endLoop
*
(
I
+
1
)
>::
opVS
(
vs
,
vs1
,
s
,
o
);
VectorSpaceOps
<
loopN
(),
loopI1
(
)
>::
opVS
(
vs
,
vs1
,
s
,
o
);
}
template
<
class
V
,
class
S
,
class
V1
,
class
Op
>
static
inline
void
opSV
(
V
&
vs
,
const
S
&
s
,
const
V1
&
vs1
,
Op
o
)
{
vs
.
v_
[
I
]
=
o
(
s
,
vs1
.
v_
[
I
]);
VectorSpaceOps
<
endLoop
*
N
,
endLoop
*
(
I
+
1
)
>::
opSV
(
vs
,
s
,
vs1
,
o
);
VectorSpaceOps
<
loopN
(),
loopI1
(
)
>::
opSV
(
vs
,
s
,
vs1
,
o
);
}
template
<
class
V
,
class
V1
,
class
Op
>
static
inline
void
op
(
V
&
vs
,
const
V1
&
vs1
,
const
V1
&
vs2
,
Op
o
)
{
vs
.
v_
[
I
]
=
o
(
vs1
.
v_
[
I
],
vs2
.
v_
[
I
]);
VectorSpaceOps
<
endLoop
*
N
,
endLoop
*
(
I
+
1
)
>::
op
(
vs
,
vs1
,
vs2
,
o
);
VectorSpaceOps
<
loopN
(),
loopI1
(
)
>::
op
(
vs
,
vs1
,
vs2
,
o
);
}
};
//- Specialization for loop termination of vector space ops
template
<
>
class
VectorSpaceOps
<
0
,
0
>
{
...
...
This diff is collapsed.
Click to expand it.
Mark OLESEN
@mark
mentioned in commit
753723c6
·
7 years ago
mentioned in commit
753723c6
mentioned in commit 753723c6ec96fd1dbc7324c7140f612eda3e057a
Toggle commit list
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment