49int main(
int argc,
char *argv[])
51 const char *mesh_file =
"../../data/inline-quad.mesh";
56 bool visualization = 1;
61 args.
AddOption(&mesh_file,
"-m",
"--mesh",
62 "Input mesh to extrude.");
63 args.
AddOption(&order,
"-o",
"--mesh-order",
64 "Order (polynomial degree) of the mesh elements.");
65 args.
AddOption(&ny,
"-ny",
"--num-elem-in-y",
66 "Extrude a 1D mesh into ny elements in the y-direction.");
67 args.
AddOption(&wy,
"-wy",
"--width-in-y",
68 "Extrude a 1D mesh to a width wy in the y-direction.");
69 args.
AddOption(&nz,
"-nz",
"--num-elem-in-z",
70 "Extrude a 2D mesh into nz elements in the z-direction.");
71 args.
AddOption(&hz,
"-hz",
"--height-in-z",
72 "Extrude a 2D mesh to a height hz in the z-direction.");
75 "Enable or disable mesh transformation after extrusion.");
76 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
78 "Enable or disable GLVis visualization.");
79 args.
AddOption(&visport,
"-p",
"--send-port",
"Socket for GLVis.");
85 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
92 ny = (ny < 0) ? 1 : ny;
93 nz = (nz < 0) ? 0 : nz;
97 nz = (nz < 0) ? 1 : nz;
100 cout <<
"Extruding " <<
dim <<
"D meshes is not (yet) supported."
112 if (order < 0 &&
trans)
117 bool newMesh =
false;
119 if (
dim == 1 && ny > 0)
121 cout <<
"Extruding 1D mesh to a width of " << wy
122 <<
" using " << ny <<
" elements." << endl;
130 if (order != meshOrder)
138 if (
dim == 2 && nz > 0)
140 cout <<
"Extruding 2D mesh to a height of " << hz
141 <<
" using " << nz <<
" elements." << endl;
149 if (order != meshOrder)
165 sol_sock.precision(8);
166 sol_sock <<
"mesh\n" << *mesh << flush;
170 ofstream mesh_ofs(
"extruder.mesh");
171 mesh_ofs.precision(8);
172 mesh->
Print(mesh_ofs);
176 cout <<
"No mesh extrusion performed." << endl;
184 p[0] = x[0] + 0.25 * sin(M_PI * x[1]);
190 real_t r = sqrt(x[0] * x[0] + x[1] * x[1]);
191 real_t theta = atan2(x[1], x[0]);
192 p[0] = r * cos(theta + 0.25 * M_PI * x[2]);
193 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)