19int main(
int argc,
char *argv[])
22 const char *mesh_file =
"../../data/square-nurbs.mesh";
23 const char *ref_file =
"";
26 bool visualization =
true;
29 args.
AddOption(&mesh_file,
"-m",
"--mesh",
31 args.
AddOption(&ref_levels,
"-r",
"--refine",
32 "Number of times to refine the mesh uniformly, -1 for auto.");
33 args.
AddOption(&ref_file,
"-rf",
"--ref-file",
34 "File with refinement data");
36 "NURBS order (polynomial degree) or -1 for");
37 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
39 "Enable or disable GLVis visualization.");
48 Mesh mesh(mesh_file, 1, 1);
59 if (mesh.
NURBSext && (strlen(ref_file) != 0))
64 for (
int l = 0; l < ref_levels; l++)
73 mfem::out<<
"=======================================;"<<endl;
75 mfem::out<<
"=======================================;"<<endl;
76 for (
int p = 0;
p < ext->
GetNP();
p++)
82 for (
int k = 1; k < kv.
Size(); k++)
87 for (
int k = 1; k < kv.
Size(); k++)
95 for (
int k = 0; k < ext->
GetNKV() ; k++)
97 mfem::out<<
"=======================================;"<<endl;
99 mfem::out<<
"=======================================;"<<endl;
103 std::string gnuplot =
"plot 0";
105 for (
int i = 0; i < kv.
GetNCP(); i++)
109 std::string filename =
"k" + std::to_string(k) +
"_n" + std::to_string(
111 mfem::out<<
"Write shape function to: "<<filename<<
"\n";
112 std::ofstream ofs(filename);
115 gnuplot +=
", '" + filename+
"' u 1:2 w l";
121 for (
int i = 0; i < kv.
GetNCP(); i++)
129 for (
int i = 0; i < kv.
GetNCP(); i++)
137 for (
int i = 0; i < kv.
GetNCP(); i++)
145 for (
int i = 0; i <kv.
GetNCP(); i++)
147 x[i] = std::pow(-1.0, i);
152 std::string filename =
"k" + std::to_string(k) +
"_cheby.dat";
153 mfem::out<<
"Write Chebyshev spline to: "<<filename<<
"\n";
154 std::ofstream ofs(filename);
int Size() const
Return the logical size of the array.
A vector of knots in one dimension, with B-spline basis functions of a prescribed order.
void GetInterpolant(Array< Vector * > &x, const Vector &u, bool reuse_inverse=false) const
Global curve interpolation through the points x (overwritten) at the knot location u....
void PrintFunction(std::ostream &os, const Vector &a, int samples=11) const
real_t GetBotella(int i) const
real_t GetDemko(int i) const
real_t GetGreville(int i) const
int GetNCP() const
Return the number of control points.
void Print(std::ostream &os) const
Print the order, number of control points, and knots.
NURBSExtension * NURBSext
Optional NURBS mesh extension.
void RefineNURBSFromFile(std::string ref_file)
void DegreeElevate(int rel_degree, int degree=16)
virtual void PrintInfo(std::ostream &os=mfem::out)
In serial, this method calls PrintCharacteristics(). In parallel, additional information about the pa...
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
NURBSExtension generally contains multiple NURBSPatch objects spanning an entire Mesh....
int GetNP() const
Return the number of patches.
int GetNKV() const
Return the number of KnotVectors.
void GetPatchKnotVectors(int p, Array< KnotVector * > &kv)
Return KnotVectors in kv in each dimension for patch p.
const KnotVector * GetKnotVector(int i) const
KnotVector read-only access function.
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 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.
void Print(std::ostream &out=mfem::out, int width=8) const
Prints vector to stream out.
void mfem_error(const char *msg)
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
real_t p(const Vector &x, real_t t)