From 79e6304f0284178d3e00fbe0bb53b99fc49f1ee8 Mon Sep 17 00:00:00 2001
From: wolf
Date: Thu, 30 Dec 1999 16:07:50 +0000
Subject: [PATCH] Move DataIn to GridIn and into a new file.
git-svn-id: https://svn.dealii.org/trunk@2133 0785d39b-7218-0410-832d-ea1e28bc413d
---
deal.II/deal.II/include/grid/grid_in.h | 188 ++++++++++++++++++
deal.II/deal.II/include/numerics/data_io.h | 167 ----------------
deal.II/deal.II/source/grid/grid_in.cc | 159 +++++++++++++++
deal.II/deal.II/source/numerics/data_io.cc | 151 --------------
deal.II/doc/auto/Makefile | 4 +-
.../chapter-1.elements/grid_creation.html | 4 +-
6 files changed, 351 insertions(+), 322 deletions(-)
create mode 100644 deal.II/deal.II/include/grid/grid_in.h
create mode 100644 deal.II/deal.II/source/grid/grid_in.cc
diff --git a/deal.II/deal.II/include/grid/grid_in.h b/deal.II/deal.II/include/grid/grid_in.h
new file mode 100644
index 0000000000..d827974552
--- /dev/null
+++ b/deal.II/deal.II/include/grid/grid_in.h
@@ -0,0 +1,188 @@
+/*---------------------------- grid_in.h ---------------------------*/
+/* $Id$ */
+#ifndef __grid_in_H
+#define __grid_in_H
+/*---------------------------- grid_in.h ---------------------------*/
+
+
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+
+/**
+ * This class implements an input mechanism for grid data. It allows to
+ * read a grid structure into a triangulation object. Future versions
+ * will also allow to read data on this grid into vectors.
+ *
+ * At present, only UCD (unstructured cell data) is supported as input
+ * format for grid data. Any numerical data after the block of topological
+ * information is ignored.
+ *
+ * To read grid data, the triangulation to be fed with has to be empty.
+ * When giving a file which does not contain the assumed information or
+ * which does not keep to the right format, the state of the triangulation
+ * will be undefined afterwards. Upon input, only lines in one dimension
+ * and line and quads in two dimensions are accepted. All other cell types
+ * (e.g. triangles in two dimensions, quads and hexes in 3d) are rejected.
+ * The vertex and cell numbering in the UCD file, which
+ * need not be consecutively, is lost upon transfer to the triangulation
+ * object, since this one needs consecutively numbered elements.
+ *
+ * Material indicators are accepted to denote the material id of cells and
+ * to denote boundary part indication for lines in 2D. Read the according
+ * sections in the documentation of the \Ref{Triangulation} class for
+ * further details.
+ *
+ *
+ * \subsection{Structure of input grid data}
+ *
+ * It is your duty to use a correct numbering of vertices in the cell list,
+ * i.e. for lines, you have to first give the vertex with the lower coordinate
+ * value, then that with the higher coordinate value. For quadrilaterals in
+ * two dimensions, the vertex indices in the #quad# list have to be such that
+ * the vertices are numbered in counter-clockwise sense.
+ *
+ * In two dimensions, another difficulty occurs, which has to do with the sense
+ * of a quadrilateral. A quad consists of four lines which have a direction,
+ * which is per definitionem as follows:
+ * \begin{verbatim}
+ * 3-->--2
+ * | |
+ * ^ ^
+ * | |
+ * 0-->--1
+ * \end{verbatim}
+ * Now, two adjacent cells must have a vertex numbering such that the direction
+ * of the common side is the same. For example, the following two quads
+ * \begin{verbatim}
+ * 3---4---5
+ * | | |
+ * 0---1---2
+ * \end{verbatim}
+ * may be characterised by the vertex numbers (0 1 4 3) and (1 2 5 4), since
+ * the middle line would get the direction #1->4# when viewed from both cells.
+ * The numbering (0 1 4 3) and (5 4 1 2) would not be allowed, since the left
+ * quad would give the common line the direction #1->4#, while the right one
+ * would want to use #4->1#, leading to ambiguity. The #Triangulation# object
+ * is capable of detecting this special case, which can be eliminated by
+ * rotating the indices of the right quad by two. However, it would not
+ * know what to do if you gave the vertex indices (4 1 2 5), since then it
+ * would have to rotate by one element or three, the decision which to take is
+ * not yet implemented.
+ *
+ * There are more ambiguous cases, where the triangulation may not know what
+ * to do at all without the use of very sophisticated algorithms. On such example
+ * is the following:
+ * \begin{verbatim}
+ * 9---10-----11
+ * | | / |
+ * 6---7---8 |
+ * | | | |
+ * 3---4---5 |
+ * | | \ |
+ * 0---1------2
+ * \end{verbatim}
+ * Assume that you had numbered the vertices in the cells at the left boundary
+ * in a way, that the following line directions are induced:
+ * \begin{verbatim}
+ * 9->-10-----11
+ * ^ ^ / |
+ * 6->-7---8 |
+ * ^ ^ | |
+ * 3->-4---5 |
+ * ^ ^ \ |
+ * 0->-1------2
+ * \end{verbatim}
+ * (This could for example be done by using the indices (0 1 4 3), (3 4 7 6),
+ * (6 7 10 9) for the three cells). Now, you will not find a way of giving
+ * indices for the right cells, without introducing either ambiguity for
+ * one line or other, or without violating that within each cells, there must be
+ * one vertex from which both lines are directed away and the opposite one to
+ * which both adjacent lines point to.
+ *
+ * The solution in this case is to renumber one of the three left cells, e.g.
+ * by reverting the sense of the line between vertices 7 and 10 by numbering
+ * the top left cell by (9 6 7 10).
+ *
+ * But this is a thing that the triangulation
+ * object can't do for you, since it would involve backtracking to cells
+ * already created when we find that we can't number the indices of one of
+ * the rightmost cells consistently. It is neither clear how to do this
+ * backtracking nor whether it can be done with a stopping algorithm, if
+ * possible within polynomial time. This kind of numbering must be made
+ * upon construction of the coarse grid, unfortunately.
+ *
+ * @author Wolfgang Bangerth, 1998
+ */
+template
+class GridIn
+{
+ public:
+ /**
+ * Constructor.
+ */
+ GridIn ();
+
+ /**
+ * Attach this triangulation
+ * to be fed with the grid data.
+ */
+ void attach_triangulation (Triangulation &tria);
+
+ /**
+ * Read grid data from an ucd file.
+ * Numerical data is ignored.
+ */
+ void read_ucd (istream &);
+
+ /**
+ * Exception
+ */
+ DeclException1 (ExcUnknownIdentifier,
+ string,
+ << "The identifier <" << arg1 << "> as name of a "
+ << "part in an UCD input file is unknown or the "
+ << "respective input routine is not implemented.");
+ /**
+ * Exception
+ */
+ DeclException0 (ExcNoTriangulationSelected);
+ /**
+ * Exception
+ */
+ DeclException2 (ExcInvalidVertexIndex,
+ int, int,
+ << "Trying to access invalid vertex index " << arg2
+ << " while creating cell " << arg1);
+ /**
+ * Exception
+ */
+ DeclException0 (ExcInternalError);
+ /**
+ * Exception
+ */
+ DeclException0 (ExcIO);
+
+ private:
+ /**
+ * Store address of the triangulation to
+ * be fed with the data read in.
+ */
+ SmartPointer > tria;
+};
+
+
+
+
+
+
+/*---------------------------- grid_in.h ---------------------------*/
+/* end of #ifndef __grid_in_H */
+#endif
+/*---------------------------- grid_in.h ---------------------------*/
diff --git a/deal.II/deal.II/include/numerics/data_io.h b/deal.II/deal.II/include/numerics/data_io.h
index 810217620c..426b562e44 100644
--- a/deal.II/deal.II/include/numerics/data_io.h
+++ b/deal.II/deal.II/include/numerics/data_io.h
@@ -14,173 +14,6 @@
-/**
- * This class implements an input mechanism for grid data. It allows to
- * read a grid structure into a triangulation object. Future versions
- * will also allow to read data on this grid into vectors.
- *
- * At present, only UCD (unstructured cell data) is supported as input
- * format for grid data. Any numerical data after the block of topological
- * information is ignored.
- *
- * To read grid data, the triangulation to be fed with has to be empty.
- * When giving a file which does not contain the assumed information or
- * which does not keep to the right format, the state of the triangulation
- * will be undefined afterwards. Upon input, only lines in one dimension
- * and line and quads in two dimensions are accepted. All other cell types
- * (e.g. triangles in two dimensions, quads and hexes in 3d) are rejected.
- * The vertex and cell numbering in the UCD file, which
- * need not be consecutively, is lost upon transfer to the triangulation
- * object, since this one needs consecutively numbered elements.
- *
- * Material indicators are accepted to denote the material id of cells and
- * to denote boundary part indication for lines in 2D. Read the according
- * sections in the documentation of the \Ref{Triangulation} class for
- * further details.
- *
- *
- * \subsection{Structure of input grid data}
- *
- * It is your duty to use a correct numbering of vertices in the cell list,
- * i.e. for lines, you have to first give the vertex with the lower coordinate
- * value, then that with the higher coordinate value. For quadrilaterals in
- * two dimensions, the vertex indices in the #quad# list have to be such that
- * the vertices are numbered in counter-clockwise sense.
- *
- * In two dimensions, another difficulty occurs, which has to do with the sense
- * of a quadrilateral. A quad consists of four lines which have a direction,
- * which is per definitionem as follows:
- * \begin{verbatim}
- * 3-->--2
- * | |
- * ^ ^
- * | |
- * 0-->--1
- * \end{verbatim}
- * Now, two adjacent cells must have a vertex numbering such that the direction
- * of the common side is the same. For example, the following two quads
- * \begin{verbatim}
- * 3---4---5
- * | | |
- * 0---1---2
- * \end{verbatim}
- * may be characterised by the vertex numbers (0 1 4 3) and (1 2 5 4), since
- * the middle line would get the direction #1->4# when viewed from both cells.
- * The numbering (0 1 4 3) and (5 4 1 2) would not be allowed, since the left
- * quad would give the common line the direction #1->4#, while the right one
- * would want to use #4->1#, leading to ambiguity. The #Triangulation# object
- * is capable of detecting this special case, which can be eliminated by
- * rotating the indices of the right quad by two. However, it would not
- * know what to do if you gave the vertex indices (4 1 2 5), since then it
- * would have to rotate by one element or three, the decision which to take is
- * not yet implemented.
- *
- * There are more ambiguous cases, where the triangulation may not know what
- * to do at all without the use of very sophisticated algorithms. On such example
- * is the following:
- * \begin{verbatim}
- * 9---10-----11
- * | | / |
- * 6---7---8 |
- * | | | |
- * 3---4---5 |
- * | | \ |
- * 0---1------2
- * \end{verbatim}
- * Assume that you had numbered the vertices in the cells at the left boundary
- * in a way, that the following line directions are induced:
- * \begin{verbatim}
- * 9->-10-----11
- * ^ ^ / |
- * 6->-7---8 |
- * ^ ^ | |
- * 3->-4---5 |
- * ^ ^ \ |
- * 0->-1------2
- * \end{verbatim}
- * (This could for example be done by using the indices (0 1 4 3), (3 4 7 6),
- * (6 7 10 9) for the three cells). Now, you will not find a way of giving
- * indices for the right cells, without introducing either ambiguity for
- * one line or other, or without violating that within each cells, there must be
- * one vertex from which both lines are directed away and the opposite one to
- * which both adjacent lines point to.
- *
- * The solution in this case is to renumber one of the three left cells, e.g.
- * by reverting the sense of the line between vertices 7 and 10 by numbering
- * the top left cell by (9 6 7 10).
- *
- * But this is a thing that the triangulation
- * object can't do for you, since it would involve backtracking to cells
- * already created when we find that we can't number the indices of one of
- * the rightmost cells consistently. It is neither clear how to do this
- * backtracking nor whether it can be done with a stopping algorithm, if
- * possible within polynomial time. This kind of numbering must be made
- * upon construction of the coarse grid, unfortunately.
- *
- * @author Wolfgang Bangerth, 1998
- */
-template
-class DataIn {
- public:
- /**
- * Constructor.
- */
- DataIn ();
-
- /**
- * Attach this triangulation
- * to be fed with the grid data.
- */
- void attach_triangulation (Triangulation *tria);
-
- /**
- * Read grid data from an ucd file.
- * Numerical data is ignored.
- */
- void read_ucd (istream &);
-
- /**
- * Exception
- */
- DeclException1 (ExcUnknownIdentifier,
- string,
- << "The identifier <" << arg1 << "> as name of a "
- << "part in an UCD input file is unknown or the "
- << "respective input routine is not implemented.");
- /**
- * Exception
- */
- DeclException0 (ExcNoTriangulationSelected);
- /**
- * Exception
- */
- DeclException2 (ExcInvalidVertexIndex,
- int, int,
- << "Trying to access invalid vertex index " << arg2
- << " while creating cell " << arg1);
- /**
- * Exception
- */
- DeclException0 (ExcInternalError);
- /**
- * Exception
- */
- DeclException0 (ExcIO);
-
- private:
- /**
- * Store address of the triangulation to
- * be fed with the data read in.
- */
- Triangulation *tria;
-};
-
-
-
-
-
-
-
/**
* This class is deprecated. Use the #DataOut# class instead.
*
diff --git a/deal.II/deal.II/source/grid/grid_in.cc b/deal.II/deal.II/source/grid/grid_in.cc
new file mode 100644
index 0000000000..6653a85742
--- /dev/null
+++ b/deal.II/deal.II/source/grid/grid_in.cc
@@ -0,0 +1,159 @@
+/* $Id$ */
+
+#include
+#include
+
+#include
@@ -198,7 +198,7 @@ grid construction algorithm. Otherwise some of your matrix elements
may have the wrong sign (plus instead of minus or vice versa).
A more detailed description of the problems
encountered in two dimensions can be found in the
- DataIn
class description.
+ GridIn
class description.
--
2.39.5