1#include "tp_quad_mesh_builder.h"
3#include <lf/geometry/geometry.h>
4#include <spdlog/spdlog.h>
8#include "lf/mesh/mesh_interface.h"
19 using coord_t = Eigen::Vector2d;
24 const unsigned no_of_cells = nx * ny;
25 const unsigned no_of_edges = (nx + 1) * ny + nx * (ny + 1);
26 const unsigned no_of_vertices = (nx + 1) * (ny + 1);
28 if (no_of_cells == 0) {
34 if ((x_size <= 0.0) || (y_size <= 0.0)) {
38 const double hx = x_size / nx;
39 const double hy = y_size / ny;
43 "TPQuadmesh: {} cells, {} edges, {} vertices, meshwidths hx/hy = {}/{}",
44 no_of_cells, no_of_edges, no_of_vertices, hx, hy);
47 std::vector<size_type> v_idx(no_of_vertices);
50 for (
size_type i = 0; i <= nx; ++i, ++node_cnt) {
52 coord_t node_coord(2);
56 SPDLOG_LOGGER_TRACE(
Logger(),
"Adding vertex {}: {}", node_cnt,
57 node_coord.transpose());
65 std::vector<size_type> t_idx(no_of_cells);
69 for (
size_type j = 0; j < ny; ++j, quad_cnt++) {
71 std::vector<size_type> vertex_index_list{
75 Eigen::Matrix<double, 2, 4> quad_geo(2, 4);
84 SPDLOG_LOGGER_TRACE(
Logger(),
"Adding quad {}:\n{}", quad_cnt, quad_geo);
90 std::make_unique<geometry::QuadO1>(quad_geo));
static constexpr RefEl kQuad()
Returns the reference quadrilateral.
mesh::Mesh::size_type size_type
Eigen::Vector2d bottom_left_corner_
Eigen::Vector2d top_right_corner_
size_type num_of_x_cells_
size_type num_of_y_cells_
std::unique_ptr< mesh::MeshFactory > mesh_factory_
std::shared_ptr< mesh::Mesh > Build() override
actual construction of the mesh
size_type VertexIndex(size_type i, size_type j) const
vertex index from grid position
static std::shared_ptr< spdlog::logger > & Logger()
is used by the Build() method to output additional information.
std::shared_ptr< spdlog::logger > InitLogger(const std::string &name)
Create a spdlog logger, register it in the spdlog registry and initialize it with LehrFEM++ specific ...
Contains helper functions and classes that all operate on the interface classes defined in lf::mesh.