Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
fwi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gmsh
fwi
Commits
3e687aaa
Commit
3e687aaa
authored
2 years ago
by
Boris Martin
Browse files
Options
Downloads
Patches
Plain Diff
introduced unique_ptrs
parent
c26a1a37
No related branches found
No related tags found
2 merge requests
!10
Draft: Source estimation
,
!9
Introducing unique_ptrs to simplify memory management
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
specific/optimization/globalminimumsearch/sequential.cpp
+10
-7
10 additions, 7 deletions
specific/optimization/globalminimumsearch/sequential.cpp
with
10 additions
and
7 deletions
specific/optimization/globalminimumsearch/sequential.cpp
+
10
−
7
View file @
3e687aaa
...
...
@@ -12,8 +12,13 @@
#include
"../../optimization/linesearch/newLineSearch.h"
#include
"../../optimization/localminimumsearch/newLocalMinimumSearch.h"
// STL
#include
<memory>
using
namespace
gmshfem
;
using
namespace
gmshfem
::
common
;
using
std
::
unique_ptr
;
using
std
::
make_unique
;
namespace
sequential
{
...
...
@@ -143,9 +148,8 @@ namespace sequential
ObjectiveInterface
<
T_Physic
>*
const
objective
=
newObjective
<
T_Physic
>
(
d0
,
_config
,
_gmshFem
,
_suffix
);
InnerProductInterface
*
const
innerproduct
=
newInnerProduct
(
_config
,
*
m
,
_gmshFem
,
_suffix
);
RegularizationInterface
*
const
regularization
=
newRegularization
(
_config
,
*
m
,
_gmshFem
,
_suffix
);
StateFunctional
<
T_Physic
>*
const
statefunctional
=
new
StateFunctional
<
T_Physic
>
(
_config
,
innerproduct
,
regularization
,
d0
.
frequency
(),
equation
,
objective
);
FunctionalInterface
*
const
functional
=
statefunctional
;
functional
->
setModel
(
*
m
);
auto
statefunctional
=
make_unique
<
StateFunctional
<
T_Physic
>>
(
_config
,
innerproduct
,
regularization
,
d0
.
frequency
(),
equation
,
objective
);
statefunctional
->
setModel
(
*
m
);
LocalMinimumSearchInterface
*
const
minimumsearch
=
newLocalMinimumSearch
(
_gmshFem
);
DescentSearchInterface
*
const
descentsearch
=
newDescentSearch
(
_gmshFem
);
...
...
@@ -154,7 +158,7 @@ namespace sequential
std
::
vector
<
GlobalMinimumSearchHistoryLine2
>
historyline
;
double
js_1
=
0.
;
double
js
=
functional
->
performance
();
double
js
=
state
functional
->
performance
();
historyline
.
emplace_back
(
js
,
0.
,
0.
,
statefunctional
->
performance_objective
(),
statefunctional
->
performance_regularization
());
double
rel_djs
=
0.
;
bool
success
=
false
;
...
...
@@ -181,8 +185,8 @@ namespace sequential
}
minimumsearch
->
name
(
_name
+
"g"
+
_suffix
+
"s"
+
suffix1
);
js_1
=
js
;
(
*
minimumsearch
)(
m
,
functional
,
descentsearch
,
linesearch
);
js
=
functional
->
performance
();
(
*
minimumsearch
)(
m
,
state
functional
.
get
()
,
descentsearch
,
linesearch
);
js
=
state
functional
->
performance
();
m
->
write
(
_name
+
"_mg"
+
_suffix
+
"s"
+
suffix1
);
//statefunctional->write_data(Type::FS,_name+"_dg"+_suffix+"s"+suffix1,"pos");
rel_djs
=
2.
*
(
js_1
-
js
)
/
(
js_1
+
js
);
...
...
@@ -204,7 +208,6 @@ namespace sequential
delete
descentsearch
;
delete
linesearch
;
delete
functional
;
delete
innerproduct
;
delete
regularization
;
delete
objective
;
...
...
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