field2bb.cc
Go to the documentation of this file.
//
// Passage du format field au format bb de Bamg
//
// author: Pierre.Saramito@imag.fr
//
// date: 03/09/1997 ; 04/01/2018
//
/*Prog:field2bb
NAME: @code{field2bb} - convert from .field file format to bamg .bb one
@pindex field2bb
@fiindex @file{.bb} bamg field
@fiindex @file{.field} field
@toindex @code{bamg}
SYNOPSIS:
@example
field2bb < @var{input}.field > @var{output}.bb
@end example
DESCRIPTION:
Convert a @file{.field} file into a bamg @file{.bb} one.
The output goes to standart output.
This command is useful for mesh adaptation with @code{bamg}.
LIMITATION:
Do not support yet tensor valued .field files.
This could be interessant for specifying directly
a metric for mesh adaptation.
End:*/
#include "scatch.icc"
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <limits>
using namespace std;
using namespace rheolef;
int main()
{
// Lecture du fichier field
//-------------------------
scatch (cin, "field", true);
string ch1;
cin >> ch1;// version
size_t version = atoi(ch1.c_str());
if (version != 1) {
cerr << "field2bb: version " << version << " field format not yet supported" << endl;
exit (1);
}
cin >> ch1;
size_t nbpts = atoi(ch1.c_str());
cin >> ch1 // mesh name
>> ch1; // approx
if (ch1 != "P1") {
cerr << "field2bb: approx " << ch1 << " field not yet supported" << endl;
exit (1);
}
vector<double> u (nbpts);
for (size_t i=0; i<nbpts; i++) {
cin >> ch1;
u[i] = atof(ch1.c_str());
}
// Ecriture sur le fichier bb
//---------------------------
cout << setprecision(numeric_limits<double>::digits10)
<< "2 1 " << nbpts << " 2" << endl;
for (size_t i=0; i<nbpts; i++) {
cout << u[i] << endl;
}
}
rheolef::std
Definition: vec_expr_v2.h:402
main
int main()
Definition: field2bb.cc:58
rheolef-config.version
version
Definition: rheolef-config.in:126
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::scatch
bool scatch(std::istream &in, const std::string &ch, bool full_match=true)
scatch: see the rheostream page for the full documentation
Definition: scatch.icc:52
scatch.icc
u
Definition: leveque.h:25
u
Float u(const point &x)
Definition: transmission_error.cc:26