FEI Version of the Day
fei_set_dof_mappings.hpp
00001 /*--------------------------------------------------------------------*/
00002 /*    Copyright 2009 Sandia Corporation.                              */
00003 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00004 /*    non-exclusive license for use of this work by or on behalf      */
00005 /*    of the U.S. Government.  Export of this program may require     */
00006 /*    a license from the United States Government.                    */
00007 /*--------------------------------------------------------------------*/
00008 
00009 #ifndef _fei_set_dof_mappings_hpp_
00010 #define _fei_set_dof_mappings_hpp_
00011 
00012 #include <fei_macros.hpp>
00013 
00014 #include <fei_DofMapper.hpp>
00015 
00016 namespace fei {
00017 
00018 template<class LocalOrdinal,class GlobalOrdinal,class DofOrder>
00019 void set_dof_mappings(GlobalOrdinal first_index,
00020                       fei::DofMapper<LocalOrdinal,GlobalOrdinal,DofOrder>& dof_mapper)
00021 {
00022   typedef typename fei::DofMapper<LocalOrdinal,GlobalOrdinal,DofOrder>::DofMap DofMap;
00023   typedef typename fei::DofMapper<LocalOrdinal,GlobalOrdinal,DofOrder>::IdxMap IdxMap;
00024 
00025   typename DofMap::iterator
00026     d_iter = dof_mapper.begin_dof(), d_end = dof_mapper.end_dof();
00027 
00028   IdxMap& idxmap = dof_mapper.get_idx_dof_map();
00029 
00030   GlobalOrdinal index = first_index;
00031   for(; d_iter != d_end; ++d_iter) {
00032     LocalOrdinal fieldsize = dof_mapper.getFieldSize(d_iter->first.field());
00033     d_iter->second = index;
00034     idxmap.insert(std::make_pair(index, &(d_iter->first)));
00035     index += fieldsize;
00036   }
00037   dof_mapper.set_maps_are_valid(true);
00038 }
00039 
00040 }//namespace fei
00041 
00042 #endif
00043 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends