49 int main(
int argc,
char *argv[])
51 const char *mesh_file =
"../../data/inline-quad.mesh";
54 double wy = 1.0, hz = 1.0;
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 double r = sqrt(x[0] * x[0] + x[1] * x[1]);
190 double 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 main(int argc, char *argv[])
void trans(const Vector &u, Vector &x)
const FiniteElementSpace * GetNodalFESpace() const
void PrintOptions(std::ostream &out) const
Print the options.
void trans2D(const Vector &, Vector &)
void PrintUsage(std::ostream &out) const
Print the usage message.
Mesh * Extrude1D(Mesh *mesh, const int ny, const double sy, const bool closed)
Extrude a 1D mesh.
void Transform(void(*f)(const Vector &, Vector &))
bool Good() const
Return true if the command line options were parsed successfully.
Mesh * Extrude2D(Mesh *mesh, const int nz, const double sz)
Extrude a 2D mesh.
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
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.
double p(const Vector &x, double t)
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...
void trans3D(const Vector &, Vector &)
int GetElementOrder(int i) const
Returns the order of the i'th finite element.
virtual void Print(std::ostream &os=mfem::out) const