Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
grid_in.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2020 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.md at
12 // the top level directory of deal.II.
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 
23 #include <deal.II/base/point.h>
25 
26 #include <iostream>
27 #include <string>
28 #include <vector>
29 
31 
32 // Forward declarations
33 #ifndef DOXYGEN
34 template <int dim, int space_dim>
35 class Triangulation;
36 template <int dim>
37 struct CellData;
38 #endif
39 
306 template <int dim, int spacedim = dim>
307 class GridIn
308 {
309 public:
314  enum Format
315  {
340  };
341 
345  GridIn();
346 
350  void
352 
357  void
358  read(std::istream &in, Format format = Default);
359 
365  void
366  read(const std::string &in, Format format = Default);
367 
406  void
407  read_vtk(std::istream &in);
408 
425  void
426  read_vtu(std::istream &in);
427 
428 
436  void
437  read_unv(std::istream &in);
438 
448  void
449  read_ucd(std::istream &in,
450  const bool apply_all_indicators_to_manifolds = false);
451 
491  void
492  read_abaqus(std::istream &in,
493  const bool apply_all_indicators_to_manifolds = false);
494 
498  void
499  read_dbmesh(std::istream &in);
500 
504  void
505  read_xda(std::istream &in);
506 
516  void
517  read_msh(std::istream &in);
518 
527  DEAL_II_DEPRECATED void
528  read_netcdf(const std::string &filename);
529 
534  void
535  read_tecplot(std::istream &in);
536 
571  void
572  read_assimp(const std::string &filename,
573  const unsigned int mesh_index = numbers::invalid_unsigned_int,
574  const bool remove_duplicates = true,
575  const double tol = 1e-12,
576  const bool ignore_unsupported_element_types = true);
577 
581  static std::string
582  default_suffix(const Format format);
583 
587  static Format
588  parse_format(const std::string &format_name);
589 
595  static std::string
597 
602  int,
603  << "The section type <" << arg1 << "> in an UNV "
604  << "input file is not implemented.");
605 
610  int,
611  << "The element type <" << arg1 << "> in an UNV "
612  << "input file is not implemented.");
613 
618  std::string,
619  << "The identifier <" << arg1 << "> as name of a "
620  << "part in an UCD input file is unknown or the "
621  << "respective input routine is not implemented."
622  << "(Maybe the space dimension of triangulation and "
623  << "input file do not match?");
633  int,
634  int,
635  << "While creating cell " << arg1
636  << ", you are referencing a vertex with index " << arg2
637  << " but no vertex with this index has been described in the input file.");
643  int,
644  int,
645  int,
646  << "While creating cell " << arg1 << " (which is numbered as " << arg2
647  << " in the input file), you are referencing a vertex with index " << arg3
648  << " but no vertex with this index has been described in the input file.");
657  std::string,
658  << "The string <" << arg1
659  << "> is not recognized at the present"
660  << " position of a DB Mesh file.");
661 
667  int,
668  << "The specified dimension " << arg1
669  << " is not the same as that of the triangulation to be created.");
670 
672  std::string,
673  << "The string <" << arg1
674  << "> is not recognized at the present"
675  << " position of a Gmsh Mesh file.");
676 
678  int,
679  << "The Element Identifier <" << arg1 << "> is not "
680  << "supported in the deal.II library when "
681  << "reading meshes in " << dim << " dimensions.\n"
682  << "Supported elements are: \n"
683  << "ELM-TYPE\n"
684  << "1 Line (2 nodes, 1 edge).\n"
685  << "3 Quadrilateral (4 nodes, 4 edges).\n"
686  << "5 Hexahedron (8 nodes, 12 edges, 6 faces) when in 3d.\n"
687  << "15 Point (1 node, ignored when read)");
688 
689 
691 
692 protected:
697 
718  static void
719  debug_output_grid(const std::vector<CellData<dim>> & cells,
720  const std::vector<Point<spacedim>> &vertices,
721  std::ostream & out);
722 
723 private:
728  static void
729  skip_empty_lines(std::istream &in);
730 
738  static void
739  skip_comment_lines(std::istream &in, const char comment_start);
740 
748  static void
749  parse_tecplot_header(std::string & header,
750  std::vector<unsigned int> &tecplot2deal,
751  unsigned int & n_vars,
752  unsigned int & n_vertices,
753  unsigned int & n_cells,
754  std::vector<unsigned int> &IJK,
755  bool & structured,
756  bool & blocked);
757 
762 };
763 
764 /* -------------- declaration of explicit specializations ------------- */
765 
766 #ifndef DOXYGEN
767 
768 template <>
769 void
770 GridIn<2>::debug_output_grid(const std::vector<CellData<2>> &cells,
771  const std::vector<Point<2>> & vertices,
772  std::ostream & out);
773 
774 
775 template <>
776 void
777 GridIn<2, 3>::debug_output_grid(const std::vector<CellData<2>> &cells,
778  const std::vector<Point<3>> & vertices,
779  std::ostream & out);
780 template <>
781 void
782 GridIn<3>::debug_output_grid(const std::vector<CellData<3>> &cells,
783  const std::vector<Point<3>> & vertices,
784  std::ostream & out);
785 #endif // DOXYGEN
786 
788 
789 #endif
GridIn::default_suffix
static std::string default_suffix(const Format format)
Definition: grid_in.cc:3457
GridIn::debug_output_grid
static void debug_output_grid(const std::vector< CellData< dim >> &cells, const std::vector< Point< spacedim >> &vertices, std::ostream &out)
Definition: grid_in.cc:3211
GridIn::read
void read(std::istream &in, Format format=Default)
Definition: grid_in.cc:3390
GridIn::ExcGmshUnsupportedGeometry
static ::ExceptionBase & ExcGmshUnsupportedGeometry(int arg1)
GridIn::ExcInvalidGMSHInput
static ::ExceptionBase & ExcInvalidGMSHInput(std::string arg1)
GridIn::read_ucd
void read_ucd(std::istream &in, const bool apply_all_indicators_to_manifolds=false)
Definition: grid_in.cc:781
GridIn::ExcInvalidVertexIndex
static ::ExceptionBase & ExcInvalidVertexIndex(int arg1, int arg2)
GridIn::tecplot
@ tecplot
Use read_tecplot()
Definition: grid_in.h:333
GridIn::read_xda
void read_xda(std::istream &in)
Definition: grid_in.cc:1269
GridIn::read_abaqus
void read_abaqus(std::istream &in, const bool apply_all_indicators_to_manifolds=false)
Definition: grid_in.cc:1046
GridIn::attach_triangulation
void attach_triangulation(Triangulation< dim, spacedim > &tria)
Definition: grid_in.cc:106
CellData
Definition: tria_description.h:67
GridIn::parse_format
static Format parse_format(const std::string &format_name)
Definition: grid_in.cc:3492
GridIn::ExcUnknownSectionType
static ::ExceptionBase & ExcUnknownSectionType(int arg1)
Triangulation
Definition: tria.h:1109
GridIn::ExcInvalidDBMeshFormat
static ::ExceptionBase & ExcInvalidDBMeshFormat()
GridIn::abaqus
@ abaqus
Use read_abaqus()
Definition: grid_in.h:323
GridIn::ExcGmshNoCellInformation
static ::ExceptionBase & ExcGmshNoCellInformation()
GridIn::read_dbmesh
void read_dbmesh(std::istream &in)
Definition: grid_in.cc:1102
Physics::Elasticity::Kinematics::e
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
GridIn::xda
@ xda
Use read_xda()
Definition: grid_in.h:327
GridIn::ExcInvalidVertexIndexGmsh
static ::ExceptionBase & ExcInvalidVertexIndexGmsh(int arg1, int arg2, int arg3)
GridIn::unv
@ unv
Use read_unv()
Definition: grid_in.h:319
GridIn::Format
Format
Definition: grid_in.h:314
GridIn::GridIn
GridIn()
Definition: grid_in.cc:98
GridIn::msh
@ msh
Use read_msh()
Definition: grid_in.h:329
GridIn::read_unv
void read_unv(std::istream &in)
Definition: grid_in.cc:532
GridIn::ExcDBMESHWrongDimension
static ::ExceptionBase & ExcDBMESHWrongDimension(int arg1)
GridIn::dbmesh
@ dbmesh
Use read_dbmesh()
Definition: grid_in.h:325
GridIn::vtu
@ vtu
Use read_vtu()
Definition: grid_in.h:337
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
GridIn::read_vtu
void read_vtu(std::istream &in)
Definition: grid_in.cc:505
DeclException3
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:564
DEAL_II_DEPRECATED
#define DEAL_II_DEPRECATED
Definition: config.h:98
DeclException1
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:518
GridIn::get_format_names
static std::string get_format_names()
Definition: grid_in.cc:3552
smartpointer.h
GridIn::parse_tecplot_header
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:2514
exceptions.h
GridIn::read_assimp
void read_assimp(const std::string &filename, const unsigned int mesh_index=numbers::invalid_unsigned_int, const bool remove_duplicates=true, const double tol=1e-12, const bool ignore_unsupported_element_types=true)
Definition: grid_in.cc:2998
SmartPointer
Definition: smartpointer.h:68
vertices
Point< 3 > vertices[4]
Definition: data_out_base.cc:174
GridIn::tria
SmartPointer< Triangulation< dim, spacedim >, GridIn< dim, spacedim > > tria
Definition: grid_in.h:696
GridIn::ExcInvalidDBMESHInput
static ::ExceptionBase & ExcInvalidDBMESHInput(std::string arg1)
GridIn::skip_comment_lines
static void skip_comment_lines(std::istream &in, const char comment_start)
Definition: grid_in.cc:3185
GridIn::ExcNoTriangulationSelected
static ::ExceptionBase & ExcNoTriangulationSelected()
GridIn::vtk
@ vtk
Use read_vtk()
Definition: grid_in.h:335
GridIn::read_vtk
void read_vtk(std::istream &in)
Definition: grid_in.cc:115
DeclException0
#define DeclException0(Exception0)
Definition: exceptions.h:473
GridIn::default_format
Format default_format
Definition: grid_in.h:761
GridIn
Definition: grid_in.h:307
numbers::invalid_unsigned_int
static const unsigned int invalid_unsigned_int
Definition: types.h:191
GridIn::skip_empty_lines
static void skip_empty_lines(std::istream &in)
Definition: grid_in.cc:3155
Point< spacedim >
GridIn::Default
@ Default
Use GridIn::default_format stored in this object.
Definition: grid_in.h:317
GridIn::netcdf
@ netcdf
Use read_netcdf()
Definition: grid_in.h:331
GridIn::read_msh
void read_msh(std::istream &in)
Definition: grid_in.cc:1427
config.h
GridIn::ExcUnknownIdentifier
static ::ExceptionBase & ExcUnknownIdentifier(std::string arg1)
internal::TriangulationImplementation::n_cells
unsigned int n_cells(const internal::TriangulationImplementation::NumberCache< 1 > &c)
Definition: tria.cc:12618
GridIn::ExcUnknownElementType
static ::ExceptionBase & ExcUnknownElementType(int arg1)
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
GridIn::assimp
@ assimp
Use read_assimp()
Definition: grid_in.h:339
GridIn::ucd
@ ucd
Use read_ucd()
Definition: grid_in.h:321
DeclException2
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:541
GridIn::read_netcdf
void read_netcdf(const std::string &filename)
GridIn::read_tecplot
void read_tecplot(std::istream &in)
Definition: grid_in.cc:2989
point.h