PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
baseElem.cpp
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#include "baseElem.h"
12#include "util/io.h"
13#include <stdexcept>
14#include "map.h"
15#include <cstdlib>
16#include <iostream>
17
18fe::BaseElem::BaseElem(size_t order, size_t element_type)
19 : d_quadOrder(order), d_elemType(element_type){};
20
21std::vector<double>
23 const std::vector<util::Point> &nodes) {
24 throw std::runtime_error(
26 << "Error: For element type = " << d_elemType << " the map from "
27 << "element to reference element is not available.\n"
28 << "Therefore, shape function evaluation at any arbitrary point "
29 "in the element is not possible.\n");
30}
31
32std::vector<std::vector<double>>
34 const std::vector<util::Point> &nodes) {
35 throw std::runtime_error(
37 << "Error: For element type = " << d_elemType << " the map from "
38 << "element to reference element is not available.\n"
39 << "Therefore, derivatives of shape function at any "
40 "arbitrary point in the element can not be computed.\n");
41}
42
45 const std::vector<util::Point> &nodes) {
46 throw std::runtime_error(
48 << "Error: For element type = " << d_elemType << " the map from "
49 << "element to reference element is not available.\n");
50}
51
53
54 throw std::runtime_error(
56 << "Error: init() of BaseElem must be implemented in inheriting "
57 "class.\n");
58}
59
60std::vector<fe::QuadData>
61fe::BaseElem::getQuadDatas(const std::vector<util::Point> &nodes) {
62 auto qds = d_quads;
63 mapToPhysical(qds, nodes, true);
64 return qds;
65}
66
67std::vector<fe::QuadData>
68fe::BaseElem::getQuadPoints(const std::vector<util::Point> &nodes) {
69 auto qds = d_quads;
70 mapToPhysical(qds, nodes, false);
71 return qds;
72}
virtual util::Point mapPointToRefElem(const util::Point &p, const std::vector< util::Point > &nodes)
Maps point p in a given element to the reference element and returns the mapped point.
Definition baseElem.cpp:44
std::vector< fe::QuadData > getQuadDatas(const std::vector< util::Point > &nodes)
Get quadrature data mapped to the physical element (N, dN/dx, x, w, J). Shared isoparametric map; typ...
Definition baseElem.cpp:61
BaseElem(size_t order, size_t element_type)
Constructor.
Definition baseElem.cpp:18
virtual std::vector< std::vector< double > > getDerShapes(const util::Point &p, const std::vector< util::Point > &nodes)
Returns the values of derivative of shape function at point p.
Definition baseElem.cpp:33
std::vector< fe::QuadData > getQuadPoints(const std::vector< util::Point > &nodes)
Same as getQuadDatas without transforming dN/dξ to dN/dx.
Definition baseElem.cpp:68
virtual std::vector< double > getShapes(const util::Point &p, const std::vector< util::Point > &nodes)
Returns the values of shape function at point p.
Definition baseElem.cpp:22
virtual void init()=0
Compute the quadrature points.
Definition baseElem.cpp:52
Collects a message with stream syntax for use in an exception.
Definition io.h:52
void mapToPhysical(std::vector< QuadData > &qds, const std::vector< util::Point > &nodes, bool derivatives)
Definition map.cpp:14
A structure to represent 3d vectors.
Definition point.h:30