PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
quadratureData.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 "modelData.h"
12
13#include "fe/elemIncludes.h"
16#include "util/vecMethods.h"
17
18#include <cstdlib>
19#include <format>
20#include <iostream>
21
22namespace {
23
24size_t numQuadPoints(size_t elemType, size_t quadOrder) {
25 return fe::elem(elemType, quadOrder)->getNumQuadPoints();
26}
27
28} // namespace
29
31 if (!util::methods::isTagInList("Strain_Stress", data.d_outputDeck_p->d_outTags)
32 and !data.d_modelDeck_p->d_populateElementNodeConnectivity)
33 return;
34
35 for (auto &p : data.d_referenceParticles) {
36 auto &particle_mesh_p = p->getMeshP();
37 if (!particle_mesh_p->d_encDataPopulated && particle_mesh_p->d_enc.empty())
38 particle_mesh_p->readElementData(particle_mesh_p->d_filename);
39 }
40
41 size_t totalQuadPoints = 0;
42 const auto quadOrder = data.d_modelDeck_p->d_quadOrder;
43 for (auto &p : data.d_particlesListTypeAll) {
44 const auto &particle_mesh_p = p->getMeshP();
45 const auto nq = particle_mesh_p->getNumElements() *
46 numQuadPoints(particle_mesh_p->getElementType(), quadOrder);
47
48 p->d_globQuadStart = totalQuadPoints;
49 totalQuadPoints += nq;
50 p->d_globQuadEnd = totalQuadPoints;
51
52 std::cout << std::format("p->id() = {}, "
53 "p->d_globQuadStart = {}, "
54 "totalQuadPoints = {}, "
55 "p->d_globQuadEnd = {}",
56 p->getId(), p->d_globQuadStart, nq, p->d_globQuadEnd)
57 << std::endl;
58 }
59
60 data.d_xQuadCur.resize(totalQuadPoints);
61 data.d_strain.resize(totalQuadPoints);
62 data.d_stress.resize(totalQuadPoints);
63}
A class to store model data.
Definition modelData.h:50
void setupQuadratureData(ModelData &data)
size_t numQuadPoints(size_t elemType, size_t quadOrder)
Definition contact.h:20
std::unique_ptr< BaseElem > elem(size_t type, size_t order)
bool isTagInList(const std::string &tag, const std::vector< std::string > &tags)
Returns true if tag is found in the list of tags.
Definition vecMethods.h:279