49int main(
int argc,
char *argv[])
51 const char *mesh_file =
"../../data/inline-quad.mesh";
56 bool visualization = 1;
60 args.
AddOption(&mesh_file,
"-m",
"--mesh",
61 "Input mesh to extrude.");
62 args.
AddOption(&order,
"-o",
"--mesh-order",
63 "Order (polynomial degree) of the mesh elements.");
64 args.
AddOption(&ny,
"-ny",
"--num-elem-in-y",
65 "Extrude a 1D mesh into ny elements in the y-direction.");
66 args.
AddOption(&wy,
"-wy",
"--width-in-y",
67 "Extrude a 1D mesh to a width wy in the y-direction.");
68 args.
AddOption(&nz,
"-nz",
"--num-elem-in-z",
69 "Extrude a 2D mesh into nz elements in the z-direction.");
70 args.
AddOption(&hz,
"-hz",
"--height-in-z",
71 "Extrude a 2D mesh to a height hz in the z-direction.");
74 "Enable or disable mesh transformation after extrusion.");
75 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
77 "Enable or disable GLVis visualization.");
83 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
90 ny = (ny < 0) ? 1 : ny;
91 nz = (nz < 0) ? 0 : nz;
95 nz = (nz < 0) ? 1 : nz;
98 cout <<
"Extruding " <<
dim <<
"D meshes is not (yet) supported."
110 if (order < 0 &&
trans)
115 bool newMesh =
false;
117 if (
dim == 1 && ny > 0)
119 cout <<
"Extruding 1D mesh to a width of " << wy
120 <<
" using " << ny <<
" elements." << endl;
128 if (order != meshOrder)
136 if (
dim == 2 && nz > 0)
138 cout <<
"Extruding 2D mesh to a height of " << hz
139 <<
" using " << nz <<
" elements." << endl;
147 if (order != meshOrder)
164 sol_sock.precision(8);
165 sol_sock <<
"mesh\n" << *mesh << flush;
169 ofstream mesh_ofs(
"extruder.mesh");
170 mesh_ofs.precision(8);
171 mesh->
Print(mesh_ofs);
175 cout <<
"No mesh extrusion performed." << endl;
183 p[0] = x[0] + 0.25 * sin(M_PI * x[1]);
189 real_t r = sqrt(x[0] * x[0] + x[1] * x[1]);
190 real_t theta = atan2(x[1], x[0]);
191 p[0] = r * cos(theta + 0.25 * M_PI * x[2]);
192 p[1] = r * sin(theta + 0.25 * M_PI * x[2]);
int GetElementOrder(int i) const
Returns the order of the i'th finite element.
const FiniteElementSpace * GetNodalFESpace() const
virtual void Print(std::ostream &os=mfem::out, const std::string &comments="") const
int Dimension() const
Dimension of the reference space used within the elements.
virtual void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1)
Set the curvature of the mesh nodes using the given polynomial degree.
void Transform(void(*f)(const Vector &, Vector &))
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void PrintUsage(std::ostream &out) const
Print the usage message.
void PrintOptions(std::ostream &out) const
Print the options.
void AddOption(bool *var, const char *enable_short_name, const char *enable_long_name, const char *disable_short_name, const char *disable_long_name, const char *description, bool required=false)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
bool Good() const
Return true if the command line options were parsed successfully.
void trans(const Vector &u, Vector &x)
void trans3D(const Vector &, Vector &)
void trans2D(const Vector &, Vector &)
Mesh * Extrude1D(Mesh *mesh, const int ny, const real_t sy, const bool closed)
Extrude a 1D mesh.
Mesh * Extrude2D(Mesh *mesh, const int nz, const real_t sz)
Extrude a 2D mesh.
real_t p(const Vector &x, real_t t)