From 14296bc675ab2c7326f649688a0f1903cb13f2b1 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 9 Dec 1999 07:50:30 +0000 Subject: [PATCH] Proper indentation. git-svn-id: https://svn.dealii.org/trunk@2018 0785d39b-7218-0410-832d-ea1e28bc413d --- .../examples/step-by-step/step-1/step-1.cc | 322 +++++++++--------- deal.II/examples/step-1/step-1.cc | 322 +++++++++--------- 2 files changed, 322 insertions(+), 322 deletions(-) diff --git a/deal.II/deal.II/Attic/examples/step-by-step/step-1/step-1.cc b/deal.II/deal.II/Attic/examples/step-by-step/step-1/step-1.cc index 195b23fee1..441c28cbe3 100644 --- a/deal.II/deal.II/Attic/examples/step-by-step/step-1/step-1.cc +++ b/deal.II/deal.II/Attic/examples/step-by-step/step-1/step-1.cc @@ -1,71 +1,71 @@ /* $Id$ */ - // Needed for the Triangulation class: + // Needed for the Triangulation class: #include - // We need the following two includes - // for loops over cells and/or faces: + // We need the following two includes + // for loops over cells and/or faces: #include #include - // Here are some functions to - // generate standard grids: + // Here are some functions to + // generate standard grids: #include - // We would like to use boundaries - // which are not straight lines, so - // we import some classes which - // predefine some boundary - // descriptions: + // We would like to use boundaries + // which are not straight lines, so + // we import some classes which + // predefine some boundary + // descriptions: #include - // Output of grids in various - // graphics formats: + // Output of grids in various + // graphics formats: #include - // This is needed for C++ output: + // This is needed for C++ output: #include - // In the following function, we - // simply use the unit square as - // domain and produce a globally - // refined grid from it. + // In the following function, we + // simply use the unit square as + // domain and produce a globally + // refined grid from it. void first_grid () { - // Define an object for a - // triangulation of a - // two-dimensional domain. Here and - // in many following cases, the - // string "<2>" after a class name - // indicates that this is an object - // that shall work in two space - // dimensions. Likewise, there are - // version working in one ("<1>") - // and three ("<3>") space - // dimension, or for all - // dimensions. We will see such - // constructs in later examples, - // where we show how to program - // dimension independently. - // (At present, only one through - // three space dimensions are - // supported, but that is not a - // restriction. In case someone - // would like to implement four - // dimensional finite elements, for - // example for general relativity, - // this would be a straightforward - // thing.) + // Define an object for a + // triangulation of a + // two-dimensional domain. Here and + // in many following cases, the + // string "<2>" after a class name + // indicates that this is an object + // that shall work in two space + // dimensions. Likewise, there are + // version working in one ("<1>") + // and three ("<3>") space + // dimension, or for all + // dimensions. We will see such + // constructs in later examples, + // where we show how to program + // dimension independently. + // (At present, only one through + // three space dimensions are + // supported, but that is not a + // restriction. In case someone + // would like to implement four + // dimensional finite elements, for + // example for general relativity, + // this would be a straightforward + // thing.) Triangulation<2> triangulation; - // Fill it with a square + // Fill it with a square GridGenerator::hyper_cube (triangulation); - // Refine all cells four times, to - // yield 4^4=256 cells in total + // Refine all cells four times, to + // yield 4^4=256 cells in total triangulation.refine_global (4); - // Now we want to write it to some - // output, here in postscript - // format + // Now we want to write it to some + // output, here in postscript + // format ofstream out ("grid-1.eps"); GridOut grid_out; grid_out.write_eps (triangulation, out); @@ -73,151 +73,151 @@ void first_grid () - // The grid in the following function - // is slightly more complicated in - // that we use a ring domain and - // refine the result once globally + // The grid in the following function + // is slightly more complicated in + // that we use a ring domain and + // refine the result once globally void second_grid () { - // Define an object for a - // triangulation of a - // two-dimensional domain + // Define an object for a + // triangulation of a + // two-dimensional domain Triangulation<2> triangulation; - // Fill it with a ring domain. The - // center of the ring shall be the - // point (1,0), and inner and outer - // radius shall be 0.5 and 1. The - // number of circumferentical cells - // will be adjusted automatically - // by this function (in this case, - // there will be 10) + // Fill it with a ring domain. The + // center of the ring shall be the + // point (1,0), and inner and outer + // radius shall be 0.5 and 1. The + // number of circumferentical cells + // will be adjusted automatically + // by this function (in this case, + // there will be 10) const Point<2> center (1,0); const double inner_radius = 0.5, - outer_radius = 1.0; + outer_radius = 1.0; GridGenerator::hyper_shell (triangulation, - center, inner_radius, outer_radius); - // By default, the triangulation - // assumes that all boundaries are - // straight and given by the cells - // of the coarse grid (which we - // just created). Here, however, we - // would like to have a curved - // boundary. Furtunately, some good - // soul implemented an object which - // describes the boundary of a ring - // domain; it only needs the center - // of the ring and automatically - // figures out the inner and outer - // radius when needed. Note that we - // associate this boundary object - // with that part of the boundary - // that has the "boundary number" - // zero. By default, all boundary - // parts have this number, but you - // might want to change this number - // for some parts, and then the - // curved boundary thus associated - // with number zero will not apply - // there. + center, inner_radius, outer_radius); + // By default, the triangulation + // assumes that all boundaries are + // straight and given by the cells + // of the coarse grid (which we + // just created). Here, however, we + // would like to have a curved + // boundary. Furtunately, some good + // soul implemented an object which + // describes the boundary of a ring + // domain; it only needs the center + // of the ring and automatically + // figures out the inner and outer + // radius when needed. Note that we + // associate this boundary object + // with that part of the boundary + // that has the "boundary number" + // zero. By default, all boundary + // parts have this number, but you + // might want to change this number + // for some parts, and then the + // curved boundary thus associated + // with number zero will not apply + // there. const HyperShellBoundary<2> boundary_description(center); triangulation.set_boundary (0, boundary_description); - // Now, just for the purpose of - // demonstration and for no - // particular reason, we will - // refine the grid in five steps - // towards the inner circle of the - // domain: + // Now, just for the purpose of + // demonstration and for no + // particular reason, we will + // refine the grid in five steps + // towards the inner circle of the + // domain: for (unsigned int step=0; step<5; ++step) { - // Get an iterator which points - // to a cell and which we will - // move over all active cells - // one by one. Active cells are - // those that are not further - // refined + // Get an iterator which points + // to a cell and which we will + // move over all active cells + // one by one. Active cells are + // those that are not further + // refined Triangulation<2>::active_cell_iterator cell, endc; cell = triangulation.begin_active(); endc = triangulation.end(); - // Now loop over all cells... + // Now loop over all cells... for (; cell!=endc; ++cell) - // ...and over all vertices - // of the cells. Note the - // dimension-independent way - // by which we find out about - // the number of faces of a - // cell - for (unsigned int vertex=0; - vertex < GeometryInfo<2>::vertices_per_cell; - ++vertex) - { - // If this cell is at the - // inner boundary, then - // at least one of its vertices - // must have a radial - // distance from the center - // of 0.5 - const Point<2> vector_to_center - = (cell->vertex(vertex) - center); - const double distance_from_center - = sqrt(vector_to_center.square()); - - if (fabs(distance_from_center - inner_radius) < 1e-10) - { - // Ok, this is one of - // the cells we were - // looking for. Flag - // it for refinement - // and go to the next - // cell by breaking - // the loop over all - // vertices - cell->set_refine_flag (); - break; - }; - }; - - // Refine the cells which we - // have marked + // ...and over all vertices + // of the cells. Note the + // dimension-independent way + // by which we find out about + // the number of faces of a + // cell + for (unsigned int vertex=0; + vertex < GeometryInfo<2>::vertices_per_cell; + ++vertex) + { + // If this cell is at the + // inner boundary, then + // at least one of its vertices + // must have a radial + // distance from the center + // of 0.5 + const Point<2> vector_to_center + = (cell->vertex(vertex) - center); + const double distance_from_center + = sqrt(vector_to_center.square()); + + if (fabs(distance_from_center - inner_radius) < 1e-10) + { + // Ok, this is one of + // the cells we were + // looking for. Flag + // it for refinement + // and go to the next + // cell by breaking + // the loop over all + // vertices + cell->set_refine_flag (); + break; + }; + }; + + // Refine the cells which we + // have marked triangulation.execute_coarsening_and_refinement (); }; - // Now we want to write it to some - // output, here in postscript - // format + // Now we want to write it to some + // output, here in postscript + // format ofstream out ("grid-2.eps"); GridOut grid_out; grid_out.write_eps (triangulation, out); - // At this point, all objects - // created in this function will be - // destroyed in reverse - // order. Unfortunately, we defined - // the boundary object after the - // triangulation, which still has a - // pointer to it and the library - // will produce an error if the - // boundary object is destroyed - // before the triangulation. We - // therefore have to release it, - // which can be done as - // follows. Note that this sets the - // boundary object used for part - // "0" of the boundary back to a - // default object, over which the - // triangulation has full control. + // At this point, all objects + // created in this function will be + // destroyed in reverse + // order. Unfortunately, we defined + // the boundary object after the + // triangulation, which still has a + // pointer to it and the library + // will produce an error if the + // boundary object is destroyed + // before the triangulation. We + // therefore have to release it, + // which can be done as + // follows. Note that this sets the + // boundary object used for part + // "0" of the boundary back to a + // default object, over which the + // triangulation has full control. triangulation.set_boundary (0); }; - // Main function. Only call the two - // subfunctions, which produce the - // two grids. + // Main function. Only call the two + // subfunctions, which produce the + // two grids. int main () { first_grid (); diff --git a/deal.II/examples/step-1/step-1.cc b/deal.II/examples/step-1/step-1.cc index 195b23fee1..441c28cbe3 100644 --- a/deal.II/examples/step-1/step-1.cc +++ b/deal.II/examples/step-1/step-1.cc @@ -1,71 +1,71 @@ /* $Id$ */ - // Needed for the Triangulation class: + // Needed for the Triangulation class: #include - // We need the following two includes - // for loops over cells and/or faces: + // We need the following two includes + // for loops over cells and/or faces: #include #include - // Here are some functions to - // generate standard grids: + // Here are some functions to + // generate standard grids: #include - // We would like to use boundaries - // which are not straight lines, so - // we import some classes which - // predefine some boundary - // descriptions: + // We would like to use boundaries + // which are not straight lines, so + // we import some classes which + // predefine some boundary + // descriptions: #include - // Output of grids in various - // graphics formats: + // Output of grids in various + // graphics formats: #include - // This is needed for C++ output: + // This is needed for C++ output: #include - // In the following function, we - // simply use the unit square as - // domain and produce a globally - // refined grid from it. + // In the following function, we + // simply use the unit square as + // domain and produce a globally + // refined grid from it. void first_grid () { - // Define an object for a - // triangulation of a - // two-dimensional domain. Here and - // in many following cases, the - // string "<2>" after a class name - // indicates that this is an object - // that shall work in two space - // dimensions. Likewise, there are - // version working in one ("<1>") - // and three ("<3>") space - // dimension, or for all - // dimensions. We will see such - // constructs in later examples, - // where we show how to program - // dimension independently. - // (At present, only one through - // three space dimensions are - // supported, but that is not a - // restriction. In case someone - // would like to implement four - // dimensional finite elements, for - // example for general relativity, - // this would be a straightforward - // thing.) + // Define an object for a + // triangulation of a + // two-dimensional domain. Here and + // in many following cases, the + // string "<2>" after a class name + // indicates that this is an object + // that shall work in two space + // dimensions. Likewise, there are + // version working in one ("<1>") + // and three ("<3>") space + // dimension, or for all + // dimensions. We will see such + // constructs in later examples, + // where we show how to program + // dimension independently. + // (At present, only one through + // three space dimensions are + // supported, but that is not a + // restriction. In case someone + // would like to implement four + // dimensional finite elements, for + // example for general relativity, + // this would be a straightforward + // thing.) Triangulation<2> triangulation; - // Fill it with a square + // Fill it with a square GridGenerator::hyper_cube (triangulation); - // Refine all cells four times, to - // yield 4^4=256 cells in total + // Refine all cells four times, to + // yield 4^4=256 cells in total triangulation.refine_global (4); - // Now we want to write it to some - // output, here in postscript - // format + // Now we want to write it to some + // output, here in postscript + // format ofstream out ("grid-1.eps"); GridOut grid_out; grid_out.write_eps (triangulation, out); @@ -73,151 +73,151 @@ void first_grid () - // The grid in the following function - // is slightly more complicated in - // that we use a ring domain and - // refine the result once globally + // The grid in the following function + // is slightly more complicated in + // that we use a ring domain and + // refine the result once globally void second_grid () { - // Define an object for a - // triangulation of a - // two-dimensional domain + // Define an object for a + // triangulation of a + // two-dimensional domain Triangulation<2> triangulation; - // Fill it with a ring domain. The - // center of the ring shall be the - // point (1,0), and inner and outer - // radius shall be 0.5 and 1. The - // number of circumferentical cells - // will be adjusted automatically - // by this function (in this case, - // there will be 10) + // Fill it with a ring domain. The + // center of the ring shall be the + // point (1,0), and inner and outer + // radius shall be 0.5 and 1. The + // number of circumferentical cells + // will be adjusted automatically + // by this function (in this case, + // there will be 10) const Point<2> center (1,0); const double inner_radius = 0.5, - outer_radius = 1.0; + outer_radius = 1.0; GridGenerator::hyper_shell (triangulation, - center, inner_radius, outer_radius); - // By default, the triangulation - // assumes that all boundaries are - // straight and given by the cells - // of the coarse grid (which we - // just created). Here, however, we - // would like to have a curved - // boundary. Furtunately, some good - // soul implemented an object which - // describes the boundary of a ring - // domain; it only needs the center - // of the ring and automatically - // figures out the inner and outer - // radius when needed. Note that we - // associate this boundary object - // with that part of the boundary - // that has the "boundary number" - // zero. By default, all boundary - // parts have this number, but you - // might want to change this number - // for some parts, and then the - // curved boundary thus associated - // with number zero will not apply - // there. + center, inner_radius, outer_radius); + // By default, the triangulation + // assumes that all boundaries are + // straight and given by the cells + // of the coarse grid (which we + // just created). Here, however, we + // would like to have a curved + // boundary. Furtunately, some good + // soul implemented an object which + // describes the boundary of a ring + // domain; it only needs the center + // of the ring and automatically + // figures out the inner and outer + // radius when needed. Note that we + // associate this boundary object + // with that part of the boundary + // that has the "boundary number" + // zero. By default, all boundary + // parts have this number, but you + // might want to change this number + // for some parts, and then the + // curved boundary thus associated + // with number zero will not apply + // there. const HyperShellBoundary<2> boundary_description(center); triangulation.set_boundary (0, boundary_description); - // Now, just for the purpose of - // demonstration and for no - // particular reason, we will - // refine the grid in five steps - // towards the inner circle of the - // domain: + // Now, just for the purpose of + // demonstration and for no + // particular reason, we will + // refine the grid in five steps + // towards the inner circle of the + // domain: for (unsigned int step=0; step<5; ++step) { - // Get an iterator which points - // to a cell and which we will - // move over all active cells - // one by one. Active cells are - // those that are not further - // refined + // Get an iterator which points + // to a cell and which we will + // move over all active cells + // one by one. Active cells are + // those that are not further + // refined Triangulation<2>::active_cell_iterator cell, endc; cell = triangulation.begin_active(); endc = triangulation.end(); - // Now loop over all cells... + // Now loop over all cells... for (; cell!=endc; ++cell) - // ...and over all vertices - // of the cells. Note the - // dimension-independent way - // by which we find out about - // the number of faces of a - // cell - for (unsigned int vertex=0; - vertex < GeometryInfo<2>::vertices_per_cell; - ++vertex) - { - // If this cell is at the - // inner boundary, then - // at least one of its vertices - // must have a radial - // distance from the center - // of 0.5 - const Point<2> vector_to_center - = (cell->vertex(vertex) - center); - const double distance_from_center - = sqrt(vector_to_center.square()); - - if (fabs(distance_from_center - inner_radius) < 1e-10) - { - // Ok, this is one of - // the cells we were - // looking for. Flag - // it for refinement - // and go to the next - // cell by breaking - // the loop over all - // vertices - cell->set_refine_flag (); - break; - }; - }; - - // Refine the cells which we - // have marked + // ...and over all vertices + // of the cells. Note the + // dimension-independent way + // by which we find out about + // the number of faces of a + // cell + for (unsigned int vertex=0; + vertex < GeometryInfo<2>::vertices_per_cell; + ++vertex) + { + // If this cell is at the + // inner boundary, then + // at least one of its vertices + // must have a radial + // distance from the center + // of 0.5 + const Point<2> vector_to_center + = (cell->vertex(vertex) - center); + const double distance_from_center + = sqrt(vector_to_center.square()); + + if (fabs(distance_from_center - inner_radius) < 1e-10) + { + // Ok, this is one of + // the cells we were + // looking for. Flag + // it for refinement + // and go to the next + // cell by breaking + // the loop over all + // vertices + cell->set_refine_flag (); + break; + }; + }; + + // Refine the cells which we + // have marked triangulation.execute_coarsening_and_refinement (); }; - // Now we want to write it to some - // output, here in postscript - // format + // Now we want to write it to some + // output, here in postscript + // format ofstream out ("grid-2.eps"); GridOut grid_out; grid_out.write_eps (triangulation, out); - // At this point, all objects - // created in this function will be - // destroyed in reverse - // order. Unfortunately, we defined - // the boundary object after the - // triangulation, which still has a - // pointer to it and the library - // will produce an error if the - // boundary object is destroyed - // before the triangulation. We - // therefore have to release it, - // which can be done as - // follows. Note that this sets the - // boundary object used for part - // "0" of the boundary back to a - // default object, over which the - // triangulation has full control. + // At this point, all objects + // created in this function will be + // destroyed in reverse + // order. Unfortunately, we defined + // the boundary object after the + // triangulation, which still has a + // pointer to it and the library + // will produce an error if the + // boundary object is destroyed + // before the triangulation. We + // therefore have to release it, + // which can be done as + // follows. Note that this sets the + // boundary object used for part + // "0" of the boundary back to a + // default object, over which the + // triangulation has full control. triangulation.set_boundary (0); }; - // Main function. Only call the two - // subfunctions, which produce the - // two grids. + // Main function. Only call the two + // subfunctions, which produce the + // two grids. int main () { first_grid (); -- 2.39.5