Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
MostafaMollaali
dynamic
Commits
907d5641
Commit
907d5641
authored
8 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
Testing integration point MeshProperties.
parent
c00bce8a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/MeshLib/MeshProperties.cpp
+54
-0
54 additions, 0 deletions
Tests/MeshLib/MeshProperties.cpp
with
54 additions
and
0 deletions
Tests/MeshLib/MeshProperties.cpp
+
54
−
0
View file @
907d5641
...
...
@@ -14,6 +14,7 @@
#include
"MeshLib/MeshGenerators/MeshGenerator.h"
#include
"MeshLib/Mesh.h"
#include
"MeshLib/Elements/Element.h"
#include
"MeshLib/PropertyVector.h"
class
MeshLibProperties
:
public
::
testing
::
Test
...
...
@@ -49,6 +50,59 @@ TEST_F(MeshLibProperties, PropertyVectorTestMetaData)
ASSERT_EQ
(
0u
,
p
->
size
());
}
TEST_F
(
MeshLibProperties
,
PropertyVectorTestIntegrationPoint
)
{
ASSERT_TRUE
(
mesh
!=
nullptr
);
int
const
n_integration_points
=
4
;
int
const
vector_length
=
6
;
std
::
string
const
prop_name
(
"ip_field"
);
auto
*
const
p_ptr
=
mesh
->
getProperties
().
createNewPropertyVector
<
double
>
(
prop_name
,
MeshLib
::
MeshItemType
::
IntegrationPoint
,
vector_length
);
ASSERT_TRUE
(
p_ptr
!=
nullptr
);
auto
&
p
=
*
p_ptr
;
ASSERT_EQ
(
p
.
getPropertyName
(),
prop_name
);
ASSERT_EQ
(
MeshLib
::
MeshItemType
::
IntegrationPoint
,
p
.
getMeshItemType
());
ASSERT_EQ
(
vector_length
,
p
.
getNumberOfComponents
());
ASSERT_EQ
(
0u
,
p
.
size
());
// Fill the property vector with double data in following pattern:
// for element's id xx and integration point number yy the value is xx.yy.
p
.
resize
(
mesh
->
getNumberOfElements
()
*
n_integration_points
);
std
::
vector
<
std
::
size_t
>
offsets
(
mesh
->
getNumberOfElements
());
std
::
size_t
offset
=
0
;
// last position in the property vector
for
(
auto
const
&
e
:
mesh
->
getElements
())
{
offsets
[
e
->
getID
()]
=
offset
;
for
(
int
ip
=
0
;
ip
<
n_integration_points
;
++
ip
)
{
p
[
offset
+
ip
]
=
e
->
getID
()
+
ip
*
0.01
;
}
offset
+=
n_integration_points
;
}
// Check the values at each offset.
// Last element is checked after the for-loop.
std
::
size_t
i
=
0
;
for
(;
i
<
offsets
.
size
()
-
1
;
++
i
)
{
std
::
size_t
const
size
=
offsets
[
i
+
1
]
-
offsets
[
i
];
ASSERT_EQ
(
n_integration_points
,
size
);
for
(
int
ip
=
0
;
ip
<
n_integration_points
;
++
ip
)
ASSERT_EQ
(
i
+
ip
*
0.01
,
p
[
offsets
[
i
]
+
ip
]);
}
{
// Last element
std
::
size_t
const
size
=
p
.
size
()
-
offsets
[
i
];
ASSERT_EQ
(
n_integration_points
,
size
);
for
(
int
ip
=
0
;
ip
<
n_integration_points
;
++
ip
)
ASSERT_EQ
(
i
+
ip
*
0.01
,
p
[
offsets
[
i
]
+
ip
]);
}
}
TEST_F
(
MeshLibProperties
,
AddDoubleProperties
)
{
ASSERT_TRUE
(
mesh
!=
nullptr
);
...
...
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