Skip to content
Snippets Groups Projects
Commit 5dba16e9 authored by Xavier Adriaens's avatar Xavier Adriaens
Browse files

Merge branch 'cleanup_configuuration_mesh' into 'master'

Refactoring of Configuration::mesh() where a default implementation is usually good enough.

See merge request !5
parents deba3cf9 4c3da417
No related branches found
No related tags found
1 merge request!5Refactoring of Configuration::mesh() where a default implementation is usually good enough.
...@@ -3,11 +3,36 @@ ...@@ -3,11 +3,36 @@
//GmshFWI Library //GmshFWI Library
#include "configuration.h" #include "configuration.h"
#include <gmsh.h>
namespace gmodel = gmsh::model;
namespace factory = gmsh::model::geo;
using namespace gmshfem; using namespace gmshfem;
using namespace gmshfem::common; using namespace gmshfem::common;
using namespace gmshfem::domain; using namespace gmshfem::domain;
void ConfigurationInterface::mesh() const
{
msg::print << "Generate meshes" << msg::endl;
gmsh::option::setNumber("General.Terminal", 1);
gmodel::add(_name);
if (!_remesh)
{
gmsh::open(_name + ".msh");
return;
}
wave_mesh();
data_mesh();
factory::synchronize();
gmodel::mesh::generate();
gmsh::write(_name + ".msh");
}
bool ConfigurationInterface::recIsValid(unsigned int shot,unsigned int rec) const bool ConfigurationInterface::recIsValid(unsigned int shot,unsigned int rec) const
{ {
if( !(shot<_ns) && !(rec<nr(shot)) ) if( !(shot<_ns) && !(rec<nr(shot)) )
......
...@@ -51,7 +51,7 @@ public: ...@@ -51,7 +51,7 @@ public:
}; };
virtual ~ConfigurationInterface() {delete _parametrization;}; virtual ~ConfigurationInterface() {delete _parametrization;};
virtual void mesh() const = 0; virtual void mesh() const;
virtual double area() const = 0; virtual double area() const = 0;
virtual double data_area() const {return gmshfem::post::integrate(1._d_sf,_data_omega,"Gauss0");}; virtual double data_area() const {return gmshfem::post::integrate(1._d_sf,_data_omega,"Gauss0");};
virtual double datapoint_area() const = 0; virtual double datapoint_area() const = 0;
......
...@@ -264,26 +264,7 @@ namespace circular_acquisition ...@@ -264,26 +264,7 @@ namespace circular_acquisition
} }
} }
void Configuration::mesh() const
{
msg::print << "Generate meshes" << msg::endl;
gmsh::option::setNumber("General.Terminal", 1);
gmodel::add(_name);
if(!_remesh)
{
gmsh::open(_name+".msh");
return;
}
wave_mesh();
data_mesh();
factory::synchronize();
gmodel::mesh::generate();
gmsh::write(_name+".msh");
}
void Configuration::wave_mesh() const void Configuration::wave_mesh() const
{ {
int p0 = factory::addPoint(0., 0., 0., _h); int p0 = factory::addPoint(0., 0., 0., _h);
......
...@@ -477,26 +477,6 @@ namespace layeredvolume_acquisition ...@@ -477,26 +477,6 @@ namespace layeredvolume_acquisition
} }
} }
void Configuration::mesh() const
{
msg::print << "Generate meshes" << msg::endl;
gmsh::option::setNumber("General.Terminal", 1);
gmodel::add(_name);
if(!_remesh)
{
gmsh::open(_name+".msh");
return;
}
wave_mesh();
data_mesh();
factory::synchronize();
gmodel::mesh::generate();
gmsh::write(_name+".msh");
}
void Configuration::wave_mesh() const void Configuration::wave_mesh() const
{ {
std::vector<int> pl1(_layercoord1.size()); std::vector<int> pl1(_layercoord1.size());
......
...@@ -265,24 +265,7 @@ namespace surface_acquisition ...@@ -265,24 +265,7 @@ namespace surface_acquisition
} }
} }
void Configuration::mesh() const
{
msg::print << "Generate meshes" << msg::endl;
gmsh::option::setNumber("General.Terminal", 1);
gmodel::add(_name);
if(!_remesh)
{
gmsh::open(_name+".msh");
return;
}
wave_mesh();
data_mesh();
factory::synchronize();
gmodel::mesh::generate();
gmsh::write(_name+".msh");
}
void Configuration::wave_mesh() const void Configuration::wave_mesh() const
{ {
double Le0 = (_L - _Ler)/2.; double Le0 = (_L - _Ler)/2.;
......
...@@ -341,26 +341,6 @@ namespace volume_acquisition ...@@ -341,26 +341,6 @@ namespace volume_acquisition
} }
} }
void Configuration::mesh() const
{
msg::print << "Generate meshes" << msg::endl;
gmsh::option::setNumber("General.Terminal", 1);
gmodel::add(_name);
if(!_remesh)
{
gmsh::open(_name+".msh");
return;
}
wave_mesh();
data_mesh();
factory::synchronize();
gmodel::mesh::generate();
gmsh::write(_name+".msh");
}
void Configuration::wave_mesh() const void Configuration::wave_mesh() const
{ {
int pb1 = factory::addPoint(0., 0., 0., _h); int pb1 = factory::addPoint(0., 0., 0., _h);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment