Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F62555775
beck_teboulle.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, May 13, 23:53
Size
2 KB
Mime Type
text/x-c
Expires
Wed, May 15, 23:53 (2 d)
Engine
blob
Format
Raw Data
Handle
17662444
Attached To
rTAMAAS tamaas
beck_teboulle.cpp
View Options
/**
* @file
*
* @author Son Pham-Ba <son.phamba@epfl.ch>
*
* @section LICENSE
*
* Copyright (©) 2016-2018 EPFL (Ecole Polytechnique Fédérale de
* Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des
* Solides)
*
* Tamaas is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* Tamaas is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Tamaas. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#include "beck_teboulle.hh"
#include <iomanip>
/* -------------------------------------------------------------------------- */
__BEGIN_TAMAAS__
BeckTeboulle
::
BeckTeboulle
(
Model
&
model
,
const
GridBase
<
Real
>&
surface
,
Real
tolerance
,
Real
mu
)
:
Kato
(
model
,
surface
,
tolerance
,
mu
)
{}
/* -------------------------------------------------------------------------- */
Real
BeckTeboulle
::
solve
(
GridBase
<
Real
>&
g0
)
{
Real
cost
=
0
;
UInt
n
=
0
;
// Printing column headers
std
::
cout
<<
std
::
setw
(
5
)
<<
"Iter"
<<
" "
<<
std
::
setw
(
15
)
<<
"Cost_f"
<<
" "
<<
std
::
setw
(
15
)
<<
"Error"
<<
'\n'
<<
std
::
fixed
;
*
pressure
=
0
;
do
{
engine
.
solveNeumann
(
*
pressure
,
*
gap
);
(
model
.
getType
()
==
model_type
::
surface_1d
)
?
addUniform
<
2
>
(
*
gap
,
g0
)
:
addUniform
<
3
>
(
*
gap
,
g0
);
*
gap
-=
surfaceComp
;
*
pressure
-=
*
gap
;
(
model
.
getType
()
==
model_type
::
surface_1d
)
?
enforcePressureCoulomb
<
model_type
::
surface_1d
>
()
:
enforcePressureCoulomb
<
model_type
::
surface_2d
>
();
cost
=
computeCost
();
printState
(
n
,
cost
,
cost
);
}
while
(
cost
>
this
->
tolerance
&&
n
++
<
this
->
max_iterations
);
Real
beta
=
0
;
switch
(
model
.
getType
())
{
case
model_type
::
surface_1d:
beta
=
computeBeta
<
model_type
::
surface_1d
>
();
computeFinalGap
<
model_type
::
surface_1d
>
(
beta
);
break
;
case
model_type
::
surface_2d:
beta
=
computeBeta
<
model_type
::
surface_2d
>
();
computeFinalGap
<
model_type
::
surface_2d
>
(
beta
);
break
;
default
:
break
;
}
model
.
getDisplacement
()
=
*
gap
;
return
cost
;
}
__END_TAMAAS__
/* -------------------------------------------------------------------------- */
Event Timeline
Log In to Comment