#ifndef OERSTED_FINITEELEMENTMESH_H #define OERSTED_FINITEELEMENTMESH_H #include #include #include "MatrixGroup.h" #include "Node.h" #include "Triangle.h" #include "Region.h" template class FiniteElementMesh {}; template class FiniteElementMesh<2,Order> { public: FiniteElementMesh() {}; FiniteElementMesh(std::vector nodes, std::vector> tris, std::vector> r, std::vector> b) : Nodes(nodes), Triangles(tris), Regions(r), Boundaries(b) {}; size_t size_nodes() const { return Nodes.size(); }; size_t size_elements() const { return Triangles.size(); }; std::vector const &nodes() const { return Nodes; }; std::vector> const &triangles() const { return Triangles; }; std::vector> const ®ions() const { return Regions; }; std::vector> const &boundaries() const { return Boundaries; }; XY const &node(size_t i) const { return Nodes[i]; }; Triangle const &triangle(size_t i) const { return Triangles[i]; }; Region<2> const ®ion(size_t i) const { return Regions[i]; }; Boundary<2> const &boundary(size_t i) const { return Boundaries[i]; }; template DiagonalMatrixGroup::size> determinant() const { DiagonalMatrixGroup::size> mat(Triangles.size()); for (size_t i = 0; i != Triangles.size(); ++i) { Triangles[i].determinant(mat, Nodes); } return mat; } template SparseMatrixGroup::size> basis() const { SparseMatrixGroup::size> mat(Nodes.size(), Triangles.size(), Triangle::NumNodes); for (size_t i = 0; i != Triangles.size(); ++i) { Triangles[i].basis(mat, Nodes); } return mat; } template DerivativeMatrixGroup::size> derivative() const { DerivativeMatrixGroup::size> df(Nodes.size(), Triangles.size(), Triangle::NumNodes); for (size_t i = 0; i!= Triangles.size();++i) { Triangles[i].derivative(df, Nodes); } return df; } protected: std::vector Nodes; std::vector> Triangles; std::vector> Regions; // Contains vector of size_t referencing Triangles (and later Quadrilaterals) std::vector> Boundaries; }; #endif //OERSTED_FINITEELEMENTMESH_H