~ubuntu-branches/ubuntu/trusty/rheolef/trusty

« back to all changes in this revision

Viewing changes to nfem/basis/P2_numbering.cc

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito
  • Date: 2012-04-06 09:12:21 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120406091221-m58me99p1nxqui49
Tags: 6.0-1
* New upstream release 6.0 (major changes):
  - massively distributed and parallel support
  - full FEM characteristic method (Lagrange-Gakerkin method) support
  - enhanced users documentation 
  - source code supports g++-4.7 (closes: #667356)
* debian/control: dependencies for MPI distributed solvers added
* debian/rules: build commands simplified
* debian/librheolef-dev.install: man1/* to man9/* added
* debian/changelog: package description rewritted (closes: #661689)

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
        const size_type*      mesh_n_geo,
58
58
        const size_type*      mesh_n_element,
59
59
        const geo_element&    K,
60
 
        size_type             i_dof_local) const
 
60
        size_type             loc_idof) const
61
61
{
62
62
        // all vertices-based dof are numbered first
63
63
        // then all edge-based dof
64
64
        // and then all dof based on interior nodes (e.g. quadrangles)
65
65
 
66
66
        // for mixed triangle-quadrangle mesh : assume triangle are numbered first
67
 
        switch (K.type()) {
 
67
        switch (K.variant()) {
68
68
          case reference_element::p: 
69
69
            return K.index();
70
70
          case reference_element::e: 
71
 
            if (i_dof_local < 2) {
72
 
              return K [i_dof_local];
 
71
            if (loc_idof < 2) {
 
72
              return K [loc_idof];
73
73
            } else {
74
74
              return mesh_n_geo[0] + K.index();
75
75
            }
76
 
          case reference_element::t: 
77
 
            if (i_dof_local < 3) {
78
 
              return K [i_dof_local];
79
 
            } else {
80
 
              return mesh_n_geo[0] + K.edge(i_dof_local - 3);
81
 
            }
82
 
          case reference_element::q: 
83
 
            if (i_dof_local < 4) {
84
 
              return K [i_dof_local];
85
 
            } else if (i_dof_local < 8) {
86
 
              return mesh_n_geo[0] + K.edge(i_dof_local - 4);
87
 
            } else {
88
 
              return mesh_n_geo[0] + mesh_n_geo[1]
89
 
                  + K.index() - mesh_n_element[reference_element::t];
90
 
            }
 
76
          case reference_element::t: {
 
77
            if (loc_idof < 3) {
 
78
              return K [loc_idof];
 
79
            }
 
80
            size_type nv = mesh_n_geo[0];
 
81
            size_type loc_iedg = loc_idof - 3;
 
82
            size_type iedg = K.edge(loc_iedg);
 
83
            return nv + iedg;
 
84
          }
 
85
          case reference_element::q: {
 
86
            if (loc_idof < 4) {
 
87
              return K [loc_idof];
 
88
            } 
 
89
            if (loc_idof < 8) {
 
90
              return mesh_n_geo[0] + K.edge(loc_idof - 4);
 
91
            }
 
92
            size_type iqua = K.index() - mesh_n_element[reference_element::t];
 
93
            return mesh_n_geo[0] + mesh_n_geo[1] + iqua;
 
94
          }
91
95
          case reference_element::T: 
92
 
            if (i_dof_local < 4) {
93
 
              return K [i_dof_local];
 
96
            if (loc_idof < 4) {
 
97
              return K [loc_idof];
94
98
            } else {
95
 
              return mesh_n_geo[0] + K.edge(i_dof_local - 4);
96
 
            }
97
 
          case reference_element::P: 
98
 
          case reference_element::H:
 
99
              return mesh_n_geo[0] + K.edge(loc_idof - 4);
 
100
            }
 
101
          case reference_element::P: {
 
102
            if (loc_idof < 6) { // 6 vertex dofs
 
103
              return K [loc_idof];
 
104
            }
 
105
            size_type nv = mesh_n_geo[0];
 
106
            if (loc_idof < 6+9) { // 9 edge face dofs
 
107
              return nv + K.edge(loc_idof - 6);
 
108
            } 
 
109
            // 3 quad face dofs
 
110
            size_type nedg = mesh_n_geo[1];
 
111
            size_type ntri = mesh_n_element[reference_element::t];
 
112
            size_type iqua = K.face(loc_idof - 6 - 9) - ntri;
 
113
            return nv + nedg + iqua;
 
114
          }
 
115
          case reference_element::H: {
 
116
            if (loc_idof < 8) { // 8 vertex dofs
 
117
              return K [loc_idof];
 
118
            } 
 
119
            size_type nv = mesh_n_geo[0];
 
120
            if (loc_idof < 8+12) { // 12 edge face dofs
 
121
              return nv + K.edge(loc_idof - 8);
 
122
            } 
 
123
            size_type nedg = mesh_n_geo[1];
 
124
            size_type ntri = mesh_n_element[reference_element::t];
 
125
            if (loc_idof < 8+12+6) { // 6 face dofs
 
126
              size_type iqua = K.face(loc_idof - 8 - 12) - ntri;
 
127
              return nv + nedg + iqua;
 
128
            } 
 
129
            // else: 1 volume dof
 
130
            assert_macro (loc_idof < 27, "invalid loc_idof="<<loc_idof);
 
131
            size_type nqua = mesh_n_element[reference_element::q];
 
132
            size_type ntet = mesh_n_element[reference_element::T];
 
133
            size_type npri = mesh_n_element[reference_element::P];
 
134
            size_type ihex = K.index() - ntet - npri;
 
135
            return nv + nedg + nqua + ihex;
 
136
          }
99
137
          default:
100
138
            error_macro ("unsupported P2 element on `" << K.name() << "'");
101
139
            return 0;
106
144
        const size_type*      mesh_n_geo,
107
145
        const size_type*      mesh_n_element,
108
146
        const geo_element&    K, 
109
 
        vector<size_type>&    i_dof) const
 
147
        vector<size_type>&    idof) const
110
148
{
111
 
  for (size_type i_dof_local = 0; i_dof_local < K.size(); i_dof_local++)
112
 
    i_dof[i_dof_local] 
113
 
     = numbering_P2::idof (mesh_n_geo, mesh_n_element, K, i_dof_local);
 
149
  for (size_type loc_idof = 0; loc_idof < K.size(); loc_idof++)
 
150
    idof[loc_idof] 
 
151
     = numbering_P2::idof (mesh_n_geo, mesh_n_element, K, loc_idof);
114
152
}
115
153
numbering_P2::size_type
116
154
numbering_P2::ndof (
129
167
        return mesh_n_geo[0]
130
168
          + mesh_n_geo[1]
131
169
          + mesh_n_element[reference_element::q];
132
 
      case 3:
 
170
      case 3: {
 
171
        // number of vertices + nb of edges in the mesh
 
172
        // + number of quadrangle (extra interior node)
 
173
        // + number of hexaedra   (extra interior node)
133
174
        return mesh_n_geo[0]
134
175
          + mesh_n_geo[1]
135
 
          + mesh_n_element[reference_element::P]
 
176
          + mesh_n_element[reference_element::q]
136
177
          + mesh_n_element[reference_element::H];
 
178
      }
137
179
      default:
138
180
        fatal_macro ("unsupported P2 approximation in `" << mesh_map_dimension << "'");
139
181
        return 0;