PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
inp::PNeighborDeck Struct Reference

User-input data for particle neighbor search. More...

#include <pNeighborDeck.h>

Collaboration diagram for inp::PNeighborDeck:

Public Member Functions

 PNeighborDeck (const json &j=json({}))
 Constructor.
 
 PNeighborDeck (std::string updateCriteria, double sFactor=1., size_t neighUpdateInterval=1, double nearBdNodesTol=0.5)
 Constructor.
 
void readFromJson (const json &j)
 Reads from json object.
 
json writeToJson () const
 Returns this deck as a JSON object.
 
std::string printStr (int nt=0, int lvl=0) const
 Returns the string containing printable information about the object.
 
void print (int nt=0, int lvl=0) const
 Prints the information about the object.
 

Static Public Member Functions

static const std::vector< Field< PNeighborDeck > > & fields ()
 The fields of this deck, declared once.
 
static json getExampleJson (const json &given=json::object())
 Returns the block with the given fields set.
 
static json getExampleJson (const std::string &)=delete
 Rejects a value given where a set of named values is expected.
 
static json getExampleJson (const char *)=delete
 Rejects a value given where a set of named values is expected.
 

Data Fields

std::string d_updateCriteria
 Neighbor search update criteria (if any)
 
double d_sFactor
 Neighbor search factor (search length is factor times biggest radius of particle)
 
size_t d_neighUpdateInterval
 Neighbor update time interval (for contact)
 
double d_nearBdNodesTol
 Specify how deep we search for nodes near boundary for contact calculations.
 

Detailed Description

User-input data for particle neighbor search.

Definition at line 23 of file pNeighborDeck.h.

Constructor & Destructor Documentation

◆ PNeighborDeck() [1/2]

inp::PNeighborDeck::PNeighborDeck ( const json &  j = json({}))
inline

Constructor.

Definition at line 41 of file pNeighborDeck.h.

41 {}))
42 : d_updateCriteria("simple_all"),
43 d_sFactor(1.),
45 d_nearBdNodesTol(0.5) {
46 readFromJson(j);
47 };
std::string d_updateCriteria
Neighbor search update criteria (if any)
void readFromJson(const json &j)
Reads from json object.
double d_nearBdNodesTol
Specify how deep we search for nodes near boundary for contact calculations.
double d_sFactor
Neighbor search factor (search length is factor times biggest radius of particle)
size_t d_neighUpdateInterval
Neighbor update time interval (for contact)

◆ PNeighborDeck() [2/2]

inp::PNeighborDeck::PNeighborDeck ( std::string  updateCriteria,
double  sFactor = 1.,
size_t  neighUpdateInterval = 1,
double  nearBdNodesTol = 0.5 
)
inline

Constructor.

Definition at line 52 of file pNeighborDeck.h.

54 : d_updateCriteria(updateCriteria),
55 d_sFactor(sFactor),
56 d_neighUpdateInterval(neighUpdateInterval),
57 d_nearBdNodesTol(nearBdNodesTol) {};

Member Function Documentation

◆ fields()

static const std::vector< Field< PNeighborDeck > > & inp::PNeighborDeck::fields ( )
inlinestatic

The fields of this deck, declared once.

Reading, writing, printing and the schema are generated from this table.

Returns
fields The field table

Definition at line 65 of file pNeighborDeck.h.

65 {
66 static const std::vector<Field<PNeighborDeck>> f = {
67 field(&PNeighborDeck::d_updateCriteria, "Update_Criteria",
68 std::string("simple_all"),
69 "When the contact neighbor list is rebuilt"),
70 field(&PNeighborDeck::d_sFactor, "Search_Factor", 1.,
71 "Search length as a multiple of the largest particle radius"),
73 size_t(1), "Steps between contact neighbor list updates"),
74 field(&PNeighborDeck::d_nearBdNodesTol, "Near_Bd_Nodes_Tol", 0.5,
75 "Depth within which a node counts as near the boundary"),
76 };
77 return f;
78 }
Field< Deck > field(T Deck::*m, std::string key, T def, std::string doc, Accepts< T > accepts={}, std::function< bool(const T &)> emitIf=[](const T &) { return true;})
Declares a field that maps one key to one member.
Definition deckField.h:144

References d_nearBdNodesTol, d_neighUpdateInterval, d_sFactor, d_updateCriteria, and inp::field().

Referenced by getExampleJson(), printStr(), readFromJson(), and writeToJson().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExampleJson() [1/3]

static json inp::PNeighborDeck::getExampleJson ( const char *  )
staticdelete

Rejects a value given where a set of named values is expected.

A string converts to a JSON string, which would otherwise bind to the overload above and be read as a block with no keys. Deleting these makes that a compile error rather than a failure when the deck is built.

◆ getExampleJson() [2/3]

static json inp::PNeighborDeck::getExampleJson ( const json &  given = json::object())
inlinestatic

Returns the block with the given fields set.

Parameters
givenField names and values to set, checked against the table
Returns
JSON object for this deck

Definition at line 85 of file pNeighborDeck.h.

