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
1cb066fd
Commit
1cb066fd
authored
15 years ago
by
Oliver Sander
Committed by
sander@PCPOOL.MI.FU-BERLIN.DE
15 years ago
Browse files
Options
Downloads
Patches
Plain Diff
use the method to make a straight rod into a separate file
[[Imported from SVN: r4879]]
parent
63f7af45
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
dirneucoupling.cc
+2
-43
2 additions, 43 deletions
dirneucoupling.cc
src/makestraightrod.hh
+47
-0
47 additions, 0 deletions
src/makestraightrod.hh
with
49 additions
and
43 deletions
dirneucoupling.cc
+
2
−
43
View file @
1cb066fd
...
...
@@ -35,6 +35,7 @@
#include
"src/riemanniantrsolver.hh"
#include
"src/geodesicdifference.hh"
#include
"src/rodwriter.hh"
#include
"src/makestraightrod.hh"
// Space dimension
const
int
dim
=
3
;
...
...
@@ -50,41 +51,6 @@ typedef vector<RigidBodyMotion<dim> > RodSolutionType;
typedef
BlockVector
<
FieldVector
<
double
,
6
>
>
RodDifferenceType
;
// Make a straight rod from two given endpoints
void
makeStraightRod
(
RodSolutionType
&
rod
,
int
n
,
const
FieldVector
<
double
,
3
>&
beginning
,
const
FieldVector
<
double
,
3
>&
end
)
{
// Compute the correct orientation
Rotation
<
3
,
double
>
orientation
=
Rotation
<
3
,
double
>::
identity
();
FieldVector
<
double
,
3
>
zAxis
(
0
);
zAxis
[
2
]
=
1
;
FieldVector
<
double
,
3
>
axis
=
crossProduct
(
end
-
beginning
,
zAxis
);
if
(
axis
.
two_norm
()
!=
0
)
axis
/=
-
axis
.
two_norm
();
FieldVector
<
double
,
3
>
d3
=
end
-
beginning
;
d3
/=
d3
.
two_norm
();
double
angle
=
std
::
acos
(
zAxis
*
d3
);
if
(
angle
!=
0
)
orientation
=
Rotation
<
3
,
double
>
(
axis
,
angle
);
// Set the values
rod
.
resize
(
n
);
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
rod
[
i
].
r
=
beginning
;
rod
[
i
].
r
.
axpy
(
double
(
i
)
/
(
n
-
1
),
end
-
beginning
);
rod
[
i
].
q
=
orientation
;
}
}
int
main
(
int
argc
,
char
*
argv
[])
try
{
// Some types that I need
...
...
@@ -171,14 +137,7 @@ int main (int argc, char *argv[]) try
// //////////////////////////
// Initial solution
// //////////////////////////
#if 0
for (int i=0; i<rodX.size(); i++) {
rodX[i].r[0] = 0.5;
rodX[i].r[1] = 0.5;
rodX[i].r[2] = 5 + (i* 5.0 /(rodX.size()-1));
rodX[i].q = Quaternion<double>::identity();
}
#endif
makeStraightRod
(
rodX
,
rodGrid
.
size
(
1
),
rodRestEndPoint
[
0
],
rodRestEndPoint
[
1
]);
// /////////////////////////////////////////
...
...
This diff is collapsed.
Click to expand it.
src/makestraightrod.hh
0 → 100644
+
47
−
0
View file @
1cb066fd
#ifndef MAKE_STRAIGHT_ROD_HH
#define MAKE_STRAIGHT_ROD_HH
#include
<vector>
#include
<dune/common/fvector.hh>
#include
"rotation.hh"
/** \brief Make a straight rod from two given endpoints
\param[out] rod The new rod
\param[in] n The number of vertices
*/
template
<
int
dim
>
void
makeStraightRod
(
std
::
vector
<
RigidBodyMotion
<
dim
>
>&
rod
,
int
n
,
const
Dune
::
FieldVector
<
double
,
3
>&
beginning
,
const
Dune
::
FieldVector
<
double
,
3
>&
end
)
{
// Compute the correct orientation
Rotation
<
3
,
double
>
orientation
=
Rotation
<
3
,
double
>::
identity
();
Dune
::
FieldVector
<
double
,
3
>
zAxis
(
0
);
zAxis
[
2
]
=
1
;
Dune
::
FieldVector
<
double
,
3
>
axis
=
crossProduct
(
end
-
beginning
,
zAxis
);
if
(
axis
.
two_norm
()
!=
0
)
axis
/=
-
axis
.
two_norm
();
Dune
::
FieldVector
<
double
,
3
>
d3
=
end
-
beginning
;
d3
/=
d3
.
two_norm
();
double
angle
=
std
::
acos
(
zAxis
*
d3
);
if
(
angle
!=
0
)
orientation
=
Rotation
<
3
,
double
>
(
axis
,
angle
);
// Set the values
rod
.
resize
(
n
);
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
rod
[
i
].
r
=
beginning
;
rod
[
i
].
r
.
axpy
(
double
(
i
)
/
(
n
-
1
),
end
-
beginning
);
rod
[
i
].
q
=
orientation
;
}
}
#endif
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