Reference documentation for deal.II version 9.3.3
\(\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 - 2021 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
34template <int dim, int space_dim>
35class Triangulation;
36template <int dim>
37struct CellData;
38#endif
39
305template <int dim, int spacedim = dim>
307{
308public:
314 {
339 };
340
344 GridIn();
345
350
354 void
356
361 void
362 read(std::istream &in, Format format = Default);
363
369 void
370 read(const std::string &in, Format format = Default);
371
411 void
412 read_vtk(std::istream &in);
413
428 void
429 read_vtu(std::istream &in);
430
431
439 void
440 read_unv(std::istream &in);
441
451 void
452 read_ucd(std::istream &in,
453 const bool apply_all_indicators_to_manifolds = false);
454
494 void
495 read_abaqus(std::istream &in,
496 const bool apply_all_indicators_to_manifolds = false);
497
501 void
502 read_dbmesh(std::istream &in);
503
507 void
508 read_xda(std::istream &in);
509
521 void
522 read_msh(std::istream &in);
523
524#ifdef DEAL_II_GMSH_WITH_API
579 void
580 read_msh(const std::string &filename);
581#endif
582
587 void
588 read_tecplot(std::istream &in);
589
624 void
625 read_assimp(const std::string &filename,
626 const unsigned int mesh_index = numbers::invalid_unsigned_int,
627 const bool remove_duplicates = true,
628 const double tol = 1e-12,
629 const bool ignore_unsupported_element_types = true);
630
640 {
645 std::vector<std::vector<int>> id_to_sideset_ids;
646 };
647
705 read_exodusii(const std::string &filename,
706 const bool apply_all_indicators_to_manifolds = false);
707
711 static std::string
712 default_suffix(const Format format);
713
717 static Format
718 parse_format(const std::string &format_name);
719
725 static std::string
727
732 int,
733 << "The section type <" << arg1 << "> in an UNV "
734 << "input file is not implemented.");
735
740 int,
741 << "The element type <" << arg1 << "> in an UNV "
742 << "input file is not implemented.");
743
748 std::string,
749 << "The identifier <" << arg1 << "> as name of a "
750 << "part in an UCD input file is unknown or the "
751 << "respective input routine is not implemented."
752 << "(Maybe the space dimension of triangulation and "
753 << "input file do not match?");
758 "No Triangulation has been attached to this GridIn object "
759 "so that nothing can be filled during any read function "
760 "calls. Please pass a reference to the Triangulation tria "
761 "to be filled in the constructor GridIn(tria) or attach "
762 "it with the function call GridIn::attach_triangulation().");
768 int,
769 int,
770 << "While creating cell " << arg1
771 << ", you are referencing a vertex with index " << arg2
772 << " but no vertex with this index has been described in the input file.");
778 int,
779 int,
780 int,
781 << "While creating cell " << arg1 << " (which is numbered as " << arg2
782 << " in the input file), you are referencing a vertex with index " << arg3
783 << " but no vertex with this index has been described in the input file.");
792 std::string,
793 << "The string <" << arg1
794 << "> is not recognized at the present"
795 << " position of a DB Mesh file.");
796
802 int,
803 << "The specified dimension " << arg1
804 << " is not the same as that of the triangulation to be created.");
805
807 std::string,
808 << "The string <" << arg1
809 << "> is not recognized at the present"
810 << " position of a Gmsh Mesh file.");
811
813 int,
814 << "The Element Identifier <" << arg1 << "> is not "
815 << "supported in the deal.II library when "
816 << "reading meshes in " << dim << " dimensions.\n"
817 << "Supported elements are: \n"
818 << "ELM-TYPE\n"
819 << "1 Line (2 nodes, 1 edge).\n"
820 << "3 Quadrilateral (4 nodes, 4 edges).\n"
821 << "5 Hexahedron (8 nodes, 12 edges, 6 faces) when in 3d.\n"
822 << "15 Point (1 node, ignored when read)");
823
824
826
827protected:
832
853 static void
854 debug_output_grid(const std::vector<CellData<dim>> & cells,
855 const std::vector<Point<spacedim>> &vertices,
856 std::ostream & out);
857
858private:
863 static void
864 skip_empty_lines(std::istream &in);
865
873 static void
874 skip_comment_lines(std::istream &in, const char comment_start);
875
883 static void
884 parse_tecplot_header(std::string & header,
885 std::vector<unsigned int> &tecplot2deal,
886 unsigned int & n_vars,
887 unsigned int & n_vertices,
888 unsigned int & n_cells,
889 std::vector<unsigned int> &IJK,
890 bool & structured,
891 bool & blocked);
892
897};
898
899/* -------------- declaration of explicit specializations ------------- */
900
901#ifndef DOXYGEN
902
903template <>
904void
905GridIn<2>::debug_output_grid(const std::vector<CellData<2>> &cells,
906 const std::vector<Point<2>> & vertices,
907 std::ostream & out);
908
909
910template <>
911void
912GridIn<2, 3>::debug_output_grid(const std::vector<CellData<2>> &cells,
913 const std::vector<Point<3>> & vertices,
914 std::ostream & out);
915template <>
916void
917GridIn<3>::debug_output_grid(const std::vector<CellData<3>> &cells,
918 const std::vector<Point<3>> & vertices,
919 std::ostream & out);
920#endif // DOXYGEN
921
923
924#endif
Format
Definition: grid_in.h:314
@ Default
Use GridIn::default_format stored in this object.
Definition: grid_in.h:316
@ vtu
Use read_vtu()
Definition: grid_in.h:334
@ xda
Use read_xda()
Definition: grid_in.h:326
@ tecplot
Use read_tecplot()
Definition: grid_in.h:330
@ msh
Use read_msh()
Definition: grid_in.h:328
@ ucd
Use read_ucd()
Definition: grid_in.h:320
@ dbmesh
Use read_dbmesh()
Definition: grid_in.h:324
@ abaqus
Use read_abaqus()
Definition: grid_in.h:322
@ assimp
Use read_assimp()
Definition: grid_in.h:336
@ unv
Use read_unv()
Definition: grid_in.h:318
@ exodusii
Use read_exodusii()
Definition: grid_in.h:338
@ vtk
Use read_vtk()
Definition: grid_in.h:332
SmartPointer< Triangulation< dim, spacedim >, GridIn< dim, spacedim > > tria
Definition: grid_in.h:831
GridIn()
Definition: grid_in.cc:102
static void skip_empty_lines(std::istream &in)
Definition: grid_in.cc:3345
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:2819
void read_abaqus(std::istream &in, const bool apply_all_indicators_to_manifolds=false)
Definition: grid_in.cc:1137
static std::string default_suffix(const Format format)
Definition: grid_in.cc:3656
void read_xda(std::istream &in)
Definition: grid_in.cc:1359
static void skip_comment_lines(std::istream &in, const char comment_start)
Definition: grid_in.cc:3375
void attach_triangulation(Triangulation< dim, spacedim > &tria)
Definition: grid_in.cc:119
static Format parse_format(const std::string &format_name)
Definition: grid_in.cc:3691
void read_vtu(std::istream &in)
Definition: grid_in.cc:593
void read_tecplot(std::istream &in)
Definition: grid_in.cc:2810
Format default_format
Definition: grid_in.h:896
ExodusIIData read_exodusii(const std::string &filename, const bool apply_all_indicators_to_manifolds=false)
Definition: grid_in.cc:3177
void read_dbmesh(std::istream &in)
Definition: grid_in.cc:1193
void read_ucd(std::istream &in, const bool apply_all_indicators_to_manifolds=false)
Definition: grid_in.cc:874
void read(std::istream &in, Format format=Default)
Definition: grid_in.cc:3589
static void debug_output_grid(const std::vector< CellData< dim > > &cells, const std::vector< Point< spacedim > > &vertices, std::ostream &out)
Definition: grid_in.cc:3401
static std::string get_format_names()
Definition: grid_in.cc:3748
void read_unv(std::istream &in)
Definition: grid_in.cc:620
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:2336
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:402
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:403
Point< 3 > vertices[4]
#define DeclException0(Exception0)
Definition: exceptions.h:470
static ::ExceptionBase & ExcInvalidDBMeshFormat()
static ::ExceptionBase & ExcUnknownIdentifier(std::string arg1)
static ::ExceptionBase & ExcInvalidGMSHInput(std::string arg1)
static ::ExceptionBase & ExcInvalidDBMESHInput(std::string arg1)
static ::ExceptionBase & ExcDBMESHWrongDimension(int arg1)
static ::ExceptionBase & ExcInvalidVertexIndex(int arg1, int arg2)
static ::ExceptionBase & ExcNoTriangulationSelected()
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:538
static ::ExceptionBase & ExcUnknownElementType(int arg1)
static ::ExceptionBase & ExcInvalidVertexIndexGmsh(int arg1, int arg2, int arg3)
static ::ExceptionBase & ExcGmshNoCellInformation()
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:493
static ::ExceptionBase & ExcUnknownSectionType(int arg1)
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:561
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:515
static ::ExceptionBase & ExcGmshUnsupportedGeometry(int arg1)
void read_vtk(std::istream &in)
Definition: grid_in.cc:128
void read_msh(std::istream &in)
Definition: grid_in.cc:1427
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
unsigned int n_cells(const internal::TriangulationImplementation::NumberCache< 1 > &c)
Definition: tria.cc:12587
static const unsigned int invalid_unsigned_int
Definition: types.h:196
std::vector< std::vector< int > > id_to_sideset_ids
Definition: grid_in.h:645