/usr/include/trilinos/mrtr_node.H is in libtrilinos-moertel-dev 12.4.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | /*
#@HEADER
# ************************************************************************
#
# Moertel FE Package
# Copyright (2006) Sandia Corporation
#
# Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
# license for use of this work by or on behalf of the U.S. Government.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the Corporation nor the names of the
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Questions? Contact Glen Hansen (gahanse@sandia.gov)
#
# ************************************************************************
#@HEADER
*/
/* ******************************************************************** */
/* See the file COPYRIGHT for a complete copyright notice, contact */
/* person and disclaimer. */
/* ******************************************************************** */
/*!
* \file mrtr_node.H
*
* \class MOERTEL::Node
*
* \brief A class to construct a single node
*
* \date Last update do Doxygen: 20-March-06
*
*/
#ifndef MOERTEL_NODE_H
#define MOERTEL_NODE_H
#include <ctime>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include "Teuchos_RefCountPtr.hpp"
/*!
\brief MOERTEL: namespace of the Moertel package
The Moertel package depends on \ref Epetra, \ref EpetraExt, \ref Teuchos,
\ref Amesos, \ref ML and \ref AztecOO:<br>
Use at least the following lines in the configure of Trilinos:<br>
\code
--enable-moertel
--enable-epetra
--enable-epetraext
--enable-teuchos
--enable-ml
--enable-aztecoo --enable-aztecoo-teuchos
--enable-amesos
\endcode
*/
namespace MOERTEL
{
// forward declarations
class Interface;
class Segment;
class ProjectedNode;
/*!
\class Node
\brief <b> A class to construct a single node </b>
This class defines a node on one side of a (non-)conforming interface.
The \ref MOERTEL::Node class supports the ostream& operator <<
\author Glen Hansen (gahanse@sandia.gov)
*/
class Node
{
public:
// @{ \name Constructors and destructors
/*!
\brief Constructor
Constructs an instance of this class.<br>
Note that this is \b not a collective call as nodes shall only have one owning process.
\param Id : A unique positive node id. Does not need to be continous among nodes
\param x : ptr to vector of length 3 holding coordinates of node. In the 2D problem case x[2] has to be 0.0
\param ndof : Number of degrees of freedom on this node, e.g. 2 in 2D and 3 in 3D
\param dof : Pointer to vector of length ndof holding degrees of freedom on this node
\param isonboundary : True if node is on the boundary of a 2D interface (3D problem), or a 1D interface (2D problem).
Note that the number of lmdofs for nodes on the boundary are set to zero.
\param out : Level of output information written to stdout ( 0 - 10 )
*/
explicit Node(int Id, const double* x, int ndof, const int* dof, bool isonboundary, int out);
/*!
\brief Constructor
Constructs an \b empty instance of this class.<br>
Note that this is \b not a collective call as nodes shall only have one owning process.<br>
This constructor is used internally together with \ref Pack(int* size) and \ref UnPack(double* pack)<br>
to allow for communication of nodes among processes
\param out : Level of output information written to stdout ( 0 - 10 )
*/
explicit Node(int out);
/*!
\brief Copy-Constructor
Makes a deep copy of an existing node
\param old : Node to be copied
*/
Node(const MOERTEL::Node& old);
/*!
\brief Destructor
*/
virtual ~Node();
//@}
// @{ \name Public members
/*!
\brief Return the level of output written to stdout ( 0 - 10 )
*/
inline int OutLevel() { return outputlevel_; }
/*!
\brief Return unique and positive id of this node
*/
inline int Id() const { return Id_; }
/*!
\brief Print this node to stdout
*/
bool Print() const;
/*!
\brief Reset the internal state of this node and clear integrated values
This function resets the node and prepares it to be re-integrated. In nonlinear problems, the
interfaces (and nodes on the interface) may move relative to each other, each Newton iteration.
Calling Reset() clears the state of each node in preparation for resetting the nodal coordinates, and
re-integration each Newton iteration.
*/
void Reset();
/*!
\brief Returns the view (a vector of length 3) to the current coordinates of this node
*/
inline const double* X() const { return x_; }
/*!
\brief Update the coordinates of this Node
\param x : a vector of length 3 holding the new coordinates of this node
*/
inline bool SetX(double* x) { for (int i=0; i<3; ++i) x_[i] = x[i]; return true; }
/*!
\brief Return pointer to vector of length 3 of normal of this node
*/
inline const double* N() const { return n_; }
/*!
\brief Store a normal in this node
This class makes a deep copy of the vector n
\param n : pointer to vector of length 3 holding an outward normal at this node to be stored (deep copy) in this instance
*/
inline bool SetN(double* n) { for (int i=0; i<3; ++i) n_[i] = n[i]; return true; }
/*!
\brief Return the number of degrees of freedom on this node
*/
inline int Ndof() const { return dof_.size(); }
/*!
\brief Return the number of Lagrange mutlipliers on this node
Returns the number of Lagrange mutlipliers on this node which is normally equal to the
number of degrees of freedom on this node on the slave side of an interface and equal to
zero on the master side of an interface
*/
inline int Nlmdof() const { return LMdof_.size(); }
/*!
\brief Return view of degrees of freedom on this node
Returns a view of the vector of length \ref Ndof()
*/
inline const int* Dof() const { return &(dof_[0]); }
/*!
\brief Return view of the Lagrange multipliers on this node
Returns a view of the vector of length \ref Nlmdof()
*/
inline const int* LMDof() const { return &(LMdof_[0]); }
/*!
\brief Return the number of segments adjacent to this node
Returns the number of \ref MOERTEL::Segment adjacent to this node.
\warning This information is computed in \ref MOERTEL::Interface::Complete() and
does not exist before
*/
inline int Nseg() const { return seg_.size(); }
/*!
\brief Returns a view to the vector of segment ids of segments adjacent to this node
Returns a view to a vector of length \ref Nseg()
\warning This information is computed in \ref MOERTEL::Interface::Complete() and
does not exist before
*/
inline int* SegmentIds() { return &(seg_[0]); }
/*!
\brief Returns a view to the vector of pointers to segments adjacent to this node
Returns a view to a vector of length \ref Nseg()
\warning This information is computed in \ref MOERTEL::Interface::Complete() and
does not exist before
*/
inline MOERTEL::Segment** Segments() { return &(segptr_[0]); }
/*!
\brief Adds a segment id to the list of segments adjacent to this node
This method checks whether segment already exists in the adjacency
*/
bool AddSegment(int sid);
/*!
\brief Packs most information stored in this node to a double vector for communication with MPI
This method stores most but not all information stored in a \ref Node in a double vector
so it can be send easily using MPI. The method \ref Unpack(double* pack) is then used to
unpack the information into an empty Node instance on the receiving side.
It is used to provide processes that are member of an interface-local Epetra_Comm a redundant
map of nodes on that interface.
\param size : Returns the length of the double vector in size
\return pointer to double vector containing node information
*/
double* Pack(int* size);
/*!
\brief Unpacks information stored in a double vector to an instance of Node
Unpacks a double vector that was created using \ref Pack(int* size) and communicated<br>
into an empty instance of Node. The length of the vector is stored in the vector itself
and consistency of information is checked.
\param pack : Returns true upon success
*/
bool UnPack(double* pack);
/*!
\brief Build averaged normal from adjacent segments at this node
*/
bool BuildAveragedNormal();
/*!
\brief Construct vector of pointers to segments from adjacent segments id list
*/
bool GetPtrstoSegments(MOERTEL::Interface& interface);
/*!
\brief Store a pointer to a projected node
Stores a vector and takes ownership of a \ref MOERTEL::ProjectedNode which is
this Node projected onto an opposing interface surface
*/
bool SetProjectedNode(MOERTEL::ProjectedNode* pnode);
/*!
\brief Returns a view of all projected nodes this node owns
Returns a vector of RefCountPtr<MOERTEL::ProjectedNode> to all projected nodes this node
owns. When using a continous normal field as projection method, length of this
vector is 1. When using an orthogonal projection (1D interfaces only) a node can have
more then 1 projection
\params length : returns length of RefCountPtr<MOERTEL::ProjectedNode>*
*/
Teuchos::RCP<MOERTEL::ProjectedNode>* GetProjectedNode(int& length);
/*!
\brief Returns a view of the projection of this node
Returns a RefCountPtr<MOERTEL::ProjectedNode> to the projected node.
RefCountPtr<MOERTEL::ProjectedNode> is Teuchos::null if this Node
does not have a projection onto an opposing segment.
*/
Teuchos::RCP<MOERTEL::ProjectedNode> GetProjectedNode();
/*!
\brief Add a Lagrange multiplier id to this node's list
*/
bool SetLagrangeMultiplierId(int LMId);
/*!
\brief Add a value to the 'D' map of this node
The 'D' map is later assembled to the D matrix.
Note that the 'D' map in this Node is scalar and the column id is a node id
while the row map of the matrix D might have several Lagrange mutlipliers per node.
\params val : Value to be added
\params col : nodal column id of the value added
*/
void AddDValue(double val, int col);
/*!
\brief Add a value to the 'M' map of this node
The 'M' map is later assembled to the M matrix.
Note that the 'M' map in this Node is scalar and the column id is a node id
while the row map of the matrix M might have several Lagrange mutlipliers per node.
\params val : Value to be added
\params col : nodal column id of the value added
*/
void AddMValue(double val, int col);
/*!
\brief Add a value to the 'M' map of this node
The 'M' map is later assembled to the M matrix.
Note that Mmod here is a vector
\params row : Local LM id to add to (rowwise)
\params val : Value to be added
\params col : nodal column id of the value added
*/
void AddMmodValue(int row, double val, int col);
/*!
\brief Get view of the 'D' map of this node
*/
inline Teuchos::RCP<std::map<int,double> > GetD() { return Drow_; }
/*!
\brief Get view of the 'M' map of this node
*/
inline Teuchos::RCP<std::map<int,double> > GetM() { return Mrow_; }
/*!
\brief Get view of the 'Mmod' map of this node
*/
inline Teuchos::RCP<std::vector<std::map<int,double> > > GetMmod() { return Mmodrow_; }
/*!
\brief Set the flag indicating that node is corner node of 1D interface
*/
inline void SetCorner() { iscorner_ = true; return; }
/*!
\brief Query the flag indicating that node is corner node of 1D interface
*/
inline bool IsCorner() const { return iscorner_; }
/*!
\brief Query the flag indicating that node is on the boundary of 2D interface
*/
inline bool IsOnBoundary() const { return isonboundary_; }
/*!
\brief Get number of nodes that support this boundary node
If this Node is on the boundary, its shape functions are added to the support of
topologically close internal nodes. This method returns # of internal nodes supporting
this node. It returns 0 for all internal nodes.
*/
inline int NSupportSet() const { return supportedby_.size(); }
/*!
\brief Add an internal node to the map of nodes supporting this node
If this Node is on the boundary, its shape functions are added to the support of
topologically close internal nodes. This method adds an internal node to the map of nodes
supporting this node
*/
void AddSupportedByNode(MOERTEL::Node* suppnode)
{ supportedby_[suppnode->Id()] = suppnode; return; }
/*!
\brief Get the map of nodes supporting this node
If this Node is on the boundary, its shape functions are added to the support of
topologically close internal nodes. This method returns the map of nodes supporting this node
*/
std::map<int,MOERTEL::Node*>& GetSupportedByNode() { return supportedby_; }
/*!
\brief Return distance between projection and source node.
Returns the gap distance between the source node and projected image on the target segment. This distance
is along the projection vector, and will be negative if the projected image is on the "wrong" side of the
interface that contains the source node.
*/
double Gap() { return gap_; }
/*!
\brief Sets the distance between projection and source node.
Sets the gap distance between the source node and projected image on the target segment. This distance
is along the projection vector, and will be negative if the projected image is on the "wrong" side of the
interface that contains the source node.
*/
void SetGap(double gap) { gap_ = gap; }
//@}
protected:
// don't want = operator
Node operator = (const Node& old);
protected:
int Id_; // Id of this node
double x_[3]; // coordinates of this node
double n_[3]; // a nodal outward normal
int outputlevel_;
bool iscorner_; // flag indicating whether this is a node
// shared by several interfaces in 2D
bool isonboundary_; // flag indicating whether this node is on the boundary
// of a 3D interface
// Info only matters for the slave side
std::map<int,MOERTEL::Node*> supportedby_;
std::vector<int> dof_; // dof ids on this node
std::vector<int> LMdof_; // dofs ids of LM if this is slave side
std::vector<int> seg_; // std::vector of segment ids adjacent to me
std::vector<MOERTEL::Segment*> segptr_; // ptrs to segments length nseg_ (not in charge of destorying the ptrs))
Teuchos::RCP<std::map<int,double> > Drow_; // a nodal block row of D
Teuchos::RCP<std::map<int,double> > Mrow_; // a nodal block row of D
Teuchos::RCP<std::vector<std::map<int,double> > > Mmodrow_; // scalar rows of Mmod
std::vector< Teuchos::RCP<MOERTEL::ProjectedNode> > pnode_; // the projected node on some segment
double gap_; // distance between projection and source node "the gap"
};
} // namespace MOERTEL
// << operator
std::ostream& operator << (std::ostream& os, const MOERTEL::Node& node);
#endif // MOERTEL_NODE_H
|