Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-tectonic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
agnumpde
dune-tectonic
Commits
1d495b6b
Commit
1d495b6b
authored
13 years ago
by
Elias Pipping
Committed by
Elias Pipping
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use shared pointers to avoid copying
parent
e19e8a1c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dune/tectonic/globallaursennonlinearity.hh
+6
-5
6 additions, 5 deletions
dune/tectonic/globallaursennonlinearity.hh
dune/tectonic/globalruinanonlinearity.hh
+11
-8
11 additions, 8 deletions
dune/tectonic/globalruinanonlinearity.hh
src/one-body-sample.cc
+14
-13
14 additions, 13 deletions
src/one-body-sample.cc
with
31 additions
and
26 deletions
dune/tectonic/globallaursennonlinearity.hh
+
6
−
5
View file @
1d495b6b
...
@@ -17,7 +17,8 @@ template <int dim, class OuterFunctionType>
...
@@ -17,7 +17,8 @@ template <int dim, class OuterFunctionType>
class
GlobalLaursenNonlinearity
:
public
GlobalNonlinearity
<
dim
>
{
class
GlobalLaursenNonlinearity
:
public
GlobalNonlinearity
<
dim
>
{
public:
public:
GlobalLaursenNonlinearity
(
GlobalLaursenNonlinearity
(
std
::
vector
<
double
>
const
&
mu
,
std
::
vector
<
double
>
const
&
normalStress
,
shared_ptr
<
std
::
vector
<
double
>
const
>
mu
,
shared_ptr
<
std
::
vector
<
double
>
const
>
normalStress
,
std
::
vector
<
FieldVector
<
double
,
1
>>
const
&
nodalIntegrals
)
std
::
vector
<
FieldVector
<
double
,
1
>>
const
&
nodalIntegrals
)
:
mu
(
mu
),
normalStress
(
normalStress
),
nodalIntegrals
(
nodalIntegrals
)
{}
:
mu
(
mu
),
normalStress
(
normalStress
),
nodalIntegrals
(
nodalIntegrals
)
{}
...
@@ -37,8 +38,8 @@ class GlobalLaursenNonlinearity : public GlobalNonlinearity<dim> {
...
@@ -37,8 +38,8 @@ class GlobalLaursenNonlinearity : public GlobalNonlinearity<dim> {
*/
*/
virtual
shared_ptr
<
LocalNonlinearity
<
dim
>
const
>
restriction
(
int
i
)
const
{
virtual
shared_ptr
<
LocalNonlinearity
<
dim
>
const
>
restriction
(
int
i
)
const
{
double
coefficient
=
nodalIntegrals
[
i
][
0
];
double
coefficient
=
nodalIntegrals
[
i
][
0
];
coefficient
*=
normalStress
[
i
];
coefficient
*=
(
*
normalStress
)
[
i
];
coefficient
*=
1
+
mu
[
i
];
coefficient
*=
1
+
(
*
mu
)
[
i
];
shared_ptr
<
NiceFunction
const
>
const
func
(
shared_ptr
<
NiceFunction
const
>
const
func
(
new
OuterFunctionType
(
coefficient
));
new
OuterFunctionType
(
coefficient
));
...
@@ -49,8 +50,8 @@ class GlobalLaursenNonlinearity : public GlobalNonlinearity<dim> {
...
@@ -49,8 +50,8 @@ class GlobalLaursenNonlinearity : public GlobalNonlinearity<dim> {
private
:
private
:
// TODO: If we're clever, we only store one vector with the precomputed
// TODO: If we're clever, we only store one vector with the precomputed
// results
// results
std
::
vector
<
double
>
mu
;
shared_ptr
<
std
::
vector
<
double
>
const
>
mu
;
std
::
vector
<
double
>
normalStress
;
shared_ptr
<
std
::
vector
<
double
>
const
>
normalStress
;
std
::
vector
<
FieldVector
<
double
,
1
>>
nodalIntegrals
;
std
::
vector
<
FieldVector
<
double
,
1
>>
nodalIntegrals
;
};
};
}
}
...
...
This diff is collapsed.
Click to expand it.
dune/tectonic/globalruinanonlinearity.hh
+
11
−
8
View file @
1d495b6b
...
@@ -17,8 +17,10 @@ class GlobalRuinaNonlinearity : public GlobalNonlinearity<dim> {
...
@@ -17,8 +17,10 @@ class GlobalRuinaNonlinearity : public GlobalNonlinearity<dim> {
public:
public:
GlobalRuinaNonlinearity
(
GlobalRuinaNonlinearity
(
std
::
vector
<
FieldVector
<
double
,
1
>>
const
&
nodalIntegrals
,
std
::
vector
<
FieldVector
<
double
,
1
>>
const
&
nodalIntegrals
,
std
::
vector
<
double
>
const
&
a
,
std
::
vector
<
double
>
const
&
mu
,
shared_ptr
<
std
::
vector
<
double
>
const
>
a
,
std
::
vector
<
double
>
const
&
eta
,
std
::
vector
<
double
>
const
&
normalStress
)
shared_ptr
<
std
::
vector
<
double
>
const
>
mu
,
shared_ptr
<
std
::
vector
<
double
>
const
>
eta
,
shared_ptr
<
std
::
vector
<
double
>
const
>
normalStress
)
:
nodalIntegrals
(
nodalIntegrals
),
:
nodalIntegrals
(
nodalIntegrals
),
a
(
a
),
a
(
a
),
mu
(
mu
),
mu
(
mu
),
...
@@ -34,8 +36,9 @@ class GlobalRuinaNonlinearity : public GlobalNonlinearity<dim> {
...
@@ -34,8 +36,9 @@ class GlobalRuinaNonlinearity : public GlobalNonlinearity<dim> {
if
(
nodalIntegrals
[
i
][
0
]
==
0
)
if
(
nodalIntegrals
[
i
][
0
]
==
0
)
return
trivialNonlinearity
;
return
trivialNonlinearity
;
shared_ptr
<
NiceFunction
const
>
const
func
(
new
RuinaFunction
(
shared_ptr
<
NiceFunction
const
>
const
func
(
nodalIntegrals
[
i
][
0
],
a
[
i
],
mu
[
i
],
eta
[
i
],
normalStress
[
i
]));
new
RuinaFunction
(
nodalIntegrals
[
i
][
0
],
(
*
a
)[
i
],
(
*
mu
)[
i
],
(
*
eta
)[
i
],
(
*
normalStress
)[
i
]));
return
shared_ptr
<
LocalNonlinearity
<
dim
>>
(
new
LocalNonlinearity
<
dim
>
(
func
));
return
shared_ptr
<
LocalNonlinearity
<
dim
>>
(
new
LocalNonlinearity
<
dim
>
(
func
));
}
}
...
@@ -43,10 +46,10 @@ class GlobalRuinaNonlinearity : public GlobalNonlinearity<dim> {
...
@@ -43,10 +46,10 @@ class GlobalRuinaNonlinearity : public GlobalNonlinearity<dim> {
shared_ptr
<
LocalNonlinearity
<
dim
>
const
>
const
trivialNonlinearity
;
shared_ptr
<
LocalNonlinearity
<
dim
>
const
>
const
trivialNonlinearity
;
std
::
vector
<
FieldVector
<
double
,
1
>>
nodalIntegrals
;
std
::
vector
<
FieldVector
<
double
,
1
>>
nodalIntegrals
;
std
::
vector
<
double
>
a
;
shared_ptr
<
std
::
vector
<
double
>
const
>
a
;
std
::
vector
<
double
>
mu
;
shared_ptr
<
std
::
vector
<
double
>
const
>
mu
;
std
::
vector
<
double
>
eta
;
shared_ptr
<
std
::
vector
<
double
>
const
>
eta
;
std
::
vector
<
double
>
normalStress
;
shared_ptr
<
std
::
vector
<
double
>
const
>
normalStress
;
};
};
}
}
#endif
#endif
This diff is collapsed.
Click to expand it.
src/one-body-sample.cc
+
14
−
13
View file @
1d495b6b
...
@@ -140,26 +140,27 @@ void assemble_nonlinearity(
...
@@ -140,26 +140,27 @@ void assemble_nonlinearity(
Dune
::
shared_ptr
<
Dune
::
GlobalNonlinearity
<
dim
>
const
>
&
myGlobalNonlinearity
,
Dune
::
shared_ptr
<
Dune
::
GlobalNonlinearity
<
dim
>
const
>
&
myGlobalNonlinearity
,
std
::
vector
<
Dune
::
FieldVector
<
double
,
1
>>
&
nodalIntegrals
)
{
std
::
vector
<
Dune
::
FieldVector
<
double
,
1
>>
&
nodalIntegrals
)
{
// {{{ Assemble terms for the nonlinearity
// {{{ Assemble terms for the nonlinearity
std
::
vector
<
double
>
mu
;
auto
mu
=
Dune
::
shared_ptr
<
std
::
vector
<
double
>>
(
new
std
::
vector
<
double
>
());
mu
.
resize
(
size
);
mu
->
resize
(
size
);
std
::
fill
(
mu
.
begin
(),
mu
.
end
(),
parset
.
get
<
double
>
(
"boundary.friction.mu"
));
std
::
fill
(
mu
->
begin
(),
mu
->
end
(),
parset
.
get
<
double
>
(
"boundary.friction.mu"
));
std
::
vector
<
double
>
normalStress
;
auto
normalStress
=
normalStress
.
resize
(
size
);
Dune
::
shared_ptr
<
std
::
vector
<
double
>>
(
new
std
::
vector
<
double
>
());
std
::
fill
(
normalStress
.
begin
(),
normalStress
.
end
(),
normalStress
->
resize
(
size
);
std
::
fill
(
normalStress
->
begin
(),
normalStress
->
end
(),
parset
.
get
<
double
>
(
"boundary.friction.normalstress"
));
parset
.
get
<
double
>
(
"boundary.friction.normalstress"
));
std
::
string
const
friction_model
=
std
::
string
const
friction_model
=
parset
.
get
<
std
::
string
>
(
"boundary.friction.model"
);
parset
.
get
<
std
::
string
>
(
"boundary.friction.model"
);
if
(
friction_model
==
std
::
string
(
"Ruina"
))
{
if
(
friction_model
==
std
::
string
(
"Ruina"
))
{
std
::
vector
<
double
>
a
;
auto
a
=
Dune
::
shared_ptr
<
std
::
vector
<
double
>>
(
new
std
::
vector
<
double
>
())
;
a
.
resize
(
size
);
a
->
resize
(
size
);
std
::
fill
(
a
.
begin
(),
a
.
end
(),
std
::
fill
(
a
->
begin
(),
a
->
end
(),
parset
.
get
<
double
>
(
"boundary.friction.ruina.a"
));
parset
.
get
<
double
>
(
"boundary.friction.ruina.a"
));
std
::
vector
<
double
>
eta
;
auto
eta
=
Dune
::
shared_ptr
<
std
::
vector
<
double
>>
(
new
std
::
vector
<
double
>
())
;
eta
.
resize
(
size
);
eta
->
resize
(
size
);
std
::
fill
(
eta
.
begin
(),
eta
.
end
(),
std
::
fill
(
eta
->
begin
(),
eta
->
end
(),
parset
.
get
<
double
>
(
"boundary.friction.eta"
));
parset
.
get
<
double
>
(
"boundary.friction.eta"
));
auto
const
tmp
=
new
Dune
::
GlobalRuinaNonlinearity
<
dim
>
(
auto
const
tmp
=
new
Dune
::
GlobalRuinaNonlinearity
<
dim
>
(
...
...
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