LifeV
DOFInterface3Dto3D.hpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file
29  @brief Class for interfacing dofs between two 3D meshes
30 
31  @author M.A. Fernandez
32  @date 00-11-2002
33 
34  @contributor Samuel Quinodoz <samuel.quinodoz@epfl.ch>
35  @contributor Mauro Perego <mperego@fsu.edu>
36  @mantainer Samuel Quinodoz <samuel.quinodoz@epfl.ch>
37 
38  This file contains the class which may be used to update and hold the connections between the dof
39  on two matching meshes.
40  */
41 
42 #ifndef _DOFINTERFACE3DTO3D_HH
43 #define _DOFINTERFACE3DTO3D_HH
44 
45 #include <lifev/core/LifeV.hpp>
46 
47 #include <lifev/core/mesh/MarkerDefinitions.hpp>
48 
49 #include <lifev/core/fem/DOFInterface.hpp>
50 #include <lifev/core/fem/ReferenceFE.hpp>
51 #include <lifev/core/fem/DOF.hpp>
52 #include <lifev/core/fem/CurrentFEManifold.hpp>
53 #include <lifev/core/util/LifeChrono.hpp>
54 
55 #include <lifev/core/array/MatrixSmall.hpp>
56 
57 namespace LifeV
58 {
59 /*!
60  \class DOFInterface3Dto3D
61 
62  Base class which builds and holds the connections of the DOF associated with matching facets with given flags.
63  The connections can be between two different matching meshes, or within the same mesh (having matching boundary facets).
64 
65  In order to hold the interface connections the user must give the
66  ReferenceFE elements and DOF used in both meshes. The connections may be
67  built by calling the update method. An interpolate method has been
68  provided in order to interpolate data at the interface. Finally
69  method getInterfaceDof gives the connections.
70 
71 */
72 class DOFInterface3Dto3D:
73  public DOFInterface
74 {
75 public:
76  //! @name Public typedefs
77  //@{
78  typedef boost::numeric::ublas::vector<Real> Vector;
79  typedef std::function<bool ( const std::vector<Real>&, const std::vector<Real>&, const Real& ) > fct;
80  //@}
81 
82  //! @name Constructor & Destructor
83  //@{
84 
85  //! default constructor
86  DOFInterface3Dto3D()
87  :
88  M_refFE1 ( 0 ),
89  M_dof1 ( 0 ),
90  M_refFE2 ( 0 ),
91  M_dof2 ( 0 )
92  {}
93 
94  //! Constructor for interfacing DOF of the same type (ReferenceFE)
95  /*!
96  \param refFe the reference FE used in both meshes
97  \param dof1 the DOF object of the mesh in which we want to make the computations
98  \param dof2 the DOF object of the mesh which provides the data at the interface
99  */
100  DOFInterface3Dto3D ( const ReferenceFE& refFE, const DOF& dof1, const DOF& dof2 );
101 
102  //! Constructor for interfacing DOF of different type (ReferenceFE)
103  /*!
104  \param refFe1 the reference FE used in the mesh in which we want to make the computations
105  \param dof1 the DOF object of the mesh in which we want to make the computations
106  \param refFe2 the reference FE used in the mesh which provides the data at the interface
107  \param dof2 the DOF object of the mesh which provides the data at the interface
108  */
109  DOFInterface3Dto3D ( const ReferenceFE& refFE1, const DOF& dof1, const ReferenceFE& refFE2, const DOF& dof2 );
110 
111  //! Constructor for interfacing DOF of the same type (ReferenceFE)
112  /*!
113  \param dof the DOF object of the mesh in which we want to make the computations
114  */
115  DOFInterface3Dto3D ( const ReferenceFE& refFE, const DOF& dof);
116 
117 
118  //@}
119 
120 
121  //! @name Methods
122  //@{
123 
124  //! Setup method for common finite element
125  void setup (const ReferenceFE& refFE, const DOF& dof1, const DOF& dof2 );
126 
127  //! Setup method for possibly different finite element
128  void setup (const ReferenceFE& refFE1, const DOF& dof1, const ReferenceFE& refFE2, const DOF& dof2 );
129 
130  //! This method builds the DOF connections at the interface
131  /*!
132  \param mesh1 the mesh in which we want to make the computations
133  \param flag1 the marker of the interface in the mesh1
134  \param mesh2 the mesh which provides de data at the interface
135  \param flag2 the marker of the interface in the mesh2
136  \param tol tolerance for connecting points of both meshes at the interface
137  \param flag3 the marker of a region of interface in the mesh1
138  \brief{The parameter flag3 is used in test_meshReorder to export the part of interface determined by flag3 on mesh2.}
139  */
140 
141  template <typename MeshType>
142  void update ( MeshType& mesh1,
143  const markerID_Type& flag1,
144  MeshType& mesh2,
145  const markerID_Type& flag2,
146  const Real& tol,
147  Int const* const flag3 = 0 );
148 
149  //! This method builds the DOF connections between two matching surfaces belonging to the same mesh
150  /*!
151  \param mesh the mesh in which we want to make the computations
152  \param flag1 the marker of the first set of facets in the mesh
153  \param flag2 the marker of facets to be connected with facets marked with flag1
154  \param tol tolerance for connecting points of both meshes at the interface
155  \param coupled a function of points p1 and p2, that returns true if the points are coupled, false otherwise.
156  points p1 and p2 are constituted of std::vector<Real>(3) containing the coordinates.
157  */
158  template <typename MeshType>
159  void update ( MeshType& mesh,
160  const markerID_Type& flag1,
161  const markerID_Type& flag2,
162  const Real& tol, const fct& coupled );
163 
164 
165  //! This method interpolate data when using different FE
166  /*!
167  \param mesh2 the mesh which provides de data at the interface
168  \param v the data vector on mesh2 holding dofs of type refFE1
169  \param vI the interpolated data vector on mesh2 holding dofs of type refFE2
170 
171  \note We should use this method ONLY when the accuracy of the data is less that
172  the accuracy of the unknowns on mesh1, i.e., when refFE1 is more accurate
173  than refFE2
174  */
175  template <typename MeshType>
176  void interpolate ( MeshType& mesh2, const UInt nbComp, const Vector& v, Vector& vI );
177 
178  //@}
179 
180 
181  //! @name Get Methods
182  //@{
183 
184  //! This method returns the corresponding dof object when interpolation is used
185  const UInt& numTotalDof() const
186  {
187  return M_dof->numTotalDof();
188  }
189 
190  //! reference to the list of connected facets.
191  const std::list< std::pair<ID, ID> >& connectedFacetMap() const
192  {
193  return M_facetToFacetConnectionList;
194  }
195 
196  //@}
197 
198 private:
199 
200  //! STL iterator type for the lists
201  typedef std::list< std::pair<ID, ID> >::iterator Iterator;
202 
203 
204  //! @name Private Methods
205  //@{
206 
207  //! This method builds the connections between facets at the interface (M_facetToFacetConnectionList container)
208  /*!
209  \param mesh1 the mesh in which we want to make the computations
210  \param flag1 the marker of the interface in the mesh1
211  \param mesh2 the mesh which provides de data at the interface
212  \param flag2 the marker of the interface in the mesh2
213  \param tol tolerance for connecting points of both meshes at the interface
214  \param coupled a function of points p1 and p2, that returns true if the points are coupled, false otherwise.
215  points p1 and p2 are constituted of std::vector<Real>(3) containing the coordinates.
216  */
217  template <typename MeshType>
218  void updateFacetConnections ( const MeshType& mesh1, const markerID_Type& flag1,
219  const MeshType& mesh2, const markerID_Type& flag2, const Real& tol, const fct& coupled );
220  //! This method builds the connections between DOF at the interface (M_dofToDofConnectionList container)
221  /*!
222  \param mesh1 the mesh in which we want to make the computations
223  \param dof1 the DOF object of the mesh in which we want to make the computations
224  \param mesh2 the mesh which provides de data at the interface
225  \param dof2 the DOF object of the mesh which provides de data at the interface
226  \param tol tolerance for connecting points of both meshes at the interface
227  \param coupled a function of points p1 and p2, that returns true if the points are coupled, false otherwise.
228  points p1 and p2 are constituted of std::vector<Real>(3) containing the coordinates.
229  \param flag3 the marker of a region of interface in the mesh1
230  \brief{The parameter flag3 is used in test_meshReorder to export the part of interface determined by flag3 on mesh2.}
231  */
232  template <typename MeshType>
233  void updateDofConnections ( const MeshType& mesh1, const DOF& dof1,
234  const MeshType& mesh2, const DOF& dof2, const Real& tol, const fct& coupled,
235  Int const* const flag3 = 0 );
236 
237  //@}
238 
239 
240  //! ReferenceFE object used in the mesh in which we want to make the computations
241  const ReferenceFE* M_refFE1;
242 
243  //! DOF object of the mesh in which we want to make the computations
244  const DOF* M_dof1;
245 
246  //! ReferenceFE object used in the mesh which provides de data at the interface
247  const ReferenceFE* M_refFE2;
248 
249  //! DOF object of the mesh which provides the data at the interface
250  const DOF* M_dof2;
251 
252  //! Auxiliary DOF object of the mesh which provides the local to global table
253  //! when interpolation is used
254  std::shared_ptr<DOF> M_dof;
255 
256  //! STL list which holds the connections between facets at the interface
257  std::list< std::pair<ID, ID> > M_facetToFacetConnectionList;
258 
259  //! Auxiliary STL list which holds the connections between DOF at the interface
260  //! Empty after calling update
261  std::list< std::pair<ID, ID> > M_dofToDofConnectionList;
262 
263 };
264 
265 // ===================================================
266 // Helpers
267 // ===================================================
268 
269 //! Returns true if the Points p1 and p2 are equal with respect to the tolerance tol (in norm 1)
270 bool coincide ( const std::vector<Real>& p1, const std::vector<Real>& p2, const Real& tol );
271 
272 // ===================================================
273 // Methods
274 // ===================================================
275 
276 template <typename MeshType>
277 void DOFInterface3Dto3D::update ( MeshType& mesh1, const markerID_Type& flag1,
278  MeshType& mesh2, const markerID_Type& flag2,
279  const Real& tol, Int const* const flag3 )
280 {
281 
282  // Updating facet connections at the interface
283  updateFacetConnections ( mesh1, flag1, mesh2, flag2, tol, coincide );
284 
285  if ( M_refFE1->nbDof() > M_refFE2->nbDof() )
286  {
287  // Update of the DOF connections when we need interpolation
288  M_dof->update ( mesh2 ); // Building auxiliary dof
289  updateDofConnections ( mesh1, *M_dof1, mesh2, *M_dof, tol, coincide, flag3 ); // Update of the DOF connections
290  }
291  else
292  // Update of the DOF connections without interpolation
293  {
294  updateDofConnections ( mesh1, *M_dof1, mesh2, *M_dof2, tol, coincide, flag3 );
295  }
296 }
297 
298 
299 template <typename MeshType>
300 void DOFInterface3Dto3D::update ( MeshType& mesh, const markerID_Type& flag1,
301  const markerID_Type& flag2, const Real& tol, const fct& coupled)
302 {
303  // Updating facet connections at the interface
304  updateFacetConnections ( mesh, flag1, mesh, flag2, tol, coupled );
305 
306  // Update of the DOF connections without interpolation
307  updateDofConnections ( mesh, *M_dof1, mesh, *M_dof2, tol, coupled );
308 }
309 
310 
311 template <typename MeshType>
312 void DOFInterface3Dto3D::interpolate ( MeshType& mesh2, const UInt nbComp, const Vector& v, Vector& vI )
313 {
314 
315  typedef typename MeshType::elementShape_Type GeoShape; // Element shape
316  typedef typename GeoShape::GeoBShape GeoBShape; // Facet Shape
317 
318  UInt nbVertexPerFacet = GeoBShape::S_numVertices; // Number of facet's vertices
319  UInt nbRidgePerFacet = GeoBShape::S_numRidges; // Number of facet's ridges
320 
321  UInt nbDofPerVertex = M_refFE1->nbDofPerVertex(); // number of DOF per vertices
322  UInt nbDofPerRidge = M_refFE1->nbDofPerRidge(); // number of DOF per ridges
323  UInt nbDofPerFacet = M_refFE1->nbDofPerFacet(); // number of DOF per facets
324 
325  UInt nbVertexPerElement = GeoShape::S_numVertices; // Number of element's vertices
326  UInt nbRidgePerElement = GeoShape::S_numRidges; // Number of element's ridges
327 
328  UInt nbDofPerElement = M_refFE2->nbDof(); // Number of DOF per element in the lowDof mesh
329 
330  UInt nbVertexDofPerElement = nbVertexPerElement * nbDofPerVertex; // number of vertex's DOF on a Element
331  UInt nbRidgeDofPerElement = nbRidgePerElement * nbDofPerRidge; // number of ridge's DOF on a Element
332 
333  ID ibF, iElAd, iFaEl, iVeEl, lDof, iEdEl;
334 
335  Real x, y, z, sum;
336 
337  std::vector<Real> vLoc ( nbDofPerElement * nbComp );
338 
339 
340  // Loop on facets at the interface (matching facets)
341  for ( Iterator i = M_facetToFacetConnectionList.begin(); i != M_facetToFacetConnectionList.end(); ++i )
342  {
343 
344  ibF = i->second; // Facet number at the interface
345 
346  iElAd = mesh2.boundaryFacet ( ibF ).firstAdjacentElementIdentity(); // id of the element adjacent to the facet
347  iFaEl = mesh2.boundaryFacet ( ibF ).firstAdjacentElementPosition(); // local id of the facet in its adjacent element
348 
349  // Updating the local dof of the data vector in the adjacent element
350  for ( UInt icmp = 0; icmp < nbComp; ++icmp )
351  for ( ID idof = 0; idof < nbDofPerElement; ++idof )
352  {
353  vLoc[ icmp * nbDofPerElement + idof ] = v [ icmp * M_dof2->numTotalDof() + M_dof2->localToGlobalMap ( iElAd, idof ) ];
354  }
355 
356  // Vertex based Dof
357  if ( nbDofPerVertex )
358  {
359 
360  // loop on facet vertices
361  for ( ID iVeFa = 0; iVeFa < nbVertexPerFacet; ++iVeFa )
362  {
363 
364  iVeEl = GeoShape::facetToPoint ( iFaEl, iVeFa ); // local vertex number (in element)
365 
366  // Loop number of DOF per vertex
367  for ( ID l = 0; l < nbDofPerVertex; ++l )
368  {
369  lDof = iVeEl * nbDofPerVertex + l; // Local dof in the adjacent Element
370 
371  // Nodal coordinates
372  x = M_refFE1->xi ( lDof );
373  y = M_refFE1->eta ( lDof );
374  z = M_refFE1->zeta ( lDof );
375 
376  // Loop on data vector components
377  for ( UInt icmp = 0; icmp < nbComp; ++icmp )
378  {
379 
380  // Interpolating data at the nodal point
381  sum = 0;
382  for ( ID idof = 0; idof < nbDofPerElement; ++idof ) // Loop on local DOF on the adjacent element
383  {
384  sum += vLoc[ icmp * nbDofPerElement + idof ] * M_refFE2->phi ( idof, x, y, z );
385  }
386 
387  // Updating interpolating vector
388  vI ( icmp * M_dof->numTotalDof() + M_dof->localToGlobalMap ( iElAd, lDof ) ) = sum;
389  }
390  }
391  }
392  }
393 
394  // Ridge based Dof
395  if ( nbDofPerRidge )
396  {
397 
398  // loop on facet ridges
399  for ( ID iEdFa = 0; iEdFa < nbRidgePerFacet; ++iEdFa )
400  {
401 
402  iEdEl = GeoShape::faceToRidge ( iFaEl, iEdFa ).first; // local ridge number (in element)
403 
404  // Loop number of DOF per ridge
405  for ( ID l = 0; l < nbDofPerRidge; ++l )
406  {
407  lDof = nbVertexDofPerElement + iEdEl * nbDofPerRidge + l; // Local dof in the adjacent Element
408 
409  // Nodal coordinates
410  x = M_refFE1->xi ( lDof );
411  y = M_refFE1->eta ( lDof );
412  z = M_refFE1->zeta ( lDof );
413 
414  // Loop on data vector components
415  for ( UInt icmp = 0; icmp < nbComp; ++icmp )
416  {
417 
418  // Interpolating data at the nodal point
419  sum = 0;
420  for ( ID idof = 0; idof < nbDofPerElement; ++idof ) // Loop on local DOF on the adjacent element
421  {
422  sum += vLoc[ icmp * nbDofPerElement + idof ] * M_refFE2->phi ( idof, x, y, z );
423  }
424 
425  // Updating interpolating vector
426  vI ( icmp * M_dof->numTotalDof() + M_dof->localToGlobalMap ( iElAd, lDof ) ) = sum;
427  }
428  }
429  }
430  }
431 
432  // Loop on number of DOF per facet
433  for ( ID l = 0; l < nbDofPerFacet; ++l )
434  {
435  lDof = nbRidgeDofPerElement + nbVertexDofPerElement + iFaEl * nbDofPerFacet + l; // Local dof in the adjacent Element
436 
437  // Nodal coordinates
438  x = M_refFE1->xi ( lDof );
439  y = M_refFE1->eta ( lDof );
440  z = M_refFE1->zeta ( lDof );
441 
442  // Loop on data vector components
443  for ( UInt icmp = 0; icmp < nbComp; ++icmp )
444  {
445 
446  // Interpolating data at the nodal point
447  sum = 0;
448  for ( ID idof = 0; idof < nbDofPerElement; ++idof ) // Loop on local DOF on the adjacent element
449  {
450  sum += vLoc[ icmp * nbDofPerElement + idof ] * M_refFE2->phi ( idof, x, y, z );
451  }
452 
453  // Updating interpolating vector
454  vI ( icmp * M_dof->numTotalDof() + M_dof->localToGlobalMap ( iElAd, lDof ) ) = sum;
455  }
456  }
457  }
458 }
459 
460 // ===================================================
461 // Private Methods
462 // ===================================================
463 
464 template <typename MeshType>
465 void DOFInterface3Dto3D::updateFacetConnections ( const MeshType& mesh1, const markerID_Type& flag1,
466  const MeshType& mesh2, const markerID_Type& flag2, const Real& tol, const fct& coupled )
467 {
468 
469  UInt bdnF1 = mesh1.numBoundaryFacets(); // Number of boundary facets in mesh1
470  UInt bdnF2 = mesh2.numBoundaryFacets(); // Number of boundary facets mesh2
471 
472  markerID_Type marker1;
473  std::set<ID> facetsFlagged2;
474 
475 
476  typedef typename MeshType::facetShape_Type GeoBShape; // Shape of the facets
477 
478  UInt nbVertexPerFacet = GeoBShape::S_numVertices; // Number of facet's vertices
479 
480  std::vector<Real> v1 (nDimensions), v2 ( nDimensions );
481  std::vector< std::vector<Real> > vertexVector (nbVertexPerFacet);
482 
483  LifeChrono chrono;
484  chrono.start();
485 
486  // select facets flagged with flag 2
487  for ( ID ibF2 = 0; ibF2 < bdnF2; ++ibF2 )
488  if ( flag2 == mesh2.boundaryFacet ( ibF2 ).markerID() )
489  {
490  facetsFlagged2.insert (ibF2);
491  }
492 
493  // Loop on boundary facets on mesh1
494  for ( ID ibF1 = 0; ibF1 < bdnF1; ++ibF1 )
495  {
496 
497  // The facet marker
498  marker1 = mesh1.boundaryFacet ( ibF1 ).markerID();
499 
500  // Is the facet on the interface?
501  if ( marker1 == flag1 )
502  {
503 
504  // Loop on facet vertices
505  for ( ID iVeFa = 0; iVeFa < nbVertexPerFacet; ++iVeFa )
506  {
507 
508  // Loop on vertex coordinates
509  for ( ID j = 0; j < nDimensions; ++j )
510  {
511  v1[ j ] = mesh1.boundaryFacet ( ibF1 ).point ( iVeFa ).coordinate ( j );
512  }
513  vertexVector[iVeFa] = v1;
514  }
515  // Loop on boundary facets on mesh2
516  std::set<ID>::iterator it = facetsFlagged2.begin();
517  for (; it != facetsFlagged2.end(); ++it )
518  {
519  ID ibF2 = *it;
520 
521  // Loop on facet vertices
522  bool matched;
523  ID iVeFa = 0;
524  do
525  {
526  // Loop on vertex coordinates
527  for ( ID j = 0; j < nDimensions; ++j )
528  {
529  v2[ j ] = mesh2.boundaryFacet ( ibF2 ).point ( iVeFa ).coordinate ( j );
530  }
531 
532  // Loop on facet vertices on mesh1
533  ID ivefa = 0;
534  do
535  {
536  // Do the vertices match? if yes break the loop
537  matched = coupled ( vertexVector[ivefa], v2, tol );
538  }
539  while ( (++ivefa < nbVertexPerFacet) && !matched );
540  }
541  while ( (++iVeFa < nbVertexPerFacet) && matched);
542  //! Do the facets match?
543  if ( matched )
544  {
545  std::pair<ID, ID> elc ( ibF1, ibF2 );
546  M_facetToFacetConnectionList.push_front ( elc );
547  facetsFlagged2.erase (it);
548  break; // Stop loop on boundary facets on mesh2
549  }
550 
551  }
552  }
553  }
554  chrono.stop();
555 }
556 
557 //! This method builds the connections between DOF at the interface (M_dofToDofConnectionList container)
558 /*!
559  \param mesh1 the mesh in which we want to make the computations
560  \param dof1 the DOF object of the mesh in which we want to make the computations
561  \param mesh2 the mesh which provides the data at the interface
562  \param dof2 the DOF object of the mesh which provides the data at the interface
563  \param tol tolerance for connecting points of both meshes at the interface
564 */
565 template <typename Mesh>
566 void DOFInterface3Dto3D::updateDofConnections ( const Mesh& mesh1, const DOF& dof1,
567  const Mesh& mesh2, const DOF& dof2, const Real& tol, const fct& coupled, Int const* const flag3)
568 {
569  CurrentFEManifold feBd1 ( M_refFE1->boundaryFE(), getGeometricMap ( mesh1 ).boundaryMap() );
570  CurrentFEManifold feBd2 ( M_refFE2->boundaryFE(), getGeometricMap ( mesh2 ).boundaryMap() );
571 
572  std::vector<Real> p1 ( nDimensions ), p2 ( nDimensions );
573 
574  // Loop on facets at the interface (matching facets)
575  for ( Iterator i = M_facetToFacetConnectionList.begin(); i != M_facetToFacetConnectionList.end(); ++i )
576  {
577  // Update the Boundary FESpaces
578  feBd1.update ( mesh1.boundaryFacet ( i->first ), UPDATE_ONLY_CELL_NODES ); // Updating facet information on mesh1
579  feBd2.update ( mesh2.boundaryFacet ( i->second ), UPDATE_ONLY_CELL_NODES ); // Updating facet information on mesh2
580 
581  // Vectors containing the global ID of the local dofs
582  std::vector<ID> localToGlobalMapOnBFacet1 = dof1.localToGlobalMapOnBdFacet (i->first);
583  std::vector<ID> localToGlobalMapOnBFacet2 = dof2.localToGlobalMapOnBdFacet (i->second);
584 
585  // for P2 triangles at the boundary: 6 dofs (rows) and 4 columns (x, y, z, MarkerID)
586  MatrixSmall<6,4> FaceDof;
587  FaceDof *= 0;
588 
589  // Check for P2 FESpaces - this because we need to remove the dofs with flag = flag3
590 
591 
592  // Pre-processing: identifying the marker of the dofs over the face
593  for (ID lDof1 = 0; lDof1 < localToGlobalMapOnBFacet1.size(); lDof1++){
594  // get the x, y, z coordinates of the dof
595  feBd1.coorMap ( FaceDof[lDof1][0], FaceDof[lDof1][1], FaceDof[lDof1][2], feBd1.refFE().xi ( lDof1 ), feBd1.refFE().eta ( lDof1 ) );
596  if ( lDof1 < 3 ){
597  // The first 3 dofs correspond to the vertices of the mesh and we know the marker ID from the mesh
598  FaceDof[lDof1][3] = mesh1.boundaryFacet ( i->first ).point ( lDof1 ).markerID ();
599  }
600  }
601 
602  if ( localToGlobalMapOnBFacet1.size() > 3 ){
603  // a p2 dof that was not in the mesh, so a dof the we inserted, has flag 1439 (random number) or it inherits the flag of the edge
604  FaceDof[3][3] = ( FaceDof[0][3] == FaceDof[1][3] ) ? FaceDof[0][3] : 1439;
605  FaceDof[4][3] = ( FaceDof[1][3] == FaceDof[2][3] ) ? FaceDof[1][3] : 1439;
606  FaceDof[5][3] = ( FaceDof[0][3] == FaceDof[2][3] ) ? FaceDof[0][3] : 1439;
607  }
608 
609  for (ID lDof1 = 0; lDof1 < localToGlobalMapOnBFacet1.size(); lDof1++)
610  {
611  // Get the global ID of the dof with local index lDof1
612  ID gDof1 = localToGlobalMapOnBFacet1[lDof1];
613 
614  p1[0] = FaceDof[lDof1][0];
615  p1[1] = FaceDof[lDof1][1];
616  p1[2] = FaceDof[lDof1][2];
617 
618  if ( flag3 != 0 && static_cast < Int > (FaceDof[lDof1][3]) == *flag3 )
619  {
620  continue;
621  }
622 
623  for (ID lDof2 = 0; lDof2 < localToGlobalMapOnBFacet2.size(); lDof2++)
624  {
625  ID gDof2 = localToGlobalMapOnBFacet2[lDof2];
626  feBd2.coorMap ( p2[0], p2[1], p2[2], feBd2.refFE().xi ( lDof2 ), feBd2.refFE().eta ( lDof2 ) );
627 
628  if ( coupled ( p1, p2, tol ) )
629  {
630  std::pair<ID, ID> locDof ( gDof1, gDof2 );
631  M_dofToDofConnectionList.push_front ( locDof ); // Updating the list of dof connections
632  break;
633  }
634  }
635 
636  }
637  }
638 
639  // Updating the map containter with the connections
640  for ( Iterator i = M_dofToDofConnectionList.begin(); i != M_dofToDofConnectionList.end(); ++i )
641  {
642  M_localDofMap[ i->first ] = i->second;
643  }
644 
645  // Saving memory
646  M_dofToDofConnectionList.clear();
647 }
648 
649 
650 }
651 #endif
const ReferenceFE & boundaryFE() const
Getter for the boundary finite element.
void assignFunction(bcBase_Type &base)
Assign the function to the base of the BCHandler.
A class for a finite element on a manifold.
int32_type Int
Generic integer data.
Definition: LifeV.hpp:188
ID markerID_Type
markerID_Type is the type used to store the geometric entity marker IDs
Definition: Marker.hpp:81
uint32_type ID
IDs.
Definition: LifeV.hpp:194
double Real
Generic real data.
Definition: LifeV.hpp:175
The class for a reference Lagrangian finite element.
const UInt nDimensions(NDIM)
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191