quad_from_triangle_mesh.template.h
Go to the documentation of this file.
1 //LIC// ====================================================================
2 //LIC// This file forms part of oomph-lib, the object-oriented,
3 //LIC// multi-physics finite-element library, available
4 //LIC// at http://www.oomph-lib.org.
5 //LIC//
6 //LIC// Version 0.90. August 3, 2009.
7 //LIC//
8 //LIC// Copyright (C) 2006-2009 Matthias Heil and Andrew Hazel
9 //LIC//
10 //LIC// This library is free software; you can redistribute it and/or
11 //LIC// modify it under the terms of the GNU Lesser General Public
12 //LIC// License as published by the Free Software Foundation; either
13 //LIC// version 2.1 of the License, or (at your option) any later version.
14 //LIC//
15 //LIC// This library is distributed in the hope that it will be useful,
16 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
17 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 //LIC// Lesser General Public License for more details.
19 //LIC//
20 //LIC// You should have received a copy of the GNU Lesser General Public
21 //LIC// License along with this library; if not, write to the Free Software
22 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 //LIC// 02110-1301 USA.
24 //LIC//
25 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
26 //LIC//
27 //LIC//====================================================================
28 //Driver for 2D moving block
29 #ifndef OOMPH_QUAD_FROM_TRIANGLE_MESH_TEMPLATE_HEADER
30 #define OOMPH_QUAD_FROM_TRIANGLE_MESH_TEMPLATE_HEADER
31 
32 
33 #ifdef OOMPH_HAS_MPI
34 // MPI header
35 #include "mpi.h"
36 #endif
37 
38 // Standards
39 #include <float.h>
40 #include <iostream>
41 #include <fstream>
42 #include <string.h>
43 #include <iomanip>
44 
45 // The mesh
46 #include "../generic/problem.h"
47 #include "../generic/quad_mesh.h"
48 #include "triangle_mesh.template.h"
49 #include "../generic/triangle_scaffold_mesh.h"
50 #include "../generic/unstructured_two_d_mesh_geometry_base.h"
51 #include "../generic/refineable_quad_mesh.h"
52 #include "../generic/Qelements.h"
53 
54 using namespace std;
55 using namespace oomph;
56 
57 
58 ////////////////////////////////////////////////////////////////////
59 ////////////////////////////////////////////////////////////////////
60 ////////////////////////////////////////////////////////////////////
61 
62 
63 namespace oomph
64 {
65 
66 //============start_of_quad_triangle_class==============================
67 /// Quad mesh built on top of triangle scaffold mesh coming
68 /// from the triangle mesh generator Triangle.
69 /// http://www.cs.cmu.edu/~quake/triangle.html
70 //======================================================================
71  template <class ELEMENT>
73  public virtual QuadMeshBase
74  {
75 
76  public:
77 
78  /// \short Empty constructor
80  {
81 #ifdef OOMPH_HAS_TRIANGLE_LIB
82  // By default allow the automatic creation of vertices along the
83  // boundaries by Triangle
84  this->Allow_automatic_creation_of_vertices_on_boundaries=true;
85 #endif
86 
87  // Mesh can only be built with 2D Qelements.
88  MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
89  }
90 
91  /// \short Constructor with the input files
92  QuadFromTriangleMesh(const std::string& node_file_name,
93  const std::string& element_file_name,
94  const std::string& poly_file_name,
95  TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper,
96  const bool &use_attributes=false,
97  const bool&
98  allow_automatic_creation_of_vertices_on_boundaries=true)
99  {
100  // Mesh can only be built with 2D Qelements.
101  MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
102 
103  // Initialize the value for allowing creation of points on boundaries
104  this->Allow_automatic_creation_of_vertices_on_boundaries=
105  allow_automatic_creation_of_vertices_on_boundaries;
106 
107  // Store Timestepper used to build elements
108  this->Time_stepper_pt=time_stepper_pt;
109 
110  // Store the attributes
111  this->Use_attributes=use_attributes;
112 
113  // Build scaffold
114  TriangleScaffoldMesh* tmp_mesh_pt=new TriangleScaffoldMesh(node_file_name,
115  element_file_name,
116  poly_file_name);
117 
118  // Convert mesh from scaffold to actual mesh
119  this->build_from_scaffold(tmp_mesh_pt,time_stepper_pt,use_attributes);
120 
121  // Kill the scaffold
122  delete tmp_mesh_pt;
123  tmp_mesh_pt=0;
124 
125  // Setup boundary coordinates for boundaries
126  unsigned nbound=nboundary();
127  for (unsigned ibound=0;ibound<nbound;ibound++)
128  {
129  this->template setup_boundary_coordinates<ELEMENT>(ibound);
130  }
131  }
132 
133 #ifdef OOMPH_HAS_TRIANGLE_LIB
134 
135  /// \short Build mesh, based on the specifications on
136  /// TriangleMeshParameters. All the actual work is done
137  /// in UnstructuredTwoDMeshGeometryBase
138  QuadFromTriangleMesh(TriangleMeshParameters& triangle_mesh_parameters,
139  TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper)
140  {
141  // Mesh can only be built with 2D Qelements.
142  MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
143 
144  // Initialize the value for allowing creation of points on boundaries
145  this->Allow_automatic_creation_of_vertices_on_boundaries=
147 
148  // Store Timestepper used to build elements
149  this->Time_stepper_pt=time_stepper_pt;
150 
151  // ********************************************************************
152  // First part - Get polylines representations
153  // ********************************************************************
154 
155  // Create the polyline representation of all the boundaries and
156  // then create the mesh by calling to "generic_constructor()"
157 
158  // Initialise highest boundary id
159  unsigned max_boundary_id = 0;
160 
161  // *****************************************************************
162  // Part 1.1 - Outer boundary
163  // *****************************************************************
164  // Get the representation of the outer boundaries from the
165  // TriangleMeshParameters object
166  Vector<TriangleMeshClosedCurve* > outer_boundary_pt=
167  triangle_mesh_parameters.outer_boundary_pt();
168 
169 #ifdef PARANOID
170 
171  // Verify that the outer_boundary_object_pt has been set
172  if (outer_boundary_pt.size()==0)
173  {
174  std::stringstream error_message;
175  error_message
176  << "There are no outer boundaries defined.\n"
177  << "Verify that you have specified the outer boundaries in the\n"
178  << "Triangle_mesh_parameter object\n\n";
179  throw OomphLibError(error_message.str(),
180  OOMPH_CURRENT_FUNCTION,
181  OOMPH_EXCEPTION_LOCATION);
182  } // if (outer_boundary_pt!=0)
183 
184 #endif
185 
186  // Find the number of outer closed curves
187  unsigned n_outer_boundaries=outer_boundary_pt.size();
188 
189  // Create the storage for the polygons that define the outer boundaries
190  Vector<TriangleMeshPolygon*> outer_boundary_polygon_pt(n_outer_boundaries);
191 
192  // Loop over the number of outer boundaries
193  for(unsigned i=0;i<n_outer_boundaries;++i)
194  {
195  // Get the polygon representation and compute the max boundary_id on
196  // each outer polygon. Does nothing (i.e. just returns a pointer to
197  // the outer boundary that was input) if the outer boundary is
198  // already a polygon
199  outer_boundary_polygon_pt[i]=
200  this->closed_curve_to_polygon_helper(outer_boundary_pt[i],max_boundary_id);
201  }
202 
203  // *****************************************************************
204  // Part 1.2 - Internal closed boundaries (possible holes)
205  // *****************************************************************
206  // Get the representation of the internal closed boundaries from the
207  // TriangleMeshParameters object
208  Vector<TriangleMeshClosedCurve* > internal_closed_curve_pt=
209  triangle_mesh_parameters.internal_closed_curve_pt();
210 
211  // Find the number of internal closed curves
212  unsigned n_internal_closed_curves=internal_closed_curve_pt.size();
213 
214  // Create the storage for the polygons that define the internal closed
215  // boundaries (again nothing happens (as above) if an internal closed
216  // curve is already a polygon)
217  Vector<TriangleMeshPolygon*> internal_polygon_pt(n_internal_closed_curves);
218 
219  // Loop over the number of internal closed curves
220  for(unsigned i=0;i<n_internal_closed_curves;++i)
221  {
222  // Get the polygon representation and compute the max boundary_id on
223  // each internal polygon
224  internal_polygon_pt[i]=this->closed_curve_to_polygon_helper(
225  internal_closed_curve_pt[i],max_boundary_id);
226  }
227 
228  // *****************************************************************
229  // Part 1.3 - Internal open boundaries
230  // *****************************************************************
231  // Get the representation of open boundaries from the
232  // TriangleMeshParameteres object
233  Vector<TriangleMeshOpenCurve*> internal_open_curve_pt=
234  triangle_mesh_parameters.internal_open_curves_pt();
235 
236  //Find the number of internal open curves
237  unsigned n_internal_open_curves=internal_open_curve_pt.size();
238 
239  // Create the storage for the polylines that define the open boundaries
240  Vector<TriangleMeshOpenCurve*> internal_open_curve_poly_pt(
241  n_internal_open_curves);
242 
243  // Loop over the number of internal open curves
244  for (unsigned i=0;i<n_internal_open_curves;i++)
245  {
246  // Get the open polyline representation and compute the max boundary_id
247  // on each open polyline (again, nothing happens if there are curve
248  // sections on the current internal open curve)
249  internal_open_curve_poly_pt[i]=this->create_open_curve_with_polyline_helper(
250  internal_open_curve_pt[i],max_boundary_id);
251  }
252 
253  // ********************************************************************
254  // Second part - Get associated geom objects and coordinate limits
255  // ********************************************************************
256 
257  // ***************************************************************
258  // Part 2.1 Outer boundary
259  // ***************************************************************
260  for (unsigned i=0;i<n_outer_boundaries;i++)
261  {
262  this->set_geom_objects_and_coordinate_limits_for_close_curve(
263  outer_boundary_pt[i]);
264  }
265 
266  // ***************************************************************
267  // Part 2.2 - Internal closed boundaries (possible holes)
268  // ***************************************************************
269  for (unsigned i=0;i<n_internal_closed_curves;i++)
270  {
271  this->set_geom_objects_and_coordinate_limits_for_close_curve(
272  internal_closed_curve_pt[i]);
273  }
274 
275  // ********************************************************************
276  // Part 2.3 - Internal open boundaries
277  // ********************************************************************
278  for (unsigned i=0;i<n_internal_open_curves;i++)
279  {
280  this->set_geom_objects_and_coordinate_limits_for_open_curve(
281  internal_open_curve_pt[i]);
282  }
283 
284  // ********************************************************************
285  // Third part - Creates the TriangulateIO object by calling the
286  // "generic_constructor()" function
287  // ********************************************************************
288  // Get all the other parameters from the TriangleMeshParameters object
289  // The maximum element area
290  const double element_area=triangle_mesh_parameters.element_area();
291 
292  // The holes coordinates
293  Vector<Vector<double> > extra_holes_coordinates=
294  triangle_mesh_parameters.extra_holes_coordinates();
295 
296  // The regions coordinates
297  std::map<unsigned,Vector<double> > regions=
298  triangle_mesh_parameters.regions_coordinates();
299 
300  // If we use regions then we use attributes
301  const bool use_attributes=triangle_mesh_parameters.is_use_attributes();
302 
303  const bool refine_boundary=
304  triangle_mesh_parameters.is_boundary_refinement_allowed();
305 
306  const bool refine_internal_boundary=
307  triangle_mesh_parameters.is_internal_boundary_refinement_allowed();
308 
309  if(!refine_internal_boundary && refine_boundary)
310  {
311  std::ostringstream error_stream;
312  error_stream
313  << "You have specified that Triangle may refine the outer boundary, but\n"
314  << "not internal boundaries. Triangle does not support this combination.\n"
315  << "If you do not want Triangle to refine internal boundaries, it can't\n"
316  << "refine outer boundaries either!\n"
317  << "Please either disable all boundary refinement\n"
318  << "(call TriangleMeshParameters::disable_boundary_refinement()\n"
319  << "or enable internal boundary refinement (the default)\n";
320 
321  throw OomphLibError(error_stream.str().c_str(),
322  OOMPH_CURRENT_FUNCTION,
323  OOMPH_EXCEPTION_LOCATION);
324  }
325 
326  this->generic_constructor(outer_boundary_polygon_pt,
327  internal_polygon_pt,
328  internal_open_curve_poly_pt,
329  element_area,
330  extra_holes_coordinates,
331  regions,
332  triangle_mesh_parameters.target_area_for_region(),
333  time_stepper_pt,
334  use_attributes,
335  refine_boundary,
336  refine_internal_boundary);
337 
338 #ifdef OOMPH_HAS_MPI
339 
340  // Before calling setup boundary coordinates check if the mesh is
341  // marked as distrbuted
342  if (triangle_mesh_parameters.is_mesh_distributed())
343  {
344  // Set the mesh as distributed by passing the communicator
345  this->set_communicator_pt(triangle_mesh_parameters.communicator_pt());
346  }
347 
348 #endif
349 
350  // Setup boundary coordinates for boundaries
351  unsigned nb=nboundary();
352  for (unsigned b=0;b<nb;b++)
353  {
354  this->template setup_boundary_coordinates<ELEMENT>(b);
355  }
356 
357  // Snap it!
358  this->snap_nodes_onto_geometric_objects();
359  }
360 
361  /// \short A general-purpose construction function that builds the
362  /// mesh once the different specific constructors have assembled the
363  /// appropriate information.
365  Vector<TriangleMeshPolygon*>& internal_polygon_pt,
366  Vector<TriangleMeshOpenCurve*>& open_polylines_pt,
367  const double &element_area,
368  Vector<Vector<double> >& extra_holes_coordinates,
369  std::map<unsigned,Vector<double> >& regions_coordinates,
370  std::map<unsigned,double >& regions_areas,
371  TimeStepper* time_stepper_pt,
372  const bool &use_attributes,
373  const bool &refine_boundary,
374  const bool &refine_internal_boundary)
375  {
376 #ifdef PARANOID
377 
378  if (element_area<10e-14)
379  {
380  std::ostringstream warning_message;
381  warning_message
382  << "The current elements area was stated to (" << element_area
383  << ").\nThe current precision to generate the input to triangle "
384  << "is fixed to 14 digits\n\n";
385  OomphLibWarning(warning_message.str(),
386  OOMPH_CURRENT_FUNCTION,
387  OOMPH_EXCEPTION_LOCATION);
388  }
389 
390 #endif
391 
392  // Store the attribute flag
393  this->Use_attributes=use_attributes;
394 
395  // Store the timestepper used to build elements
396  this->Time_stepper_pt=time_stepper_pt;
397 
398  // Store outer polygon
399  this->Outer_boundary_pt=outer_boundary_pt;
400 
401  // Store internal polygons by copy constructor
402  this->Internal_polygon_pt=internal_polygon_pt;
403 
404  // Store internal polylines by copy constructor
405  this->Internal_open_curve_pt=open_polylines_pt;
406 
407  // Store the extra holes coordinates
408  this->Extra_holes_coordinates=extra_holes_coordinates;
409 
410  // Store the extra regions coordinates
411  this->Regions_coordinates=regions_coordinates;
412 
413  // Create the data structures required to call the triangulate function
414  TriangulateIO triangulate_io;
415  TriangulateIO triangulate_out;
416 
417  // Initialize TriangulateIO structure
419 
420  // Convert TriangleMeshPolyLine and TriangleMeshClosedCurvePolyLine
421  // to a triangulateio object
422  UnstructuredTwoDMeshGeometryBase::build_triangulateio(outer_boundary_pt,
423  internal_polygon_pt,
424  open_polylines_pt,
425  extra_holes_coordinates,
426  regions_coordinates,
427  regions_areas,
428  triangulate_io);
429 
430  // Initialize TriangulateIO structure
432 
433  // Input string for triangle
434  std::stringstream input_string_stream;
435  input_string_stream.precision(14);
436  input_string_stream.setf(std::ios_base::fixed,
437  std::ios_base::floatfield);
438 
439  // MH: Used to be:
440  // input_string_stream<<"-pA -a" << element_area << " -q30" << std::fixed;
441  // The repeated -a allows the specification of areas for different
442  // regions (if any)
443  input_string_stream <<"-pA -a -a" << element_area << " -q30" << std::fixed;
444 
445  // Verify if creation of new points on boundaries is allowed
446  if (!this->is_automatic_creation_of_vertices_on_boundaries_allowed())
447  {
448  input_string_stream << " -YY";
449  }
450 
451  // Suppress insertion of additional points on outer boundary
452  if(refine_boundary==false)
453  {
454  input_string_stream << "-Y";
455 
456  // Add the extra flag to suppress additional points on interior segments
457  if(refine_internal_boundary==false)
458  {
459  input_string_stream << "Y";
460  }
461  }
462 
463  // Convert the Input string in *char required by the triangulate function
464  char triswitches[100];
465  sprintf(triswitches,"%s",input_string_stream.str().c_str());
466 
467  // Build the mesh using triangulate function
468  triangulate(triswitches,&triangulate_io,&triangulate_out,0);
469 
470  // Build scaffold
471  TriangleScaffoldMesh* tmp_mesh_pt=new TriangleScaffoldMesh(triangulate_out);
472 
473  // If we have filled holes then we must use the attributes
474  if(!regions_coordinates.empty())
475  {
476  // Convert mesh from scaffold to actual mesh
477  build_from_scaffold(tmp_mesh_pt,time_stepper_pt,true);
478 
479  // Record the attribute flag
480  this->Use_attributes=true;
481  }
482  // Otherwise use what was asked
483  else
484  {
485  // Convert mesh from scaffold to actual mesh
486  build_from_scaffold(tmp_mesh_pt,time_stepper_pt,use_attributes);
487  }
488 
489  // Kill the scaffold
490  delete tmp_mesh_pt;
491  tmp_mesh_pt=0;
492 
493  // Cleanup but leave hole and regions alone since it's still used
494  bool clear_hole_data=false;
495  TriangleHelper::clear_triangulateio(triangulate_io,clear_hole_data);
496  TriangleHelper::clear_triangulateio(triangulate_out,clear_hole_data);
497  }
498 
499 #endif // OOMPH_HAS_TRIANGLE_LIB
500 
501  /// Broken copy constructor
503  {
504  BrokenCopy::broken_copy("QuadFromTriangleMesh");
505  }
506 
507  /// Broken assignment operator
509  {
510  BrokenCopy::broken_assign("QuadFromTriangleMesh");
511  }
512 
513 
514  /// Empty destructor
516  {
517 #ifdef OOMPH_HAS_TRIANGLE_LIB
518 
519  std::set<TriangleMeshCurveSection*>::iterator it_polyline;
520  for (it_polyline = Free_curve_section_pt.begin();
521  it_polyline != Free_curve_section_pt.end();
522  it_polyline++)
523  {
524  delete (*it_polyline);
525  }
526 
527  std::set<TriangleMeshPolygon*>::iterator it_polygon;
528  for (it_polygon = Free_polygon_pt.begin();
529  it_polygon != Free_polygon_pt.end();
530  it_polygon++)
531  {
532  delete (*it_polygon);
533  }
534 
535  std::set<TriangleMeshOpenCurve*>::iterator it_open_polyline;
536  for (it_open_polyline = Free_open_curve_pt.begin();
537  it_open_polyline != Free_open_curve_pt.end();
538  it_open_polyline++)
539  {
540  delete (*it_open_polyline);
541  }
542 
543 #endif
544  }
545 
546  /// Build the quad mesh from the given scaffold mesh
547  void build_from_scaffold(TriangleScaffoldMesh* tmp_mesh_pt,
548  TimeStepper* time_stepper_pt,
549  const bool &use_attributes);
550 
551  /// Timestepper used to build elements
553 
554  /// Boolean flag to indicate whether to use attributes or not (required
555  /// for multidomain meshes)
557 
558  };
559 
560 
561 
562  ////////////////////////////////////////////////////////////////////
563  ////////////////////////////////////////////////////////////////////
564  ////////////////////////////////////////////////////////////////////
565 
566 
567 //=========================================================================
568 /// Unstructured refineable QuadFromTriangleMesh
569 //=========================================================================
570  template<class ELEMENT>
572  public virtual QuadFromTriangleMesh<ELEMENT>,
573  public virtual RefineableQuadMesh<ELEMENT>
574  {
575 
576  public:
577 
578 #ifdef OOMPH_HAS_TRIANGLE_LIB
579 
580  /// \short Build mesh, based on the specifications on
581  /// TriangleMeshParameters
583  triangle_mesh_parameters,
584  TimeStepper* time_stepper_pt=
585  &Mesh::Default_TimeStepper)
586  : QuadFromTriangleMesh<ELEMENT>(triangle_mesh_parameters,time_stepper_pt)
587  {
588  this->setup_quadtree_forest();
589  }
590 
591 #endif
592 
593  /// Refine mesh uniformly
594  virtual void refine_uniformly()
595  {
596  DocInfo doc_info;
597  doc_info.directory()="";
598  doc_info.disable_doc();
599  refine_uniformly(doc_info);
600  }
601 
602  /// Refine mesh uniformly and doc process
603  void refine_uniformly(DocInfo& doc_info)
604  {
605  // Find the number of elements in the mesh
606  unsigned nelem=this->nelement();
607 
608  // Set the element error to something big
609  Vector<double> elem_error(nelem,DBL_MAX);
610 
611  // Refine everything
612  adapt(elem_error);
613  }
614 
615  /// Overload the adapt function (to ensure nodes are snapped to the boundary)
616  void adapt(const Vector<double>& elem_error);
617 
618  /// \short Build mesh, based on the polyfiles
620  const std::string& element_file_name,
621  const std::string& poly_file_name,
622  TimeStepper* time_stepper_pt=
623  &Mesh::Default_TimeStepper)
624  : QuadFromTriangleMesh<ELEMENT>(node_file_name,
625  element_file_name,
626  poly_file_name,
627  time_stepper_pt)
628  {
629  this->setup_quadtree_forest();
630  }
631 
632  /// Empty Destructor
634 
635 
636  };
637 
638 
639  ////////////////////////////////////////////////////////////////////
640  ////////////////////////////////////////////////////////////////////
641  ////////////////////////////////////////////////////////////////////
642 
643 
644 //=========================================================================
645 /// Unstructured QuadFromTriangleMesh upgraded to solid mesh
646 //=========================================================================
647  template<class ELEMENT>
649  public virtual SolidMesh
650  {
651 
652  public:
653 
654  SolidQuadFromTriangleMesh(const std::string& node_file_name,
655  const std::string& element_file_name,
656  const std::string& poly_file_name,
657  TimeStepper* time_stepper_pt=
658  &Mesh::Default_TimeStepper,
659  const bool &use_attributes=false) :
660  QuadFromTriangleMesh<ELEMENT>(node_file_name,
661  element_file_name,
662  poly_file_name,
663  time_stepper_pt,
664  use_attributes)
665  {
666  // Assign the Lagrangian coordinates
667  set_lagrangian_nodal_coordinates();
668  }
669 
670 #ifdef OOMPH_HAS_TRIANGLE_LIB
671 
672  /// \short Build mesh, based on closed curve that specifies
673  /// the outer boundary of the domain and any number of internal
674  /// clsed curves. Specify target area for uniform element size.
676  TriangleMeshParameters& triangle_mesh_parameters,
677  TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper)
678  : QuadFromTriangleMesh<ELEMENT>(triangle_mesh_parameters,time_stepper_pt)
679  {
680  // Assign the Lagrangian coordinates
681  set_lagrangian_nodal_coordinates();
682  }
683 
684 #endif
685 
686  /// Empty Destructor
688  };
689 
690 
691 
692 ////////////////////////////////////////////////////////////////////////
693 ////////////////////////////////////////////////////////////////////////
694 ////////////////////////////////////////////////////////////////////////
695 
696 
697 //=========================================================================
698 /// Unstructured refineable QuadFromTriangleMesh upgraded to solid mesh
699 //=========================================================================
700  template<class ELEMENT>
703  public virtual SolidMesh
704  {
705 
706  public:
707 
708  /// \short Build mesh from specified triangulation and associated
709  /// target areas for elements in it.
711  const std::string& element_file_name,
712  const std::string& poly_file_name,
713  TimeStepper* time_stepper_pt=
714  &Mesh::Default_TimeStepper,
715  const bool &use_attributes=false) :
716  RefineableQuadFromTriangleMesh<ELEMENT>(node_file_name,
717  element_file_name,
718  poly_file_name,
719  time_stepper_pt,
720  use_attributes)
721  {
722  // Assign the Lagrangian coordinates
723  set_lagrangian_nodal_coordinates();
724  }
725 
726 #ifdef OOMPH_HAS_TRIANGLE_LIB
727 
728  /// \short Build mesh, based on the specifications on
729  /// TriangleMeshParameter
731  TriangleMeshParameters &triangle_mesh_parameters,
732  TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper)
733  : QuadFromTriangleMesh<ELEMENT>(triangle_mesh_parameters,time_stepper_pt),
734  RefineableQuadFromTriangleMesh<ELEMENT>(triangle_mesh_parameters,
735  time_stepper_pt)
736  {
737  // Assign the Lagrangian coordinates
738  set_lagrangian_nodal_coordinates();
739  }
740 
741 #endif
742 
743  /// Empty Destructor
745 
746  };
747 
748 
749 }
750 
751 
752 #endif // OOMPH_QUAD_FROM_TRIANGLE_MESH_HEADER
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
Triangle Mesh that is based on input files generated by the triangle mesh generator Triangle...
RefineableSolidQuadFromTriangleMesh(const std::string &node_file_name, const std::string &element_file_name, const std::string &poly_file_name, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false)
Build mesh from specified triangulation and associated target areas for elements in it...
std::map< unsigned, Vector< double > > & regions_coordinates()
Helper function for getting access to the regions coordinates.
SolidQuadFromTriangleMesh(TriangleMeshParameters &triangle_mesh_parameters, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Build mesh, based on closed curve that specifies the outer boundary of the domain and any number of i...
Information for documentation of results: Directory and file number to enable output in the form RESL...
RefineableQuadFromTriangleMesh(TriangleMeshParameters &triangle_mesh_parameters, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Build mesh, based on the specifications on TriangleMeshParameters.
cstr elem_len * i
Definition: cfortran.h:607
TimeStepper * Time_stepper_pt
Timestepper used to build elements.
Helper object for dealing with the parameters used for the TriangleMesh objects.
e
Definition: cfortran.h:575
QuadFromTriangleMesh(TriangleMeshParameters &triangle_mesh_parameters, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Build mesh, based on the specifications on TriangleMeshParameters. All the actual work is done in Uns...
Vector< TriangleMeshClosedCurve * > internal_closed_curve_pt() const
Helper function for getting the internal closed boundaries.
void refine_uniformly(DocInfo &doc_info)
Refine mesh uniformly and doc process.
Vector< TriangleMeshClosedCurve * > outer_boundary_pt() const
Helper function for getting the outer boundary.
void operator=(const QuadFromTriangleMesh &)
Broken assignment operator.
RefineableSolidQuadFromTriangleMesh(TriangleMeshParameters &triangle_mesh_parameters, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Build mesh, based on the specifications on TriangleMeshParameter.
double element_area() const
Helper function for getting the element area.
Vector< Vector< double > > extra_holes_coordinates() const
Helper function for getting the extra holes.
Unstructured refineable QuadFromTriangleMesh upgraded to solid mesh.
void clear_triangulateio(TriangulateIO &triangulate_io, const bool &clear_hole_data)
Clear TriangulateIO structure.
Unstructured refineable QuadFromTriangleMesh.
SolidQuadFromTriangleMesh(const std::string &node_file_name, const std::string &element_file_name, const std::string &poly_file_name, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false)
void generic_constructor(Vector< TriangleMeshPolygon * > &outer_boundary_pt, Vector< TriangleMeshPolygon * > &internal_polygon_pt, Vector< TriangleMeshOpenCurve * > &open_polylines_pt, const double &element_area, Vector< Vector< double > > &extra_holes_coordinates, std::map< unsigned, Vector< double > > &regions_coordinates, std::map< unsigned, double > &regions_areas, TimeStepper *time_stepper_pt, const bool &use_attributes, const bool &refine_boundary, const bool &refine_internal_boundary)
A general-purpose construction function that builds the mesh once the different specific constructors...
QuadFromTriangleMesh(const QuadFromTriangleMesh &dummy)
Broken copy constructor.
QuadFromTriangleMesh(const std::string &node_file_name, const std::string &element_file_name, const std::string &poly_file_name, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false, const bool &allow_automatic_creation_of_vertices_on_boundaries=true)
Constructor with the input files.
void triangulate(char *triswitches, struct oomph::TriangulateIO *in, struct oomph::TriangulateIO *out, struct oomph::TriangulateIO *vorout)
void initialise_triangulateio(TriangulateIO &triangle_io)
Initialise TriangulateIO structure.
bool is_mesh_distributed() const
Boolean to indicate if Mesh has been distributed.
bool is_internal_boundary_refinement_allowed() const
Helper function for getting the status of boundary refinement.
OomphCommunicator * communicator_pt() const
Read-only access fct to communicator (Null if mesh is not distributed)
General SolidMesh class.
Definition: mesh.h:2252
Unstructured QuadFromTriangleMesh upgraded to solid mesh.
void disable_doc()
Disable documentation.
std::string directory() const
Output directory.
Base class for quad meshes (meshes made of 2D quad elements).
Definition: quad_mesh.h:61
std::map< unsigned, double > & target_area_for_region()
Helper function for getting access to the region's target areas.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
virtual ~SolidQuadFromTriangleMesh()
Empty Destructor.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
bool is_boundary_refinement_allowed() const
Helper function for getting the status of boundary refinement.
Vector< TriangleMeshOpenCurve * > internal_open_curves_pt() const
Helper function for getting the internal open boundaries.
RefineableQuadFromTriangleMesh(const std::string &node_file_name, const std::string &element_file_name, const std::string &poly_file_name, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Build mesh, based on the polyfiles.
virtual void refine_uniformly()
Refine mesh uniformly.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
Definition: timesteppers.h:219
bool is_use_attributes() const
Helper function for getting the status of use_attributes variable.