• Main Page
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

/export/development/ViennaGrid/release/ViennaGrid-1.0.0/viennagrid/detail/element_orientation.hpp

Go to the documentation of this file.
00001 #ifndef VIENNAGRID_DETAIL_ELEMENT_ORIENTATION_HPP
00002 #define VIENNAGRID_DETAIL_ELEMENT_ORIENTATION_HPP
00003 
00004 /* =======================================================================
00005    Copyright (c) 2011, Institute for Microelectronics,
00006                        Institute for Analysis and Scientific Computing,
00007                        TU Wien.
00008 
00009                             -----------------
00010                      ViennaGrid - The Vienna Grid Library
00011                             -----------------
00012 
00013    Authors:      Karl Rupp                           rupp@iue.tuwien.ac.at
00014                  Josef Weinbub                    weinbub@iue.tuwien.ac.at
00015                
00016    (A list of additional contributors can be found in the PDF manual)
00017 
00018    License:      MIT (X11), see file LICENSE in the base directory
00019 ======================================================================= */
00020 
00021 
00022 #include <vector>
00023 #include <iostream>
00024 
00025 #include "viennagrid/forwards.h"
00026 
00031 namespace viennagrid
00032 {
00033   
00034   
00035   /************** Level 1: Elements contained by a higher-level element *******/
00036 
00043   template <long num_vertices>
00044   class element_orientation
00045   {
00046     public:
00047       void setDefaultOrientation()
00048       {
00049         for (dim_type i=0; i<static_cast<dim_type>(num_vertices); ++i)
00050           permutator_[i] = static_cast<unsigned char>(i);
00051       };
00052 
00053       dim_type operator()(dim_type in) const { return static_cast<dim_type>(permutator_[in]); }
00054 
00055       void setPermutation(dim_type index, dim_type mappedTo) { permutator_[index] = static_cast<unsigned char>(mappedTo); };
00056 
00057       void print() const
00058       {
00059         for (dim_type i=0; i<static_cast<dim_type>(num_vertices); ++i)
00060         {
00061           std::cout << i << "->" << permutator_[i] << ",";
00062         }
00063         std::cout << std::endl;
00064       }
00065 
00066     private:
00067       unsigned char permutator_[num_vertices];  //assuming less than 256 vertices is reasonable (no need to waste memory...)
00068   };
00069 
00070 }
00071 
00072 
00073 #endif
00074 

Generated on Wed Sep 14 2011 19:21:30 for ViennaGrid by  doxygen 1.7.1