51int main(
int argc,
char *argv[])
53 int ser_ref_levels = 0;
57 bool visualization =
true;
60 args.
AddOption(&nz_,
"-nz",
"--num-elements-z",
61 "Number of elements in z-direction.");
62 args.
AddOption(&nt_,
"-nt",
"--num-twists",
63 "Number of node positions to twist the top of the mesh.");
64 args.
AddOption(&order_,
"-o",
"--mesh-order",
65 "Order (polynomial degree) of the mesh elements.");
66 args.
AddOption(&ser_ref_levels,
"-rs",
"--refine-serial",
67 "Number of times to refine the mesh uniformly in serial.");
69 "Width of the base in x-direction.");
71 "Width of the base in y-direction.");
73 "Height in z-direction.");
74 args.
AddOption(&el_type,
"-e",
"--element-type",
75 "Element type: 4 - Tetrahedron, 6 - Wedge, 8 - Hexahedron.");
76 args.
AddOption(&per_mesh,
"-pm",
"--periodic-mesh",
77 "-no-pm",
"--non-periodic-mesh",
78 "Enforce periodicity in z-direction "
79 "(requires discontinuous mesh).");
80 args.
AddOption(&dg_mesh,
"-dm",
"--discont-mesh",
"-cm",
"--cont-mesh",
81 "Use discontinuous or continuous space for the mesh nodes.");
82 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
84 "Enable or disable GLVis visualization.");
106 cout <<
"Unsupported element type" << endl;
115 if (order_ > 1 || dg_mesh || per_mesh)
127 if (nt_ % 2 == 1 && std::abs(a_ - b_) > 1e-6 * a_)
129 cout <<
"Base is rectangular so number of shifts must be even "
130 <<
"for a periodic mesh!" << endl;
138 cout <<
"Diagonal cuts on the base and top must line up "
139 <<
"for a periodic mesh!" << endl;
144 int noff = (nt_ >= 0) ? 0 : (nnode * (1 - nt_ / nnode));
147 for (
int i = 0; i < v2v.
Size() - nnode; i++)
152 switch ((noff + nt_) % nnode)
155 v2v[v2v.
Size() - nnode + 0] = 0;
156 v2v[v2v.
Size() - nnode + 1] = 1;
157 v2v[v2v.
Size() - nnode + 2] = 2;
158 v2v[v2v.
Size() - nnode + 3] = 3;
161 v2v[v2v.
Size() - nnode + 0] = 2;
162 v2v[v2v.
Size() - nnode + 1] = 0;
163 v2v[v2v.
Size() - nnode + 2] = 3;
164 v2v[v2v.
Size() - nnode + 3] = 1;
167 v2v[v2v.
Size() - nnode + 0] = 3;
168 v2v[v2v.
Size() - nnode + 1] = 2;
169 v2v[v2v.
Size() - nnode + 2] = 1;
170 v2v[v2v.
Size() - nnode + 3] = 0;
173 v2v[v2v.
Size() - nnode + 0] = 1;
174 v2v[v2v.
Size() - nnode + 1] = 3;
175 v2v[v2v.
Size() - nnode + 2] = 0;
176 v2v[v2v.
Size() - nnode + 3] = 2;
180 for (
int i = 0; i < mesh.
GetNE(); i++)
185 for (
int j = 0; j < nv; j++)
191 for (
int i = 0; i < mesh.
GetNBE(); i++)
196 for (
int j = 0; j < nv; j++)
208 for (
int lev = 0; lev < ser_ref_levels; lev++)
222 oss <<
"twist-wedge";
228 oss <<
"-o" << order_ <<
"-s" << nt_;
229 if (ser_ref_levels > 0)
231 oss <<
"-r" << ser_ref_levels;
247 ofstream ofs(oss.str().c_str());
259 sol_sock.precision(8);
260 sol_sock <<
"mesh\n" << mesh << flush;
270 real_t phi = 0.5 * M_PI * nt_ * z / c_;
274 p[0] = 0.5 * a_ + (x[0] - 0.5 * a_) * cp - (x[1] - 0.5 * b_) * sp;
275 p[1] = 0.5 * b_ + (x[0] - 0.5 * a_) * sp + (x[1] - 0.5 * b_) * cp;
int Size() const
Return the logical size of the array.
Abstract data type element.
virtual void GetVertices(Array< int > &v) const =0
Get the indices defining the vertices.
Type
Constants for the classes derived from Element.
virtual int GetNVertices() const =0
const Element * GetElement(int i) const
Return pointer to the i'th element object.
virtual void Print(std::ostream &os=mfem::out, const std::string &comments="") const
int GetNE() const
Returns number of elements.
const Element * GetBdrElement(int i) const
Return pointer to the i'th boundary element object.
static Mesh MakeCartesian3D(int nx, int ny, int nz, Element::Type type, real_t sx=1.0, real_t sy=1.0, real_t sz=1.0, bool sfc_ordering=true)
Creates a mesh for the parallelepiped [0,sx]x[0,sy]x[0,sz], divided into nx*ny*nz hexahedra if type =...
int GetNV() const
Returns number of vertices. Vertices are only at the corners of elements, where you would expect them...
int GetNBE() const
Returns number of boundary 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 UniformRefinement(int i, const DSTable &, int *, int *, int *)
void RemoveInternalBoundaries()
void RemoveUnusedVertices()
Remove unused vertices and rebuild mesh connectivity.
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.
real_t p(const Vector &x, real_t t)
void trans(const Vector &x, Vector &p)
void pts(int iphi, int t, real_t x[])