/usr/include/libmesh/node.h is in libmesh-dev 0.7.1-2ubuntu1.
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 | // $Id: node.h 4279 2011-03-21 17:01:31Z roystgnr $
// The libMesh Finite Element Library.
// Copyright (C) 2002-2008 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef __node_h__
#define __node_h__
// C++ includes
// Local includes
#include "point.h"
#include "dof_object.h"
#include "reference_counted_object.h"
#include "auto_ptr.h"
namespace libMesh
{
// forward declarations
class Node;
class MeshRefinement;
/**
* A \p Node is like a \p Point, but with more information. A \p Node
* is located in space and is associated with some \p (x,y,z)
* coordinates. Additionally, a \p Node may be enumerated with a
* global \p id. Finally, a \p Node may have an arbitrary number of
* degrees of freedom associated with it.
*
* \author Benjamin S. Kirk
* \date 2003
* \version $Revision: 4279 $
*/
class Node : public Point,
public DofObject,
public ReferenceCountedObject<Node>
{
public:
/**
* Constructor. By default sets all entries to 0. Gives the point 0 in
* \p LIBMESH_DIM dimensions with an \p id of \p Node::invalid_id
*/
Node (const Real x,
const Real y,
const Real z,
const unsigned int id = invalid_id);
/**
* Copy-constructor.
*/
Node (const Node& n);
/**
* Copy-constructor from a \p Point. Optionally assigned the \p id.
*/
explicit Node (const Point& p,
const unsigned int id = invalid_id);
/**
* Destructor.
*/
virtual ~Node ();
/**
* Assign to a node from a point
*/
Node& operator= (const Point& p);
/**
* Builds a \p Node and returns an \p AutoPtr<Node> to the
* newly-created object. The \p id is copied from \p n.id()
*/
static AutoPtr<Node> build (const Node& n);
/**
* Builds a \p Node from \p Point p and returns an \p AutoPtr<Node>
* to the newly-created object. Optionally assignes the \p id.
*/
static AutoPtr<Node> build (const Point& p,
const unsigned int id);
/**
* Builds a \p Node from specified points and returns an \p AutoPtr<Node>
* to the newly-created object. Optionally assigned the \p id.
*/
static AutoPtr<Node> build (const Real x,
const Real y,
const Real z,
const unsigned int id);
/**
* @returns \p true if the node is active. An active node is
* defined as one for which \p id() is not \p Node::invalid_id.
* Inactive nodes are nodes that are in the mesh but are not
* connected to any elements.
*/
bool active () const;
/**
* @returns \p true if this node equals rhs, false otherwise.
*/
bool operator ==(const Node& rhs) const;
#ifdef LIBMESH_HAVE_MPI
/**
* Convenient way to communicate nodes. This struct defines a
* packed up node which can be easily communicated through a
* derived MPI datatype.
*
* \author Benjamin S. Kirk
* \date 2008
*/
struct PackedNode
{
unsigned int id;
unsigned int pid;
Real x;
// FIXME: We should drop z (and y) if libMesh is built 2D (or 1D) only
Real y;
Real z;
PackedNode () :
id(0),
pid(DofObject::invalid_processor_id),
x(0.),
y(0.),
z(0.)
{}
PackedNode (const Node &node) :
id(node.id()),
pid(node.processor_id()),
x(node(0)),
#if LIBMESH_DIM > 1
y(node(1)),
#else
y(0.),
#endif
#if LIBMESH_DIM > 2
z(node(2))
#else
z(0.)
#endif
{}
AutoPtr<Node> build_node () const
{
AutoPtr<Node> node(new Node(x,y,z,id));
node->processor_id() = pid;
return node;
}
Point build_point () const
{
return Point(x,y,z);
}
static MPI_Datatype create_mpi_datatype ();
};
#endif // #ifdef LIBMESH_HAVE_MPI
private:
/**
* This class need access to the node key information,
* but no one else should be able to mess with it.
*/
friend class MeshRefinement;
friend class Elem;
};
//------------------------------------------------------
// Inline functions
inline
Node::Node (const Real x,
const Real y,
const Real z,
const unsigned int id) :
Point(x,y,z)
{
this->set_id() = id;
}
inline
Node::Node (const Node& n) :
Point(n),
DofObject(n),
ReferenceCountedObject<Node>()
{
}
inline
Node::Node (const Point& p,
const unsigned int id) :
Point(p)
{
// optionally assign the id. We have
// to do it like this otherwise
// Node n = Point p would erase
// the id!
if (id != invalid_id)
this->set_id() = id;
}
inline
Node::~Node ()
{
}
inline
Node & Node::operator= (const Point& p)
{
(*this)(0) = p(0);
#if LIBMESH_DIM > 1
(*this)(1) = p(1);
#endif
#if LIBMESH_DIM > 2
(*this)(2) = p(2);
#endif
return *this;
}
inline
AutoPtr<Node> Node::build(const Node& n)
{
AutoPtr<Node> ap(new Node(n));
return ap;
}
inline
AutoPtr<Node> Node::build(const Point& p,
const unsigned int id)
{
AutoPtr<Node> ap(new Node(p,id));
return ap;
}
inline
AutoPtr<Node> Node::build(const Real x,
const Real y,
const Real z,
const unsigned int id)
{
AutoPtr<Node> ap(new Node(x,y,z,id));
return ap;
}
inline
bool Node::active () const
{
return (this->id() != Node::invalid_id);
}
} // namespace libMesh
#endif
|