PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
elemIncludes.h
Go to the documentation of this file.
1/*
2 * -------------------------------------------
3 * Copyright (c) 2021 - 2026 Prashant K. Jha
4 * -------------------------------------------
5 * PeriDEM https://github.com/prashjha/PeriDEM
6 *
7 * Distributed under the Boost Software License, Version 1.0. (See accompanying
8 * file LICENSE)
9 */
10
11#pragma once
12
13#include "util/feElementDefs.h"
14
15#include "util/io.h"
16#include <stdexcept>
17#include "baseElem.h"
18#include "lineElem.h"
19#include "quadElem.h"
20#include "triElem.h"
21#include "tetElem.h"
22#include "hexElem.h"
23
24#include <cstdlib>
25#include <format>
26#include <iostream>
27#include <memory>
28
29namespace fe {
30
31inline std::unique_ptr<BaseElem> elem(size_t type, size_t order) {
32 if (type == util::vtk_type_line)
33 return std::make_unique<LineElem>(order);
34 if (type == util::vtk_type_triangle)
35 return std::make_unique<TriElem>(order);
36 if (type == util::vtk_type_quad)
37 return std::make_unique<QuadElem>(order);
38 if (type == util::vtk_type_tetra)
39 return std::make_unique<TetElem>(order);
40 if (type == util::vtk_type_hexahedron)
41 return std::make_unique<HexElem>(order);
42 throw std::runtime_error(
44 << std::format("Error: element type = {} is not supported.\n", type));
45}
46
47} // namespace fe
Collects a message with stream syntax for use in an exception.
Definition io.h:52
static const int vtk_type_triangle
Integer flag for triangle element.
static const int vtk_type_quad
Integer flag for quad element.
static const int vtk_type_tetra
Integer flag for tetrahedron element.
static const int vtk_type_hexahedron
Integer flag for hexahedron element.
static const int vtk_type_line
Integer flag for line element.
Definition baseElem.h:17
std::unique_ptr< BaseElem > elem(size_t type, size_t order)