21#include "rheolef/adapt.h"
22#include "rheolef/form.h"
23#include "rheolef/field_wdof_sliced.h"
24#include "rheolef/rheostream.h"
25#include "rheolef/field_expr.h"
30template<
class T,
class M>
33 const field_basic<T,M>& uh0,
34 const adapt_option& opts);
39template<
class T,
class M>
48 bool do_verbose = iorheo::getverbose(clog);
49 bool do_clean = iorheo::getclean(clog);
50 string command, clean_files;
56 string i_name = omega.name();
57 string geo_name = i_name +
".geo";
63 check_macro (out.good(),
"adapt: file \"" << geo_name <<
"\"creation failed");
65 clean_files +=
" " + geo_name;
70 string crit_name = i_name +
"-crit.field";
71 clean_files +=
" " + crit_name +
".gz";
72 out.open (crit_name,
"field");
74 check_macro (out.good(),
"adapt: file \"" << crit_name <<
"\"creation failed");
79 string pos_name = i_name +
"-crit.pos";
80 clean_files +=
" " + pos_name;
82 command =
"zcat " + crit_name +
".gz | " + bindir +
"/field2gmsh_pos > " + pos_name;
83 if (do_verbose) derr <<
"! " << command << endl;
91 string mshcad_file = omega.familyname() +
".mshcad";
93 string options =
"-clmin " +
ftos(opts.
hmin)
97 sprintf (buffer,
"%.3d",
int(i+1));
98 string i1_name = omega.familyname() +
"-" + buffer;
100 string algo = (
d <= 1) ?
"meshadapt" : (
d == 2) ?
"bamg" :
"mmg3d";
101 command =
"gmsh " + options
103 +
" -" + std::to_string(
d) +
" -algo " + algo
104 +
" -bgm " + pos_name
105 +
" -format msh2 -o " + i1_name +
".msh";
106 if (do_verbose) derr <<
"! " << command << endl;
111 command =
"msh2geo -" + omega.coordinate_system_name()
112 +
" " + i1_name +
".msh | gzip -9 > " + i1_name +
".geo.gz";
113 if (do_verbose) derr <<
"! " << command << endl;
115 clean_files +=
" " + i1_name +
".msh";
122 new_omega.set_name (omega.familyname());
123 new_omega.set_serial_number (i+1);
124 clean_files +=
" " + i1_name +
".geo";
125 clean_files +=
" " + i1_name +
".geo.gz";
130 command =
"rm -f" + clean_files;
131 if (do_verbose) derr <<
"! " << command << endl;
140#define _RHEOLEF_instanciation(T,M) \
141template geo_basic<T,M> adapt_gmsh (const field_basic<T,M>&, const adapt_option&);
144#ifdef _RHEOLEF_HAVE_MPI
#define _RHEOLEF_instanciation(T, M, A)
field::size_type size_type
see the Float page for the full documentation
const geo_type & get_geo() const
generic mesh with rerefence counting
idiststream: see the diststream page for the full documentation
odiststream: see the diststream page for the full documentation
#define _RHEOLEF_RHEOLEF_LIBDIR
#define trace_macro(message)
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
This file is part of Rheolef.
field_basic< T, M > hessian_criterion(const field_basic< T, M > &uh0, const adapt_option &opts)
geo_basic< T, M > adapt_gmsh(const field_basic< T, M > &uh, const adapt_option &opts)
int dis_system(const std::string &command, const communicator &comm)
bool dis_file_exists(const std::string &filename, const communicator &comm)
string ftos(const Float &x)
itof: see the rheostream page for the full documentation
adapt_option: see the adapt page for the full documentation