Reference documentation for deal.II version 8.5.1
grid_in.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2017 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii__grid_in_h
17 #define dealii__grid_in_h
18 
19 
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/exceptions.h>
22 #include <deal.II/base/smartpointer.h>
23 #include <deal.II/base/point.h>
24 #include <iostream>
25 #include <vector>
26 #include <string>
27 
28 DEAL_II_NAMESPACE_OPEN
29 
30 template <int dim, int space_dim> class Triangulation;
31 template <int dim> struct CellData;
32 
299 template <int dim, int spacedim=dim>
300 class GridIn
301 {
302 public:
307  enum Format
308  {
329  };
330 
334  GridIn ();
335 
340 
345  void read (std::istream &in, Format format=Default);
346 
352  void read (const std::string &in, Format format=Default);
353 
359  void read_vtk(std::istream &in);
360 
368  void read_unv(std::istream &in);
369 
378  void read_ucd (std::istream &in,
379  const bool apply_all_indicators_to_manifolds=false);
380 
420  void read_abaqus (std::istream &in,
421  const bool apply_all_indicators_to_manifolds=false);
422 
426  void read_dbmesh (std::istream &in);
427 
431  void read_xda (std::istream &in);
432 
442  void read_msh (std::istream &in);
443 
450  void read_netcdf (const std::string &filename);
451 
456  void read_tecplot (std::istream &in);
457 
461  static std::string default_suffix (const Format format);
462 
466  static Format parse_format (const std::string &format_name);
467 
473  static std::string get_format_names ();
474 
479  int,
480  << "The section type <" << arg1 << "> in an UNV "
481  << "input file is not implemented.");
482 
487  int,
488  << "The element type <" << arg1 << "> in an UNV "
489  << "input file is not implemented.");
490 
495  std::string,
496  << "The identifier <" << arg1 << "> as name of a "
497  << "part in an UCD input file is unknown or the "
498  << "respective input routine is not implemented."
499  << "(Maybe the space dimension of triangulation and "
500  << "input file do not match?");
509  int, int,
510  << "While creating cell " << arg1
511  << ", you are referencing a vertex with index " << arg2
512  << " but no vertex with this index has been described in the input file.");
517  int, int, int,
518  << "While creating cell " << arg1
519  << " (which is numbered as " << arg2
520  << " in the input file), you are referencing a vertex with index " << arg3
521  << " but no vertex with this index has been described in the input file.");
530  std::string,
531  << "The string <" << arg1 << "> is not recognized at the present"
532  << " position of a DB Mesh file.");
533 
538  int,
539  << "The specified dimension " << arg1
540  << " is not the same as that of the triangulation to be created.");
541 
543  std::string,
544  << "The string <" << arg1 << "> is not recognized at the present"
545  << " position of a Gmsh Mesh file.");
546 
548  int,
549  << "The Element Identifier <" << arg1 << "> is not "
550  << "supported in the deal.II library when "
551  << "reading meshes in " << dim << " dimensions.\n"
552  << "Supported elements are: \n"
553  << "ELM-TYPE\n"
554  << "1 Line (2 nodes, 1 edge).\n"
555  << "3 Quadrilateral (4 nodes, 4 edges).\n"
556  << "5 Hexahedron (8 nodes, 12 edges, 6 faces) when in 3d.\n"
557  << "15 Point (1 node, ignored when read)");
558 
559 
561 protected:
566 
587  static void debug_output_grid (const std::vector<CellData<dim> > &cells,
588  const std::vector<Point<spacedim> > &vertices,
589  std::ostream &out);
590 
591 private:
592 
597  static void skip_empty_lines (std::istream &in);
598 
606  static void skip_comment_lines (std::istream &in,
607  const char comment_start);
608 
616  static void parse_tecplot_header(std::string &header,
617  std::vector<unsigned int> &tecplot2deal,
618  unsigned int &n_vars,
619  unsigned int &n_vertices,
620  unsigned int &n_cells,
621  std::vector<unsigned int> &IJK,
622  bool &structured,
623  bool &blocked);
624 
629 };
630 
631 /* -------------- declaration of explicit specializations ------------- */
632 
633 #ifndef DOXYGEN
634 
635 template <>
636 void
637 GridIn<2>::debug_output_grid (const std::vector<CellData<2> > &cells,
638  const std::vector<Point<2> > &vertices,
639  std::ostream &out);
640 
641 
642 template <>
643 void
644 GridIn<2,3>::debug_output_grid (const std::vector<CellData<2> > &cells,
645  const std::vector<Point<3> > &vertices,
646  std::ostream &out);
647 template <>
648 void
649 GridIn<3>::debug_output_grid (const std::vector<CellData<3> > &cells,
650  const std::vector<Point<3> > &vertices,
651  std::ostream &out);
652 
653 #endif // DOXYGEN
654 
655 DEAL_II_NAMESPACE_CLOSE
656 
657 #endif
static std::string get_format_names()
Definition: grid_in.cc:2925
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:576
Use read_abaqus()
Definition: grid_in.h:316
Format
Definition: grid_in.h:307
Use read_vtk()
Definition: grid_in.h:328
static ::ExceptionBase & ExcUnknownElementType(int arg1)
SmartPointer< Triangulation< dim, spacedim >, GridIn< dim, spacedim > > tria
Definition: grid_in.h:565
Use read_unv()
Definition: grid_in.h:312
Use read_xda()
Definition: grid_in.h:320
static Format parse_format(const std::string &format_name)
Definition: grid_in.cc:2869
static void skip_empty_lines(std::istream &in)
Definition: grid_in.cc:2542
void read_vtk(std::istream &in)
Definition: grid_in.cc:98
static ::ExceptionBase & ExcDBMESHWrongDimension(int arg1)
Use read_ucd()
Definition: grid_in.h:314
void read_dbmesh(std::istream &in)
Definition: grid_in.cc:900
void read_tecplot(std::istream &in)
Definition: grid_in.cc:2535
static void parse_tecplot_header(std::string &header, std::vector< unsigned int > &tecplot2deal, unsigned int &n_vars, unsigned int &n_vertices, unsigned int &n_cells, std::vector< unsigned int > &IJK, bool &structured, bool &blocked)
Definition: grid_in.cc:2103
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:564
static ::ExceptionBase & ExcInvalidVertexIndexGmsh(int arg1, int arg2, int arg3)
Use read_msh()
Definition: grid_in.h:322
static void skip_comment_lines(std::istream &in, const char comment_start)
Definition: grid_in.cc:2571
#define DeclException0(Exception0)
Definition: exceptions.h:541
void read_ucd(std::istream &in, const bool apply_all_indicators_to_manifolds=false)
Definition: grid_in.cc:621
static ::ExceptionBase & ExcInvalidDBMESHInput(std::string arg1)
GridIn()
Definition: grid_in.cc:84
Use read_tecplot()
Definition: grid_in.h:326
static ::ExceptionBase & ExcUnknownIdentifier(std::string arg1)
void read_xda(std::istream &in)
Definition: grid_in.cc:1066
void read_msh(std::istream &in)
Definition: grid_in.cc:1224
Use read_dbmesh()
Definition: grid_in.h:318
void read_netcdf(const std::string &filename)
static std::string default_suffix(const Format format)
Definition: grid_in.cc:2837
void read_unv(std::istream &in)
Definition: grid_in.cc:385
void read(std::istream &in, Format format=Default)
Definition: grid_in.cc:2781
static ::ExceptionBase & ExcNoTriangulationSelected()
static ::ExceptionBase & ExcInvalidDBMeshFormat()
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:588
Use GridIn::default_format stored in this object.
Definition: grid_in.h:310
void read_abaqus(std::istream &in, const bool apply_all_indicators_to_manifolds=false)
Definition: grid_in.cc:855
static void debug_output_grid(const std::vector< CellData< dim > > &cells, const std::vector< Point< spacedim > > &vertices, std::ostream &out)
Definition: grid_in.cc:2595
static ::ExceptionBase & ExcInvalidGMSHInput(std::string arg1)
static ::ExceptionBase & ExcGmshUnsupportedGeometry(int arg1)
static ::ExceptionBase & ExcUnknownSectionType(int arg1)
void attach_triangulation(Triangulation< dim, spacedim > &tria)
Definition: grid_in.cc:90
Use read_netcdf()
Definition: grid_in.h:324
static ::ExceptionBase & ExcInvalidVertexIndex(int arg1, int arg2)
Format default_format
Definition: grid_in.h:628
static ::ExceptionBase & ExcGmshNoCellInformation()