00001 /*************************************************************************** 00002 entity.h - description 00003 ------------------- 00004 begin : Fri Dec 19 2003 00005 copyright : (C) 2003 by Roman Geus 00006 email : roman.geus@psi.ch 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef ENTITY_H 00019 #define ENTITY_H 00020 00021 namespace mesh { 00022 00026 typedef unsigned int id_t; 00030 const id_t ID_NONE = static_cast<id_t>(-1); 00031 00036 class Entity { 00037 public: 00042 Entity(id_t id) : id_(id), bc_info_(0) 00043 {} 00047 id_t get_id() const 00048 { return id_; } 00052 bool on_boundary() 00053 { return bc_info_ & 1 == 1; } 00058 unsigned char on_symmetry_planes() { 00059 return bc_info_ >> 1; 00060 } 00065 void set_boundary(bool on_boundary) { 00066 if (on_boundary) 00067 bc_info_ |= 1U; 00068 else 00069 bc_info_ &= ~1U; 00070 } 00074 void set_symmetry_plane(int plane_id) { 00075 unsigned char mask = 2 << plane_id; 00076 bc_info_ |= mask; 00077 } 00078 private: // private members 00084 id_t id_; 00088 unsigned char bc_info_; 00089 }; 00090 00091 } // namespace mesh 00092 00093 #endif