45 int main(
int argc,
char *argv[])
50 bool visualization =
true;
53 args.
AddOption(&nx,
"-nx",
"--num-elements-x",
54 "Number of elements in x-direction.");
55 args.
AddOption(&ny,
"-ny",
"--num-elements-y",
56 "Number of elements in y-direction.");
57 args.
AddOption(&order,
"-o",
"--mesh-order",
58 "Order (polynomial degree) of the mesh elements.");
60 "Frequency of the x-component.");
62 "Frequency of the y-component.");
64 "Phase angle of the x-component.");
65 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
67 "Enable or disable GLVis visualization.");
76 delta *= M_PI / 180.0;
83 Mesh mesh(nx, ny, Element::QUADRILATERAL, 1, 2*M_PI, 2*M_PI);
95 soutv.
open(vishost, visport);
96 soutv <<
"solution\n" << mesh << u;
97 soutv <<
"keys 'ARRj" << std::string(90,
'7') <<
"'\n";
98 soutv <<
"palette 17 zoom 1.65 subdivisions 32 0\n";
99 soutv <<
"window_title 'V' window_geometry 0 0 500 500\n";
105 Mesh mesh(nx, ny, Element::QUADRILATERAL, 1, 2*M_PI, 2*M_PI);
117 south.
open(vishost, visport);
118 south <<
"solution\n" << mesh << u;
119 south <<
"keys 'ARRj'\n";
120 south <<
"palette 17 zoom 1.65 subdivisions 32 0\n";
121 south <<
"window_title 'H' window_geometry 500 0 500 500\n";
125 ofstream mesh_ofs(
"lissajous.mesh");
126 mesh_ofs.precision(8);
127 mesh.
Print(mesh_ofs);
128 ofstream sol_ofs(
"lissajous.gf");
129 sol_ofs.precision(8);
133 soutv <<
"keys '.0" << std::string(
b,
'0') <<
"'\n" << flush;
134 south <<
"keys '.0" << std::string(
a,
'0') <<
"'\n" << flush;
136 cout <<
"Which direction(s) are the two curves spinning in?\n";
149 double a,
double b,
double delta)
163 p[2] = A*sin(a*t + delta);
168 double R = 0.02*(A+B);
171 double normal[3] = { cos(b*t), sin(b*t), 0 };
178 double cross[3] = { A*a*sin(b*t)*cos(a*t+delta), -A*a*cos(b*t)*cos(a*t+delta), b*B };
179 for (
int i = 0; i < 3; i++) { cn += cross[i]*cross[i]; }
180 for (
int i = 0; i < 3; i++) { cross[i] /= sqrt(cn); }
184 for (
int i = 0; i < 3; i++)
186 p[i] += R * (cos(theta)*normal[i] + sin(theta)*cross[i]);
void lissajous_trans_h(const Vector &x, Vector &p)
virtual void Print(std::ostream &out=mfem::out) const
Class for grid function - Vector with associated FE space.
void SetSize(int s)
Resize the vector to size s.
void Transform(void(*f)(const Vector &, Vector &))
void lissajous_trans_v(const Vector &x, Vector &p)
int main(int argc, char *argv[])
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
double u_function(const Vector &x)
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)
void PrintUsage(std::ostream &out) const
Print the usage message.
double p(const Vector &x, double t)
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
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 lissajous_trans(const Vector &x, Vector &p, double a, double b, double delta)
void PrintOptions(std::ostream &out) const
Print the options.
virtual void ProjectCoefficient(Coefficient &coeff)
int open(const char hostname[], int port)
Open the socket stream on 'port' at 'hostname'.
A general function coefficient.
Arbitrary order H1-conforming (continuous) finite elements.
bool Good() const
Return true if the command line options were parsed successfully.