Skip to content
Snippets Groups Projects
Commit 51831e69 authored by Boris Martin's avatar Boris Martin
Browse files

added line acquisition .pos loading

parent cb3157fe
No related branches found
No related tags found
No related merge requests found
......@@ -163,43 +163,66 @@ namespace line_acquisition
*/
_mb.resize(model_size());
_mi.resize(model_size());
for (unsigned int c = 0; c < model_size(); c++)
{
double Remb, Immb;
if
(!
(
gmshFem.userDefinedParameter(Remb, "Re(mbc"+std::to_string(c)+")") &&
gmshFem.userDefinedParameter(Immb, "Im(mbc"+std::to_string(c)+")")
)
)
std::string m0_type = "constant";
std::string suffix = "c" + std::to_string(c);
if (!gmshFem.userDefinedParameter(m0_type, "m0_type" + suffix))
{
throw common::Exception("Background (reference) model parameter (component"+std::to_string(c)+") could not be found.");
msg::warning << "No value of m0_type" << suffix << " found. Using constant (per inclusion) by default." << msg::endl;
}
else
if (m0_type == "constant")
{
_mb[c] = Remb + im * Immb;
_mc[c] = _mb[c];
}
ScalarPiecewiseFunction< std::complex< double > > m0;
m0.addFunction(_mb[c],_background[Support::BLK] | _background[Support::BND] | _points);
double Remb, Immb;
if (!(
gmshFem.userDefinedParameter(Remb, "Re(mbc" + std::to_string(c) + ")") &&
gmshFem.userDefinedParameter(Immb, "Im(mbc" + std::to_string(c) + ")")))
{
throw common::Exception("Background (reference) model parameter (component" + std::to_string(c) + ") could not be found.");
}
else
{
_mb[c] = Remb + im * Immb;
_mc[c] = _mb[c];
}
ScalarPiecewiseFunction<std::complex<double>> m0;
m0.addFunction(_mb[c], _background[Support::BLK] | _background[Support::BND] | _points);
_mi[c].resize(_ni);
for (unsigned int i = 0; i < _ni; i++)
{
double Remi=0., Immi=0.;
if
(
!(gmshFem.userDefinedParameter(Remi, "Re(mi"+std::to_string(i)+"c"+std::to_string(c)+")") &&
gmshFem.userDefinedParameter(Immi, "Im(mi"+std::to_string(i)+"c"+std::to_string(c)+")"))
)
_mi[c].resize(_ni);
for (unsigned int i = 0; i < _ni; i++)
{
double Remi = 0., Immi = 0.;
if (
!(gmshFem.userDefinedParameter(Remi, "Re(mi" + std::to_string(i) + "c" + std::to_string(c) + ")") &&
gmshFem.userDefinedParameter(Immi, "Im(mi" + std::to_string(i) + "c" + std::to_string(c) + ")")))
{
throw Exception("Inclusion model parameter could not be found.");
}
_mi[c][i] = Remi + im * Immi;
m0.addFunction(_mi[c][i], _inclusion[i]);
}
_m0.push_back(m0);
}
else if (m0_type == "file.pos") {
std::string path = "";
if (!gmshFem.userDefinedParameter(path, "m0_path" + suffix))
{
throw Exception("Inclusion model parameter could not be found.");
throw common::Exception("Path to subsurface data could not be found.");
}
_mi[c][i] = Remi + im * Immi;
m0.addFunction(_mi[c][i],_inclusion[i]);
gmsh::merge(path + suffix + ".pos");
// Fix for weird tags when loading .pos files.
std::vector<int> tags;
gmsh::view::getTags(tags);
auto view = tags.back();
ScalarFunction<std::complex<double>> mpos = probeScalarView<std::complex<double>>(view);
_m0.push_back(mpos);
}
else {
throw Exception("Invalid model type: " + m0_type);
}
_m0.push_back(m0);
}
}
void Configuration::mesh() const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment