Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-gfe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
Sander, Oliver
dune-gfe
Commits
3aabf8b1
Commit
3aabf8b1
authored
6 years ago
by
Sander, Oliver
Browse files
Options
Downloads
Patches
Plain Diff
Modernize two unit tests
parent
fb0fb14c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/frameinvariancetest.cc
+8
-11
8 additions, 11 deletions
test/frameinvariancetest.cc
test/globalgfetestfunctionbasistest.cc
+6
-8
6 additions, 8 deletions
test/globalgfetestfunctionbasistest.cc
with
14 additions
and
19 deletions
test/frameinvariancetest.cc
+
8
−
11
View file @
3aabf8b1
...
...
@@ -23,8 +23,6 @@ using std::string;
int
main
(
int
argc
,
char
*
argv
[])
try
{
// Some types that I need
typedef
BCRSMatrix
<
FieldMatrix
<
double
,
blocksize
,
blocksize
>
>
MatrixType
;
typedef
BlockVector
<
FieldVector
<
double
,
blocksize
>
>
CorrectionType
;
typedef
std
::
vector
<
RigidBodyMotion
<
double
,
3
>
>
SolutionType
;
// Problem settings
...
...
@@ -35,8 +33,10 @@ int main (int argc, char *argv[]) try
// ///////////////////////////////////////
typedef
OneDGrid
GridType
;
GridType
grid
(
numRodBaseElements
,
0
,
1
);
using
GridView
=
GridType
::
LeafGridView
;
GridView
gridView
=
grid
.
leafGridView
();
SolutionType
x
(
grid
.
size
(
1
));
SolutionType
x
(
grid
View
.
size
(
1
));
// //////////////////////////
// Initial solution
...
...
@@ -57,10 +57,7 @@ int main (int argc, char *argv[]) try
// Create a second, rotated copy of the configuration
// /////////////////////////////////////////////////////////////////////
FieldVector
<
double
,
3
>
displacement
;
displacement
[
0
]
=
0
;
displacement
[
1
]
=
0
;
displacement
[
2
]
=
0
;
FieldVector
<
double
,
3
>
displacement
{
0
,
0
,
0
};
FieldVector
<
double
,
3
>
axis
(
0
);
axis
[
0
]
=
1
;
Rotation
<
double
,
3
>
rotation
(
axis
,
M_PI
/
2
);
...
...
@@ -88,20 +85,20 @@ int main (int argc, char *argv[]) try
writeRod
(
x
,
"rod"
);
writeRod
(
rotatedX
,
"rotated"
);
RodLocalStiffness
<
GridType
::
Leaf
GridView
,
double
>
assembler
(
grid
.
leafGrid
View
()
,
RodLocalStiffness
<
GridView
,
double
>
assembler
(
gridView
,
1
,
1
,
1
,
1e6
,
0.3
);
for
(
int
i
=
1
;
i
<
2
;
i
++
)
{
double
p
=
double
(
i
)
/
2
;
assembler
.
getStrain
(
x
,
*
grid
.
l
begin
<
0
>
(
0
),
p
);
assembler
.
getStrain
(
rotatedX
,
*
grid
.
l
begin
<
0
>
(
0
),
p
);
assembler
.
getStrain
(
x
,
*
grid
View
.
begin
<
0
>
(),
p
);
assembler
.
getStrain
(
rotatedX
,
*
grid
View
.
begin
<
0
>
(),
p
);
}
}
catch
(
Exception
e
)
{
std
::
cout
<<
e
<<
std
::
endl
;
std
::
cout
<<
e
.
what
()
<<
std
::
endl
;
}
This diff is collapsed.
Click to expand it.
test/globalgfetestfunctionbasistest.cc
+
6
−
8
View file @
3aabf8b1
...
...
@@ -41,19 +41,17 @@ void test()
typedef
GlobalGFETestFunctionBasis
<
P1Basis
,
TargetSpace
>
GlobalBasis
;
GlobalBasis
basis
(
p1Basis
,
testPoints
);
typedef
typename
OneDGrid
::
Codim
<
0
>::
LeafIterator
ElementIterator
;
ElementIterator
eIt
=
grid
.
leafbegin
<
0
>
();
ElementIterator
eEndIt
=
grid
.
leafend
<
0
>
();
for
(;
eIt
!=
eEndIt
;
++
eIt
)
{
const
typename
GlobalBasis
::
LocalFiniteElement
&
lfe
=
basis
.
getLocalFiniteElement
(
*
eIt
);
for
(
const
auto
element
:
elements
(
grid
.
leafGridView
()))
{
const
typename
GlobalBasis
::
LocalFiniteElement
&
lfe
=
basis
.
getLocalFiniteElement
(
element
);
FieldVector
<
double
,
1
>
stupidTestPoint
(
0
);
std
::
vector
<
std
::
array
<
typename
TargetSpace
::
EmbeddedTangentVector
,
TargetSpace
::
TangentVector
::
dimension
>
>
values
;
lfe
.
localBasis
().
evaluateFunction
(
stupidTestPoint
,
values
);
for
(
size_t
i
=
0
;
i
<
values
.
size
();
i
++
)
{
std
::
cout
<<
values
[
i
]
<<
std
::
endl
;
for
(
auto
v
:
values
[
i
])
std
::
cout
<<
v
<<
" "
;
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
lfe
.
localCoefficients
().
localKey
(
i
)
<<
std
::
endl
;
}
//int i = basis.index(*eIt,1);
...
...
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