libMesh
node.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 // C++ includes
21 #include <sstream>
22 
23 // Local includes
24 #include "libmesh/node.h"
25 
26 namespace libMesh
27 {
28 
29 
30 
31 
32 // ------------------------------------------------------------
33 // Node class static member initialization
34 //const unsigned int Node::invalid_id = libMesh::invalid_uint;
35 
36 
37 bool Node::operator==(const Node & rhs) const
38 {
39  // Explicitly calling the operator== defined in Point
40  return this->Point::operator==(rhs);
41 }
42 
43 
44 
45 void Node::print_info (std::ostream & os) const
46 {
47  os << this->get_info()
48  << std::endl;
49 }
50 
51 
52 
53 std::string Node::get_info () const
54 {
55  std::ostringstream oss;
56 
57  oss << " Node id()=";
58 
59  if (this->valid_id())
60  oss << this->id();
61  else
62  oss << "invalid";
63 
64  oss << ", processor_id()=" << this->processor_id() <<
65  ", Point=" << *static_cast<const Point *>(this) << '\n';
66 
67  oss << " DoFs=";
68  for (unsigned int s=0; s != this->n_systems(); ++s)
69  for (unsigned int v=0; v != this->n_vars(s); ++v)
70  for (unsigned int c=0; c != this->n_comp(s,v); ++c)
71  oss << '(' << s << '/' << v << '/' << this->dof_number(s,v,c) << ") ";
72 
73  return oss.str();
74 }
75 
76 
77 } // namespace libMesh
bool operator==(const TypeVector< Real > &rhs) const
bool valid_id() const
Definition: dof_object.h:674
A Node is like a Point, but with more information.
Definition: node.h:52
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:745
std::string get_info() const
Prints relevant information about the node to a string.
Definition: node.C:53
void print_info(std::ostream &os=libMesh::out) const
Prints relevant information about the node.
Definition: node.C:45
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
Definition: dof_object.h:810
The libMesh namespace provides an interface to certain functionality in the library.
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:780
dof_id_type id() const
Definition: dof_object.h:632
unsigned int n_systems() const
Definition: dof_object.h:726
bool operator==(const Node &rhs) const
Definition: node.C:37
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
processor_id_type processor_id() const
Definition: dof_object.h:694