51int main(
int argc,
char *argv[])
53 int ser_ref_levels = 0;
58 bool visualization =
true;
61 args.
AddOption(&nz_,
"-nz",
"--num-elements-z",
62 "Number of elements in z-direction.");
63 args.
AddOption(&nt_,
"-nt",
"--num-twists",
64 "Number of node positions to twist the top of the mesh.");
65 args.
AddOption(&order_,
"-o",
"--mesh-order",
66 "Order (polynomial degree) of the mesh elements.");
67 args.
AddOption(&ser_ref_levels,
"-rs",
"--refine-serial",
68 "Number of times to refine the mesh uniformly in serial.");
70 "Width of the base in x-direction.");
72 "Width of the base in y-direction.");
74 "Height in z-direction.");
75 args.
AddOption(&el_type,
"-e",
"--element-type",
76 "Element type: 4 - Tetrahedron, 6 - Wedge, 8 - Hexahedron.");
77 args.
AddOption(&per_mesh,
"-pm",
"--periodic-mesh",
78 "-no-pm",
"--non-periodic-mesh",
79 "Enforce periodicity in z-direction "
80 "(requires discontinuous mesh).");
81 args.
AddOption(&dg_mesh,
"-dm",
"--discont-mesh",
"-cm",
"--cont-mesh",
82 "Use discontinuous or continuous space for the mesh nodes.");
83 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
85 "Enable or disable GLVis visualization.");
86 args.
AddOption(&visport,
"-p",
"--send-port",
"Socket for GLVis.");
108 cout <<
"Unsupported element type" << endl;
117 if (order_ > 1 || dg_mesh || per_mesh)
129 if (nt_ % 2 == 1 && std::abs(a_ - b_) > 1e-6 * a_)
131 cout <<
"Base is rectangular so number of shifts must be even "
132 <<
"for a periodic mesh!" << endl;
140 cout <<
"Diagonal cuts on the base and top must line up "
141 <<
"for a periodic mesh!" << endl;
146 int noff = (nt_ >= 0) ? 0 : (nnode * (1 - nt_ / nnode));
149 for (
int i = 0; i < v2v.
Size() - nnode; i++)
154 switch ((noff + nt_) % nnode)
157 v2v[v2v.
Size() - nnode + 0] = 0;
158 v2v[v2v.
Size() - nnode + 1] = 1;
159 v2v[v2v.
Size() - nnode + 2] = 2;
160 v2v[v2v.
Size() - nnode + 3] = 3;
163 v2v[v2v.
Size() - nnode + 0] = 2;
164 v2v[v2v.
Size() - nnode + 1] = 0;
165 v2v[v2v.
Size() - nnode + 2] = 3;
166 v2v[v2v.
Size() - nnode + 3] = 1;
169 v2v[v2v.
Size() - nnode + 0] = 3;
170 v2v[v2v.
Size() - nnode + 1] = 2;
171 v2v[v2v.
Size() - nnode + 2] = 1;
172 v2v[v2v.
Size() - nnode + 3] = 0;
175 v2v[v2v.
Size() - nnode + 0] = 1;
176 v2v[v2v.
Size() - nnode + 1] = 3;
177 v2v[v2v.
Size() - nnode + 2] = 0;
178 v2v[v2v.
Size() - nnode + 3] = 2;
182 for (
int i = 0; i < mesh.
GetNE(); i++)
187 for (
int j = 0; j < nv; j++)
193 for (
int i = 0; i < mesh.
GetNBE(); i++)
198 for (
int j = 0; j < nv; j++)
210 for (
int lev = 0; lev < ser_ref_levels; lev++)
224 oss <<
"twist-wedge";
230 oss <<
"-o" << order_ <<
"-s" << nt_;
231 if (ser_ref_levels > 0)
233 oss <<
"-r" << ser_ref_levels;
249 ofstream ofs(oss.str().c_str());
260 sol_sock.precision(8);
261 sol_sock <<
"mesh\n" << mesh << flush;
271 real_t phi = 0.5 * M_PI * nt_ * z / c_;
275 p[0] = 0.5 * a_ + (x[0] - 0.5 * a_) * cp - (x[1] - 0.5 * b_) * sp;
276 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[])