39 int main(
int argc,
char *argv[])
41 const char *new_mesh_file =
"mobius-strip.mesh";
47 bool visualization =
true;
50 args.
AddOption(&new_mesh_file,
"-m",
"--mesh-out-file",
51 "Output Mesh file to write.");
52 args.
AddOption(&nx,
"-nx",
"--num-elements-x",
53 "Number of elements in x-direction.");
54 args.
AddOption(&ny,
"-ny",
"--num-elements-y",
55 "Number of elements in y-direction.");
56 args.
AddOption(&order,
"-o",
"--mesh-order",
57 "Order (polynomial degree) of the mesh elements.");
58 args.
AddOption(&close_strip,
"-c",
"--close-strip",
59 "How to close the strip: 0 - open, 1 - closed, 2 - twisted.");
60 args.
AddOption(&dg_mesh,
"-dm",
"--discont-mesh",
"-cm",
"--cont-mesh",
61 "Use discontinuous or continuous space for the mesh nodes.");
63 "Number of twists of the strip.");
64 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
66 "Enable or disable GLVis visualization.");
79 mesh =
new Mesh(nx, ny, el_type, 1, 2*M_PI, 2.0);
86 for (
int i = 0; i < v2v.Size(); i++)
91 for (
int j = 0; j <= ny; j++)
93 int v_old = nx + j * (nx + 1);
94 int v_new = ((close_strip == 1) ? j : (ny - j)) * (nx + 1);
98 for (
int i = 0; i < mesh->
GetNE(); i++)
103 for (
int j = 0; j < nv; j++)
109 for (
int i = 0; i < mesh->
GetNBE(); i++)
114 for (
int j = 0; j < nv; j++)
131 for (
int i = 0; i < nodes.
Size(); i++)
133 if (std::abs(nodes(i)) < 1e-12)
139 ofstream ofs(new_mesh_file);
149 sol_sock.precision(8);
150 sol_sock <<
"mesh\n" << *mesh << flush;
159 double a = 1.0 + 0.5 * (x[1] - 1.0) * cos(
num_twists * x[0] );
162 p[0] = a * cos( x[0] );
163 p[1] = a * sin( x[0] );
164 p[2] = 0.5 * (x[1] - 1.0) * sin(
num_twists * x[0] );
virtual void Print(std::ostream &out=mfem::out) const
Class for grid function - Vector with associated FE space.
void mobius_trans(const Vector &x, Vector &p)
virtual void GetVertices(Array< int > &v) const =0
Returns element's vertices.
void SetSize(int s)
Resize the vector to size s.
int GetNBE() const
Returns number of boundary elements.
int Size() const
Returns the size of the vector.
void Transform(void(*f)(const Vector &, Vector &))
int GetNE() const
Returns number of elements.
int main(int argc, char *argv[])
void RemoveInternalBoundaries()
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)
Type
Constants for the classes derived from Element.
const Element * GetElement(int i) const
void PrintUsage(std::ostream &out) const
Print the usage message.
double p(const Vector &x, double t)
void RemoveUnusedVertices()
Remove unused vertices and rebuild mesh connectivity.
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...
int GetNV() const
Returns number of vertices. Vertices are only at the corners of elements, where you would expect them...
void PrintOptions(std::ostream &out) const
Print the options.
virtual int GetNVertices() const =0
void GetNodes(Vector &node_coord) const
Abstract data type element.
const Element * GetBdrElement(int i) const
bool Good() const
Return true if the command line options were parsed successfully.