FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fei_set_dof_mappings.hpp
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2009 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #ifndef _fei_set_dof_mappings_hpp_
10 #define _fei_set_dof_mappings_hpp_
11 
12 #include <fei_macros.hpp>
13 
14 #include <fei_DofMapper.hpp>
15 
16 namespace fei {
17 
18 template<class LocalOrdinal,class GlobalOrdinal,class DofOrder>
19 void set_dof_mappings(GlobalOrdinal first_index,
21 {
22  typedef typename fei::DofMapper<LocalOrdinal,GlobalOrdinal,DofOrder>::DofMap DofMap;
23  typedef typename fei::DofMapper<LocalOrdinal,GlobalOrdinal,DofOrder>::IdxMap IdxMap;
24 
25  typename DofMap::iterator
26  d_iter = dof_mapper.begin_dof(), d_end = dof_mapper.end_dof();
27 
28  IdxMap& idxmap = dof_mapper.get_idx_dof_map();
29 
30  GlobalOrdinal index = first_index;
31  for(; d_iter != d_end; ++d_iter) {
32  LocalOrdinal fieldsize = dof_mapper.getFieldSize(d_iter->first.field());
33  d_iter->second = index;
34  idxmap.insert(std::make_pair(index, &(d_iter->first)));
35  index += fieldsize;
36  }
37  dof_mapper.set_maps_are_valid(true);
38 }
39 
40 }//namespace fei
41 
42 #endif
43