Reference documentation for deal.II version 8.1.0
grid_in.h
1 // ---------------------------------------------------------------------
2 // @f$Id: grid_in.h 31163 2013-10-07 13:43:08Z bangerth @f$
3 //
4 // Copyright (C) 1999 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 #ifndef __deal2__grid_in_h
18 #define __deal2__grid_in_h
19 
20 
21 #include <deal.II/base/config.h>
23 #include <deal.II/base/smartpointer.h>
24 #include <deal.II/base/point.h>
25 #include <iostream>
26 #include <vector>
27 #include <string>
28 
30 
31 template <int dim, int space_dim> class Triangulation;
32 template <int dim> struct CellData;
33 struct SubCellData;
34 
35 
315 template <int dim, int spacedim=dim>
316 class GridIn
317 {
318 public:
327  enum Format
328  {
347  };
348 
352  GridIn ();
353 
359 
366  void read (std::istream &in, Format format=Default);
367 
376  void read (const std::string &in, Format format=Default);
377 
384  void read_vtk(std::istream &in);
385 
397  void read_unv(std::istream &in);
398 
403  void read_ucd (std::istream &in);
404 
410  void read_dbmesh (std::istream &in);
411 
417  void read_xda (std::istream &in);
418 
435  void read_msh (std::istream &in);
436 
447  void read_netcdf (const std::string &filename);
448 
455  void read_tecplot (std::istream &in);
456 
461  static std::string default_suffix (const Format format);
462 
467  static Format parse_format (const std::string &format_name);
468 
476  static std::string get_format_names ();
477 
481  DeclException1(ExcUnknownSectionType,
482  int,
483  << "The section type <" << arg1 << "> in an UNV "
484  << "input file is not implemented.");
485 
489  DeclException1(ExcUnknownElementType,
490  int,
491  << "The element type <" << arg1 << "> in an UNV "
492  << "input file is not implemented.");
493 
497  DeclException1 (ExcUnknownIdentifier,
498  std::string,
499  << "The identifier <" << arg1 << "> as name of a "
500  << "part in an UCD input file is unknown or the "
501  << "respective input routine is not implemented."
502  << "(Maybe the space dimension of triangulation and "
503  << "input file do not match?");
507  DeclException0 (ExcNoTriangulationSelected);
511  DeclException2 (ExcInvalidVertexIndex,
512  int, int,
513  << "Trying to access invalid vertex index " << arg2
514  << " while creating cell " << arg1);
518  DeclException0 (ExcInvalidDBMeshFormat);
522  DeclException1 (ExcInvalidDBMESHInput,
523  std::string,
524  << "The string <" << arg1 << "> is not recognized at the present"
525  << " position of a DB Mesh file.");
526 
530  DeclException1 (ExcDBMESHWrongDimension,
531  int,
532  << "The specified dimension " << arg1
533  << " is not the same as that of the triangulation to be created.");
534 
535  DeclException1 (ExcInvalidGMSHInput,
536  std::string,
537  << "The string <" << arg1 << "> is not recognized at the present"
538  << " position of a Gmsh Mesh file.");
539 
540  DeclException1 (ExcGmshUnsupportedGeometry,
541  int,
542  << "The Element Identifier <" << arg1 << "> is not "
543  << "supported in the Deal.II Library.\n"
544  << "Supported elements are: \n"
545  << "ELM-TYPE\n"
546  << "1 Line (2 nodes, 1 edge).\n"
547  << "3 Quadrilateral (4 nodes, 4 edges).\n"
548  << "5 Hexahedron (8 nodes, 12 edges, 6 faces).\n"
549  << "15 Point (1 node, ignored when read)");
550 
551 
552  DeclException0 (ExcGmshNoCellInformation);
553 protected:
559 
605  static void debug_output_grid (const std::vector<CellData<dim> > &cells,
606  const std::vector<Point<spacedim> > &vertices,
607  std::ostream &out);
608 
609 private:
610 
617  static void skip_empty_lines (std::istream &in);
618 
633  static void skip_comment_lines (std::istream &in,
634  const char comment_start);
635 
646  static void parse_tecplot_header(std::string &header,
647  std::vector<unsigned int> &tecplot2deal,
648  unsigned int &n_vars,
649  unsigned int &n_vertices,
650  unsigned int &n_cells,
651  std::vector<unsigned int> &IJK,
652  bool &structured,
653  bool &blocked);
654 
660 };
661 
662 
663 
664 /* -------------- declaration of explicit specializations ------------- */
665 
666 #ifndef DOXYGEN
667 
668 template <>
669 void
670 GridIn<2>::debug_output_grid (const std::vector<CellData<2> > &cells,
671  const std::vector<Point<2> > &vertices,
672  std::ostream &out);
673 
674 
675 template <>
676 void
677 GridIn<2,3>::debug_output_grid (const std::vector<CellData<2> > &cells,
678  const std::vector<Point<3> > &vertices,
679  std::ostream &out);
680 template <>
681 void
682 GridIn<3>::debug_output_grid (const std::vector<CellData<3> > &cells,
683  const std::vector<Point<3> > &vertices,
684  std::ostream &out);
685 
686 #endif // DOXYGEN
687 
688 DEAL_II_NAMESPACE_CLOSE
689 
690 #endif
Format
Definition: grid_in.h:327
Use read_vtk()
Definition: grid_in.h:346
SmartPointer< Triangulation< dim, spacedim >, GridIn< dim, spacedim > > tria
Definition: grid_in.h:558
Use read_unv()
Definition: grid_in.h:332
Use read_xda()
Definition: grid_in.h:338
void read_vtk(std::istream &in)
static std::string default_suffix(const Format format)
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)
DeclException0(ExcNoTriangulationSelected)
static Format parse_format(const std::string &format_name)
Use read_ucd()
Definition: grid_in.h:334
void read_dbmesh(std::istream &in)
static void skip_comment_lines(std::istream &in, const char comment_start)
void read_tecplot(std::istream &in)
DeclException2(ExcInvalidVertexIndex, int, int,<< "Trying to access invalid vertex index "<< arg2<< " while creating cell "<< arg1)
DeclException1(ExcUnknownSectionType, int,<< "The section type <"<< arg1<< "> in an UNV "<< "input file is not implemented.")
Use read_msh()
Definition: grid_in.h:340
void read_ucd(std::istream &in)
Use read_tecplot()
Definition: grid_in.h:344
void read_xda(std::istream &in)
void read_msh(std::istream &in)
static void debug_output_grid(const std::vector< CellData< dim > > &cells, const std::vector< Point< spacedim > > &vertices, std::ostream &out)
static void skip_empty_lines(std::istream &in)
static std::string get_format_names()
Use read_dbmesh()
Definition: grid_in.h:336
void read_netcdf(const std::string &filename)
void read_unv(std::istream &in)
void read(std::istream &in, Format format=Default)
Use GridIn::default_format stored in this object.
Definition: grid_in.h:330
void attach_triangulation(Triangulation< dim, spacedim > &tria)
Use read_netcdf()
Definition: grid_in.h:342
Format default_format
Definition: grid_in.h:659