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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gmsh
fwi
Commits
12a8ff79
Commit
12a8ff79
authored
2 years ago
by
Boris Martin
Browse files
Options
Downloads
Patches
Plain Diff
Reading shots from YAML
parent
7bd63ceb
No related branches found
No related tags found
1 merge request
!6
Draft: "Flexible acquisition", a configuration with arbitrary sources and receivers read from a YAML file.
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+5
-0
5 additions, 0 deletions
CMakeLists.txt
specific/configuration/flexible_acquisition.cpp
+26
-20
26 additions, 20 deletions
specific/configuration/flexible_acquisition.cpp
specific/configuration/yaml_interface.h
+100
-0
100 additions, 0 deletions
specific/configuration/yaml_interface.h
with
131 additions
and
20 deletions
CMakeLists.txt
+
5
−
0
View file @
12a8ff79
...
...
@@ -185,6 +185,10 @@ endif(NOT GMSH_INC)
list
(
APPEND EXTRA_INCS
${
GMSH_INC
}
)
list
(
APPEND EXTRA_LIBS
${
GMSH_LIB
}
)
# Yaml-cpp
find_package
(
yaml-cpp REQUIRED
)
# GmshFem
find_library
(
GMSHFEM_LIB gmshfem
)
...
...
@@ -222,6 +226,7 @@ include_directories(${EXTRA_INCS})
file
(
GLOB LIB_SOURCES contrib/blossom5v2.05/*.cpp contrib/blossom5v2.05/*/*.cpp common/*/*/*.cpp common/*/*.cpp common/*.cpp specific/*/*/*.cpp specific/*/*.cpp specific/*.cpp
)
file
(
GLOB LIB_HEADERS contrib/blossom5v2.05/*.h contrib/blossom5v2.05/*/*.h common/*/*/*.h common/*/*.h common/*.h specific/*/*/*.h specific/*/*.h specific/*.h
)
add_library
(
fwi
${
LIB_SOURCES
}
${
LIB_HEADERS
}
)
target_link_libraries
(
fwi yaml-cpp
)
add_executable
(
synthetics synthetics.cpp
${
EXTRA_INCS
}
)
target_link_libraries
(
synthetics fwi
${
EXTRA_LIBS
}
)
...
...
This diff is collapsed.
Click to expand it.
specific/configuration/flexible_acquisition.cpp
+
26
−
20
View file @
12a8ff79
...
...
@@ -18,6 +18,7 @@
#include
"../../common/data/element.h"
#include
"../wave/correlation.h"
#include
"flexible_acquisition.h"
#include
"yaml_interface.h"
namespace
gmodel
=
gmsh
::
model
;
namespace
factory
=
gmsh
::
model
::
geo
;
...
...
@@ -54,13 +55,34 @@ namespace flexible_acquisition
throw
common
::
Exception
(
"A geometric parameter could not be found."
);
}
// Setup E/R
_er_positions
.
emplace_back
(
0.4
,
-
0.5
);
_er_positions
.
emplace_back
(
0.5
,
-
0.5
);
_er_positions
.
emplace_back
(
0.6
,
-
0.5
);
// SETUP FROM YAML
// TODO read path
ShotsConfigurationYAML
shotsConfig
(
"shots.yaml"
);
_ns
=
shotsConfig
.
numShots
();
// Configure points
for
(
const
auto
&
coords
:
shotsConfig
.
points
())
{
_er_positions
.
push_back
(
coords
);
}
mesh
();
// Configure shots
for
(
unsigned
s
=
0
;
s
<
shotsConfig
.
numShots
();
++
s
)
{
_emitter
.
push_back
(
shotsConfig
.
emitters
(
s
));
_receiver
.
push_back
(
shotsConfig
.
receivers
(
s
));
}
for
(
unsigned
p
=
0
;
p
<
_er_positions
.
size
();
++
p
)
{
_point
.
push_back
(
"emitter_receiver_"
+
std
::
to_string
(
p
));
_points
|=
_point
[
p
];
}
/*
* DOMAIN
*/
...
...
@@ -72,7 +94,6 @@ namespace flexible_acquisition
_supersurface
[
Support
::
BLK
]
=
Domain
(
"supersurface"
);
_supersurface
[
Support
::
BND
]
=
Domain
(
"supersurface_bnd"
);
// TODO: define as supersurface and subsurface
std
::
string
unknownRegion
=
"subsurface"
;
gmshFem
.
userDefinedParameter
(
unknownRegion
,
"unknown"
);
if
(
unknownRegion
==
"subsurface"
)
...
...
@@ -95,21 +116,6 @@ namespace flexible_acquisition
_wave_omega
[
Support
::
BLK
]
=
_model_known
[
Support
::
BLK
]
|
_model_unknown
[
Support
::
BLK
];
_wave_omega
[
Support
::
BND
]
=
_model_known
[
Support
::
BND
]
|
_model_unknown
[
Support
::
BND
];
for
(
unsigned
p
=
0
;
p
<
_er_positions
.
size
();
++
p
)
{
_point
.
push_back
(
"emitter_receiver_"
+
std
::
to_string
(
p
));
_points
|=
_point
[
p
];
}
// Setup number of emitters etc. TODO: make some points only receivers
_ns
=
_er_positions
.
size
();
for
(
unsigned
s
=
0
;
s
<
_ns
;
++
s
)
{
_emitter
.
push_back
({
s
});
}
// TMP: each emitter is its receptor
for
(
unsigned
s
=
0
;
s
<
_ns
;
++
s
)
{
_receiver
.
push_back
({
s
});
}
...
...
This diff is collapsed.
Click to expand it.
specific/configuration/yaml_interface.h
0 → 100644
+
100
−
0
View file @
12a8ff79
#ifndef H_YAML_INTERFACE_SHOTS
#define H_YAML_INTERFACE_SHOTS
#include
<vector>
#include
<string>
#include
<utility>
#include
"yaml-cpp/yaml.h"
// TODO: refactor (abstract + impl)
class
ShotsConfigurationInterface
//(abstract)
{
public:
using
Coordinates
=
std
::
pair
<
double
,
double
>
;
/**
* Describe the number of shots
*/
virtual
unsigned
numShots
()
const
=
0
;
/**
* Describe the number of points
*/
virtual
unsigned
numPoints
()
const
=
0
;
/**
* emitters(s) is the list of enabled emitters in shot "s".
* Array must be of size numShots()
*/
virtual
const
std
::
vector
<
unsigned
>
&
emitters
(
unsigned
shot
)
const
=
0
;
/**
* receivers(s) is the list of enabled receivers in shot "s".
* Array must be of size numShots()
*/
virtual
const
std
::
vector
<
unsigned
>
&
receivers
(
unsigned
shot
)
const
=
0
;
/**
* List of all points
* Array must be of size numPoints()
*/
virtual
const
std
::
vector
<
Coordinates
>
&
points
()
const
=
0
;
};
class
ShotsConfigurationYAML
:
public
ShotsConfigurationInterface
{
private:
std
::
vector
<
std
::
vector
<
unsigned
>>
_emitters
,
_receivers
;
std
::
vector
<
ShotsConfigurationInterface
::
Coordinates
>
_points
;
public:
ShotsConfigurationYAML
(
const
std
::
string
&
path
)
{
YAML
::
Node
config
=
YAML
::
LoadFile
(
path
);
for
(
const
auto
&
coord
:
config
[
"coordinates"
])
{
double
x
=
coord
[
0
].
as
<
double
>
();
double
y
=
coord
[
1
].
as
<
double
>
();
_points
.
emplace_back
(
x
,
y
);
}
for
(
const
auto
&
shot
:
config
[
"shots"
])
{
std
::
vector
<
unsigned
>
emitters
,
receivers
;
for
(
const
auto
&
emitter
:
shot
[
"emitters"
])
{
emitters
.
push_back
(
emitter
.
as
<
int
>
());
}
for
(
const
auto
&
receiver
:
shot
[
"receivers"
])
{
receivers
.
push_back
(
receiver
.
as
<
int
>
());
}
_emitters
.
push_back
(
std
::
move
(
emitters
));
_receivers
.
push_back
(
std
::
move
(
receivers
));
}
}
virtual
unsigned
numShots
()
const
override
{
return
_emitters
.
size
();
}
virtual
unsigned
numPoints
()
const
override
{
return
_points
.
size
();
}
virtual
const
std
::
vector
<
unsigned
>
&
emitters
(
unsigned
shot
)
const
override
{
return
_emitters
.
at
(
shot
);
}
virtual
const
std
::
vector
<
unsigned
>
&
receivers
(
unsigned
shot
)
const
override
{
return
_receivers
.
at
(
shot
);
}
virtual
const
std
::
vector
<
Coordinates
>
&
points
()
const
override
{
return
_points
;
}
};
#endif
\ No newline at end of file
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