diff --git a/FunctionSpace/QuadEdgeBasis.cpp b/FunctionSpace/QuadEdgeBasis.cpp index 56e6570e3baaf322d7851ed2f5f322943141e6d8..463e960fc1bb6bf39129b2eef7b026e017d61edd 100644 --- a/FunctionSpace/QuadEdgeBasis.cpp +++ b/FunctionSpace/QuadEdgeBasis.cpp @@ -201,6 +201,33 @@ QuadEdgeBasis::QuadEdgeBasis(int order){ } + // Mapping to Gmsh Quad // + // x = (u + 1) / 2 + // y = (v + 1) / 2 + // + // (x, y) = Zaglmayr Ref Quad + // (u, v) = Gmsh Ref Quad + + Polynomial mapX(Polynomial(0.5, 1, 0, 0) + + Polynomial(0.5, 0, 0, 0)); + + Polynomial mapY(Polynomial(0.5, 0, 1, 0) + + Polynomial(0.5, 0, 0, 0)); + + for(int i = 0; i < nEdgeClosure; i++){ + for(int j = 0; j < nEdge; j++){ + (*(*edge)[i])[j]->at(0) = (*(*edge)[i])[j]->at(0).compose(mapX, mapY); + (*(*edge)[i])[j]->at(1) = (*(*edge)[i])[j]->at(1).compose(mapX, mapY); + (*(*edge)[i])[j]->at(2) = (*(*edge)[i])[j]->at(2).compose(mapX, mapY); + } + } + + for(int i = 0; i < nCell; i++){ + (*cell)[i]->at(0) = (*cell)[i]->at(0).compose(mapX, mapY); + (*cell)[i]->at(1) = (*cell)[i]->at(1).compose(mapX, mapY); + (*cell)[i]->at(2) = (*cell)[i]->at(2).compose(mapX, mapY); + } + // Free Temporary Sapce // delete[] legendre; delete[] intLegendre; diff --git a/FunctionSpace/QuadEdgeBasis.h b/FunctionSpace/QuadEdgeBasis.h index a0400dd6de69c97fc4c42ffdc5fb2f84deb5461d..40db8df9873e750de124f3826171d0fbffb16723 100644 --- a/FunctionSpace/QuadEdgeBasis.h +++ b/FunctionSpace/QuadEdgeBasis.h @@ -10,10 +10,14 @@ This class can instantiate an Edge-Based Basis (high or low order) for Quads.@n - It uses + It uses a variation of <a href="http://www.hpfem.jku.at/publications/szthesis.pdf">Zaglmayr's</a> Basis for @em high @em order Polynomial%s generation.@n - */ + + The following mapping has been applied to Zaglmayr's Basis for Quads: + @li @f$x = \frac{u + 1}{2}@f$ + @li @f$y = \frac{v + 1}{2}@f$ +*/ class QuadEdgeBasis: public BasisVector{ public: diff --git a/FunctionSpace/QuadNodeBasis.cpp b/FunctionSpace/QuadNodeBasis.cpp index 68b0fc26a06f9e7f5e7fed6f261e1957a8e79a4e..253d8f049edf76d25da638ae0b23972c9f27da6a 100644 --- a/FunctionSpace/QuadNodeBasis.cpp +++ b/FunctionSpace/QuadNodeBasis.cpp @@ -127,6 +127,30 @@ QuadNodeBasis::QuadNodeBasis(int order){ } + // Mapping to Gmsh Quad // + // x = (u + 1) / 2 + // y = (v + 1) / 2 + // + // (x, y) = Zaglmayr Ref Quad + // (u, v) = Gmsh Ref Quad + + Polynomial mapX(Polynomial(0.5, 1, 0, 0) + + Polynomial(0.5, 0, 0, 0)); + + Polynomial mapY(Polynomial(0.5, 0, 1, 0) + + Polynomial(0.5, 0, 0, 0)); + + for(int i = 0; i < nVertex; i++) + *(*node)[i] = (*node)[i]->compose(mapX, mapY); + + for(int i = 0; i < nEdgeClosure; i++) + for(int j = 0; j < nEdge; j++) + *(*(*edge)[i])[j] = (*(*edge)[i])[j]->compose(mapX, mapY); + + for(int i = 0; i < nCell; i++) + *(*cell)[i] = (*cell)[i]->compose(mapX, mapY); + + // Free Temporary Sapce // delete[] legendre; } diff --git a/FunctionSpace/QuadNodeBasis.h b/FunctionSpace/QuadNodeBasis.h index 308aa78cf300f8b5cace6d700fcbd2b6cc76ab0c..80f4ff0432fb455f544a25184595bf812772e4d7 100644 --- a/FunctionSpace/QuadNodeBasis.h +++ b/FunctionSpace/QuadNodeBasis.h @@ -10,10 +10,14 @@ This class can instantiate a Node-Based Basis (high or low order) for Quads.@n - It uses + It uses a variation of <a href="http://www.hpfem.jku.at/publications/szthesis.pdf">Zaglmayr's</a> Basis for @em high @em order Polynomial%s generation.@n - */ + + The following mapping has been applied to Zaglmayr's Basis for Quads: + @li @f$x = \frac{u + 1}{2}@f$ + @li @f$y = \frac{v + 1}{2}@f$ +*/ class QuadNodeBasis: public BasisScalar{ public: