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
b41f0421
Commit
b41f0421
authored
5 years ago
by
Sander, Oliver
Browse files
Options
Downloads
Patches
Plain Diff
Make rodassemblertest.cc compile again
parent
55bc0d05
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/rodassemblertest.cc
+18
-12
18 additions, 12 deletions
test/rodassemblertest.cc
with
18 additions
and
12 deletions
test/rodassemblertest.cc
+
18
−
12
View file @
b41f0421
...
...
@@ -27,16 +27,16 @@ void infinitesimalVariation(RigidBodyMotion<double,3>& c, double eps, int i)
}
}
template
<
class
GridType
>
template
<
class
FEBasis
>
void
strainFD
(
const
std
::
vector
<
RigidBodyMotion
<
double
,
3
>
>&
x
,
double
pos
,
std
::
array
<
FieldMatrix
<
double
,
2
,
6
>
,
6
>&
fdStrainDerivatives
,
const
RodAssembler
<
GridType
,
3
>&
assembler
)
const
RodAssembler
<
FEBasis
,
3
>&
assembler
)
{
assert
(
x
.
size
()
==
2
);
double
eps
=
1e-8
;
typename
GridType
::
template
Codim
<
0
>
::
EntityPointer
element
=
assembler
.
grid_
->
template
leaf
begin
<
0
>();
auto
element
=
assembler
.
basis_
.
gridView_
.
template
begin
<
0
>();
// ///////////////////////////////////////////////////////////
// Compute gradient by finite-difference approximation
...
...
@@ -72,17 +72,17 @@ void strainFD(const std::vector<RigidBodyMotion<double,3> >& x,
}
template
<
class
GridType
>
template
<
class
FEBasis
>
void
strain2ndOrderFD
(
const
std
::
vector
<
RigidBodyMotion
<
double
,
3
>
>&
x
,
double
pos
,
std
::
array
<
Matrix
<
FieldMatrix
<
double
,
6
,
6
>
>
,
3
>&
translationDer
,
std
::
array
<
Matrix
<
FieldMatrix
<
double
,
3
,
3
>
>
,
3
>&
rotationDer
,
const
RodAssembler
<
GridType
,
3
>&
assembler
)
const
RodAssembler
<
FEBasis
,
3
>&
assembler
)
{
assert
(
x
.
size
()
==
2
);
double
eps
=
1e-3
;
typename
GridType
::
template
Codim
<
0
>
::
EntityPointer
element
=
assembler
.
grid_
->
template
leaf
begin
<
0
>();
auto
element
=
assembler
.
basis_
.
gridView_
.
template
begin
<
0
>();
for
(
int
m
=
0
;
m
<
3
;
m
++
)
{
...
...
@@ -502,7 +502,10 @@ int main (int argc, char *argv[]) try
typedef
OneDGrid
GridType
;
GridType
grid
(
1
,
0
,
1
);
SolutionType
x
(
grid
.
size
(
1
));
using
GridView
=
GridType
::
LeafGridView
;
GridView
gridView
=
grid
.
leafGridView
();
SolutionType
x
(
gridView
.
size
(
1
));
// //////////////////////////
// Initial solution
...
...
@@ -541,11 +544,15 @@ int main (int argc, char *argv[]) try
// ///////////////////////////////////////////
// Create a solver for the rod problem
// ///////////////////////////////////////////
RodLocalStiffness
<
GridType
::
LeafGridView
,
double
>
localStiffness
(
grid
.
leafGridView
(),
using
Basis
=
Functions
::
LagrangeBasis
<
GridView
,
1
>
;
Basis
basis
(
gridView
);
RodLocalStiffness
<
GridView
,
double
>
localStiffness
(
gridView
,
0.01
,
0.0001
,
0.0001
,
2.5e5
,
0.3
);
RodAssembler
<
GridType
::
LeafGridView
,
3
>
rodAssembler
(
grid
.
leafGridView
()
,
&
localStiffness
);
RodAssembler
<
Basis
,
3
>
rodAssembler
(
basis
,
&
localStiffness
);
std
::
cout
<<
"Energy: "
<<
rodAssembler
.
computeEnergy
(
x
)
<<
std
::
endl
;
...
...
@@ -566,8 +573,7 @@ int main (int argc, char *argv[]) try
rodAssembler
.
getNeighborsPerVertex
(
indices
);
indices
.
exportIdx
(
hessianMatrix
);
rodAssembler
.
assembleGradient
(
x
,
rhs
);
rodAssembler
.
assembleMatrix
(
x
,
hessianMatrix
);
rodAssembler
.
assembleGradientAndHessian
(
x
,
rhs
,
hessianMatrix
);
gradientFDCheck
(
x
,
rhs
,
rodAssembler
);
hessianFDCheck
(
x
,
hessianMatrix
,
rodAssembler
);
...
...
@@ -575,6 +581,6 @@ int main (int argc, char *argv[]) try
// //////////////////////////////
}
catch
(
Exception
&
e
)
{
std
::
cout
<<
e
<<
std
::
endl
;
std
::
cout
<<
e
.
what
()
<<
std
::
endl
;
}
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