MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / node_map_t

Method node_map_t

SRC/domain/domain/DomainModalProperties.cpp:207–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205 std::map<int, size_t> pos;
206
207 node_map_t(Domain* domain, int ndm, int ndf) {
208 size_t n = static_cast<size_t>(domain->getNumNodes());
209 if (n > 0) {
210 nodes.resize(n);
211 node_ids.resize(n);
212 node_u_flags.resize(n);
213 Node* nodePtr;
214 NodeIter& theNodes = domain->getNodes();
215 size_t counter = 0;
216 while ((nodePtr = theNodes()) != 0) {
217 // node
218 nodes[counter] = nodePtr;
219 // map
220 pos.emplace(std::make_pair(nodePtr->getTag(), counter));
221 // id (original), needed to see if this dof is fixed
222 const ID& id_source = nodePtr->getDOF_GroupPtr()->getID();
223 // id (remapped)
224 auto& id = node_ids[counter];
225 int node_ndf = nodePtr->getNumberDOF();
226 id.resize(node_ndf);
227 int offset = static_cast<int>(counter)* ndf; // each node has ndf DOFs in this context
228 for (int j = 0; j < node_ndf; ++j) {
229 if (j < ndf) {
230 // exclude pressure dofs
231 // we can detect a pressure node (node_ndf=4) in 3d.. but not in 2d!
232 if (node_ndf == 4 && ndf == 6 && j == 3) {
233 id(j) = DOF_EXCLUDED;
234 }
235 else {
236 if (id_source(j) == -1)
237 id(j) = DOF_FIXED;
238 else
239 id(j) = offset;
240 }
241 ++offset;
242 }
243 else {
244 // exclude any dof >= ndf
245 id(j) = DOF_EXCLUDED;
246 }
247 }
248 // local dof flags
249 std::vector<int>& flags = node_u_flags[counter];
250 flags.resize(node_ndf);
251 for (int j = 0; j < node_ndf; ++j)
252 flags[static_cast<size_t>(j)] = id(j) == DOF_EXCLUDED ? -1 : j;
253 // go on
254 ++counter;
255 }
256 }
257
258#ifdef DMP_VERBOSE
259 opserr << "NODE RE-MAPPING:\n";
260 opserr << "num eq: " << (int)(n * ndf) << "\n";
261 for (size_t i = 0; i < n; ++i) {
262 auto node = nodes[i];
263 const auto& id = node_ids[i];
264 const auto& uf = node_u_flags[i];

Callers

nothing calls this directly

Calls 9

getNodesMethod · 0.80
getIDMethod · 0.80
getNumNodesMethod · 0.45
resizeMethod · 0.45
getTagMethod · 0.45
getDOF_GroupPtrMethod · 0.45
getNumberDOFMethod · 0.45
SizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected