Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wenqing
ogs
Commits
a33bf918
Commit
a33bf918
authored
3 years ago
by
Tom Fischer
Committed by
Dmitry Yu. Naumov
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[MeL/Elements] Subst. C-array with std::array.
parent
3cfa57bf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MeshLib/Elements/TemplateElement-impl.h
+7
-10
7 additions, 10 deletions
MeshLib/Elements/TemplateElement-impl.h
MeshLib/Elements/TemplateElement.h
+8
-7
8 additions, 7 deletions
MeshLib/Elements/TemplateElement.h
with
15 additions
and
17 deletions
MeshLib/Elements/TemplateElement-impl.h
+
7
−
10
View file @
a33bf918
...
...
@@ -15,8 +15,9 @@ namespace MeshLib
template
<
class
ELEMENT_RULE
>
TemplateElement
<
ELEMENT_RULE
>::
TemplateElement
(
Node
*
nodes
[
n_all_nodes
],
std
::
size_t
id
)
:
Element
(
id
)
,
_nodes
(
nodes
)
:
Element
(
id
)
{
std
::
copy_n
(
nodes
,
n_all_nodes
,
std
::
begin
(
_nodes
));
this
->
_neighbors
=
new
Element
*
[
getNumberOfNeighbors
()];
std
::
fill
(
this
->
_neighbors
,
this
->
_neighbors
+
getNumberOfNeighbors
(),
nullptr
);
...
...
@@ -26,9 +27,8 @@ TemplateElement<ELEMENT_RULE>::TemplateElement(Node* nodes[n_all_nodes],
template
<
class
ELEMENT_RULE
>
TemplateElement
<
ELEMENT_RULE
>::
TemplateElement
(
std
::
array
<
Node
*
,
n_all_nodes
>
const
&
nodes
,
std
::
size_t
id
)
:
Element
(
id
),
_nodes
(
new
Node
*
[
n_all_
nodes
])
:
Element
(
id
),
_nodes
{
nodes
}
{
std
::
copy
(
nodes
.
begin
(),
nodes
.
end
(),
this
->
_nodes
);
this
->
_neighbors
=
new
Element
*
[
getNumberOfNeighbors
()];
std
::
fill
(
this
->
_neighbors
,
this
->
_neighbors
+
getNumberOfNeighbors
(),
nullptr
);
...
...
@@ -36,13 +36,10 @@ TemplateElement<ELEMENT_RULE>::TemplateElement(
}
template
<
class
ELEMENT_RULE
>
TemplateElement
<
ELEMENT_RULE
>::
TemplateElement
(
const
TemplateElement
&
e
)
:
Element
(
e
.
getID
()),
_nodes
(
new
Node
*
[
n_all_nodes
])
TemplateElement
<
ELEMENT_RULE
>::
TemplateElement
(
TemplateElement
<
ELEMENT_RULE
>
const
&
e
)
:
Element
(
e
.
getID
()),
_nodes
{
e
.
_nodes
}
{
for
(
unsigned
i
=
0
;
i
<
n_all_nodes
;
i
++
)
{
this
->
_nodes
[
i
]
=
e
.
_nodes
[
i
];
}
this
->
_neighbors
=
new
Element
*
[
getNumberOfNeighbors
()];
for
(
unsigned
i
=
0
;
i
<
getNumberOfNeighbors
();
i
++
)
{
...
...
@@ -55,7 +52,7 @@ TemplateElement<ELEMENT_RULE>::TemplateElement(const TemplateElement& e)
template
<
class
ELEMENT_RULE
>
double
TemplateElement
<
ELEMENT_RULE
>::
getContent
()
const
{
return
ELEMENT_RULE
::
computeVolume
(
this
->
_nodes
);
return
ELEMENT_RULE
::
computeVolume
(
_nodes
.
data
()
);
}
namespace
details
...
...
This diff is collapsed.
Click to expand it.
MeshLib/Elements/TemplateElement.h
+
8
−
7
View file @
a33bf918
...
...
@@ -64,8 +64,7 @@ public:
std
::
size_t
id
=
std
::
numeric_limits
<
std
::
size_t
>::
max
());
/// Copy constructor
TemplateElement
(
const
TemplateElement
&
e
);
~
TemplateElement
()
{
delete
[]
_nodes
;
}
explicit
TemplateElement
(
const
TemplateElement
&
e
);
/// Returns a copy of this object.
Element
*
clone
()
const
override
{
return
new
TemplateElement
(
*
this
);
}
...
...
@@ -166,7 +165,7 @@ public:
MathLib
::
Point3d
const
&
pnt
,
double
eps
=
std
::
numeric_limits
<
double
>::
epsilon
())
const
override
{
return
ELEMENT_RULE
::
isPntInElement
(
this
->
_nodes
,
pnt
,
eps
);
return
ELEMENT_RULE
::
isPntInElement
(
_nodes
.
data
()
,
pnt
,
eps
);
}
/**
...
...
@@ -180,18 +179,18 @@ public:
/// Returns the ID of a face given an array of nodes.
unsigned
identifyFace
(
Node
const
*
nodes
[
3
])
const
override
{
return
ELEMENT_RULE
::
identifyFace
(
this
->
_nodes
,
nodes
);
return
ELEMENT_RULE
::
identifyFace
(
_nodes
.
data
()
,
nodes
);
}
/// Calculates the volume of a convex hexahedron by partitioning it into six tetrahedra.
double
computeVolume
()
override
{
return
ELEMENT_RULE
::
computeVolume
(
this
->
_nodes
);
return
ELEMENT_RULE
::
computeVolume
(
_nodes
.
data
()
);
}
const
Node
*
getNode
(
unsigned
i
)
const
override
;
void
setNode
(
unsigned
idx
,
Node
*
node
)
override
;
Node
*
const
*
getNodes
()
const
override
{
return
_nodes
;
}
Node
*
const
*
getNodes
()
const
override
{
return
_nodes
.
data
()
;
}
/// Return a specific edge node.
inline
Node
*
getEdgeNode
(
unsigned
edge_id
,
unsigned
node_id
)
const
override
...
...
@@ -199,7 +198,7 @@ public:
if
(
getNumberOfEdges
()
>
0
)
{
return
const_cast
<
Node
*>
(
this
->
_nodes
[
ELEMENT_RULE
::
edge_nodes
[
edge_id
][
node_id
]]);
_nodes
[
ELEMENT_RULE
::
edge_nodes
[
edge_id
][
node_id
]]);
}
return
nullptr
;
...
...
@@ -215,6 +214,8 @@ public:
}
double
getContent
()
const
override
final
;
std
::
array
<
Node
*
,
n_all_nodes
>
_nodes
;
};
}
// namespace MeshLib
...
...
This diff is collapsed.
Click to expand it.
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