PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
particleLoadingUtil.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 "particleLoadingUtil.h"
12#include "util/vecMethods.h"
13
15
16 // if there is a list, and if particle is not in the list, skip
17 bool skip_condition1 = (bc.d_selectionType == "particle"
18 || bc.d_selectionType == "region_with_include_list")
20 // if there is an exclusion list, and if particle is in the list, skip
21 bool skip_condition2 = (bc.d_selectionType == "region_with_exclude_list")
23 // if there is a inclusion and an exclusion list,
24 // and if particle is either in the exclusion list or not in the inclusion list, skip
25 bool skip_condition3 = (bc.d_selectionType == "region_with_include_list_with_exclude_list")
28
29 bool skip = skip_condition1 or skip_condition2 or skip_condition3;
30 return !skip;
31}
32
34 size_t id,
35 const inp::BCBaseDeck &bc) {
36
37 if (!bc.d_isRegionActive) {
38 if (bc.d_selectionType == "particle" &&
40 return true;
41 }
42 else {
43 if (bc.d_selectionType == "region" && bc.d_regionGeomData.d_geom_p->isInside(x))
44 return true;
45 else if (bc.d_selectionType == "region_with_include_list" &&
46 bc.d_regionGeomData.d_geom_p->isInside(x) &&
48 return true;
49 else if (bc.d_selectionType == "region_with_exclude_list" &&
50 bc.d_regionGeomData.d_geom_p->isInside(x) &&
52 return true;
53 else if (bc.d_selectionType == "region_with_include_list_with_exclude_list" &&
54 bc.d_regionGeomData.d_geom_p->isInside(x) &&
57 return true;
58 }
59
60 return false;
61}
bool needToProcessParticle(size_t id, const inp::BCBaseDeck &bc)
Function that checks if given particle with id = id needs to be processed within boundary condition d...
bool needToComputeDof(const util::Point &x, size_t id, const inp::BCBaseDeck &bc)
Function that checks if we need to do computation at a given point x within a particle with id = id.
bool isInList(const T &i, const std::vector< T > &list)
Find if data is in the list.
Definition vecMethods.h:265
std::shared_ptr< geom::GeomObject > d_geom_p
Zone geometry.
User-input data for particle neighbor search.
Definition bcBaseDeck.h:25
std::vector< size_t > d_pList
List of particles (if any)
Definition bcBaseDeck.h:51
std::vector< size_t > d_pNotList
List of particles to not include (if any)
Definition bcBaseDeck.h:54
geom::GeomData d_regionGeomData
Region geometry (if any)
Definition bcBaseDeck.h:48
bool d_isRegionActive
Flag that indicates if region-based application of boundary condition is active. So cases of 'region'...
Definition bcBaseDeck.h:45
std::string d_selectionType
Method for applying force e.g.
Definition bcBaseDeck.h:38
A structure to represent 3d vectors.
Definition point.h:30