85 {
86 return applyGiven(given, fields());
87 }
json applyGiven(const json &given, const std::vector< Field< Deck > > &fs, const std::vector< std::string > &extra={})
The default block with the given keys replaced.
Definition deckField.h:443
static const std::vector< Field< PNeighborDeck > > & fields()
The fields of this deck, declared once.

References inp::applyGiven(), and fields().

Referenced by anonymous_namespace{main.cpp}::buildBhatInputJson(), anonymous_namespace{main.cpp}::buildImpactInputJson(), anonymous_namespace{main.cpp}::buildInputJson(), anonymous_namespace{main.cpp}::buildInputJson(), anonymous_namespace{main.cpp}::buildInputJson(), anonymous_namespace{main.cpp}::buildInputJson(), anonymous_namespace{main.cpp}::buildInputJson(), anonymous_namespace{main.cpp}::buildInputJson(), anonymous_namespace{main.cpp}::buildInputJson(), getInputJson(), inp::ParticleDeck::getParticleNeighborExampleJson(), and anonymous_namespace{testDeckRoundTrip.cpp}::testNeighborAndGenDecks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExampleJson() [3/3]

static json inp::PNeighborDeck::getExampleJson ( const std::string &  )
staticdelete

Rejects a value given where a set of named values is expected.

A string converts to a JSON string, which would otherwise bind to the overload above and be read as a block with no keys. Deleting these makes that a compile error rather than a failure when the deck is built.

◆ print()

void inp::PNeighborDeck::print ( int  nt = 0,
int  lvl = 0 
) const
inline

Prints the information about the object.

Parameters
ntNumber of tabs to append before printing
lvlInformation level (higher means more information)

Definition at line 145 of file pNeighborDeck.h.

145{ std::cout << printStr(nt, lvl); }
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.

References printStr().

Here is the call graph for this function:

◆ printStr()

std::string inp::PNeighborDeck::printStr ( int  nt = 0,
int  lvl = 0 
) const
inline

Returns the string containing printable information about the object.

Parameters
ntNumber of tabs to append before printing
lvlInformation level (higher means more information)
Returns
string String containing printable information about the object

Definition at line 128 of file pNeighborDeck.h.

128 {
129
130 auto tabS = util::io::getTabS(nt);
131 std::ostringstream oss;
132 oss << tabS << "------- PNeighborDeck --------" << std::endl << std::endl;
133 printFields(*this, oss, fields(), tabS);
134 oss << tabS << std::endl;
135
136 return oss.str();
137 }
void printFields(const Deck &d, std::ostringstream &oss, const std::vector< Field< Deck > > &fs, const std::string &tab="")
Appends every field of the table to a stream.
Definition deckField.h:251
std::string getTabS(int nt)
Returns tab spaces of a given size.
Definition io.h:82

References fields(), util::io::getTabS(), and inp::printFields().

Referenced by print(), and inp::ParticleDeck::printStr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readFromJson()

void inp::PNeighborDeck::readFromJson ( const json &  j)
inline

Reads from json object.

Parameters
jJSON object

Definition at line 105 of file pNeighborDeck.h.

105 {
106 if (j.empty())
107 return;
108 readFields(*this, j, fields());
109 }
void readFields(Deck &d, const json &j, const std::vector< Field< Deck > > &fs)
Reads every field of the table from the block.
Definition deckField.h:230

References fields(), and inp::readFields().

Referenced by inp::ParticleDeck::readParticleNeighborFromJson(), and anonymous_namespace{testDeckRoundTrip.cpp}::testNeighborAndGenDecks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeToJson()

json inp::PNeighborDeck::writeToJson ( ) const
inline

Returns this deck as a JSON object.

Returns
JSON object for this deck

Definition at line 115 of file pNeighborDeck.h.

115 {
116 json j = json::object();
117 writeFields(*this, j, fields());
118 return j;
119 }
nlohmann::ordered_json json
void writeFields(const Deck &d, json &j, const std::vector< Field< Deck > > &fs)
Writes every field of the table into the block.
Definition deckField.h:237

References fields(), and inp::writeFields().

Here is the call graph for this function:

Field Documentation

◆ d_nearBdNodesTol

double inp::PNeighborDeck::d_nearBdNodesTol

Specify how deep we search for nodes near boundary for contact calculations.

Definition at line 36 of file pNeighborDeck.h.

Referenced by fields().

◆ d_neighUpdateInterval

size_t inp::PNeighborDeck::d_neighUpdateInterval

Neighbor update time interval (for contact)

Definition at line 33 of file pNeighborDeck.h.

Referenced by fields().

◆ d_sFactor

double inp::PNeighborDeck::d_sFactor

Neighbor search factor (search length is factor times biggest radius of particle)

Definition at line 30 of file pNeighborDeck.h.

Referenced by fields().

◆ d_updateCriteria

std::string inp::PNeighborDeck::d_updateCriteria

Neighbor search update criteria (if any)

Definition at line 26 of file pNeighborDeck.h.

Referenced by fields().


The documentation for this struct was generated from the following file: