[cig-commits] commit 2437 by heister to /var/svn/dealii/aspect

dealii.demon at gmail.com dealii.demon at gmail.com
Wed Apr 9 06:14:44 PDT 2014


Revision 2437

indent file

U   branches/freesurface/source/simulator/freesurface.cc


http://www.dealii.org/websvn/revision.php?repname=Aspect+Repository&path=%2F&rev=2437&peg=2437

Diff:
Modified: branches/freesurface/source/simulator/freesurface.cc
===================================================================
--- branches/freesurface/source/simulator/freesurface.cc	2014-04-09 13:10:24 UTC (rev 2436)
+++ branches/freesurface/source/simulator/freesurface.cc	2014-04-09 13:14:42 UTC (rev 2437)
@@ -34,12 +34,12 @@
 namespace aspect
 {
 
-template <int dim>
-void Simulator<dim>::free_surface_execute()
-{
-  if (!parameters.free_surface_enabled)
-    return;
-  pcout << "FS: free_surface_execute()" << std::endl;
+  template <int dim>
+  void Simulator<dim>::free_surface_execute()
+  {
+    if (!parameters.free_surface_enabled)
+      return;
+    pcout << "FS: free_surface_execute()" << std::endl;
 
 
 
@@ -48,153 +48,153 @@
 
 
 
-  free_surface_displace_mesh();
-}
+    free_surface_displace_mesh();
+  }
 
-template <int dim>
-void Simulator<dim>::free_surface_make_constraints()
-{
-  if (!parameters.free_surface_enabled)
-    return;
-  pcout << "FS: free_surface_make_constraints()" << std::endl;
+  template <int dim>
+  void Simulator<dim>::free_surface_make_constraints()
+  {
+    if (!parameters.free_surface_enabled)
+      return;
+    pcout << "FS: free_surface_make_constraints()" << std::endl;
 
-mesh_constraints.clear();
+    mesh_constraints.clear();
 
 //Assert(we need a free surface)
 
-}
+  }
 
-template <int dim>
-void Simulator<dim>::free_surface_setup_dofs()
-{
-  if (!parameters.free_surface_enabled)
-    return;
-  pcout << "FS: free_surface_setup_dofs()" << std::endl;
+  template <int dim>
+  void Simulator<dim>::free_surface_setup_dofs()
+  {
+    if (!parameters.free_surface_enabled)
+      return;
+    pcout << "FS: free_surface_setup_dofs()" << std::endl;
 
-  // these live in the same FE as the velocity variable:
-  mesh_velocity.reinit(introspection.index_sets.system_partitioning, introspection.index_sets.system_relevant_partitioning, mpi_communicator);
-  old_mesh_velocity.reinit(introspection.index_sets.system_partitioning, introspection.index_sets.system_relevant_partitioning, mpi_communicator);
+    // these live in the same FE as the velocity variable:
+    mesh_velocity.reinit(introspection.index_sets.system_partitioning, introspection.index_sets.system_relevant_partitioning, mpi_communicator);
+    old_mesh_velocity.reinit(introspection.index_sets.system_partitioning, introspection.index_sets.system_relevant_partitioning, mpi_communicator);
 
 
-  free_surface_dof_handler.distribute_dofs(free_surface_fe);
+    free_surface_dof_handler.distribute_dofs(free_surface_fe);
 
-  pcout << "FS: n_dofs = " << free_surface_dof_handler.n_dofs() << std::endl;
+    pcout << "FS: n_dofs = " << free_surface_dof_handler.n_dofs() << std::endl;
 
-  // Renumber the DoFs hierarchical so that we get the
-  // same numbering if we resume the computation. This
-  // is because the numbering depends on the order the
-  // cells are created.
-  DoFRenumbering::hierarchical (free_surface_dof_handler);
+    // Renumber the DoFs hierarchical so that we get the
+    // same numbering if we resume the computation. This
+    // is because the numbering depends on the order the
+    // cells are created.
+    DoFRenumbering::hierarchical (free_surface_dof_handler);
 //  DoFRenumbering::component_wise (free_surface_dof_handler,
 //      introspection.components_to_blocks);
 
 
 
-  mesh_locally_owned = free_surface_dof_handler.locally_owned_dofs();
-  DoFTools::extract_locally_relevant_dofs (free_surface_dof_handler,
-      mesh_locally_relevant);
+    mesh_locally_owned = free_surface_dof_handler.locally_owned_dofs();
+    DoFTools::extract_locally_relevant_dofs (free_surface_dof_handler,
+                                             mesh_locally_relevant);
 
-  mesh_vertices.reinit(mesh_locally_owned, mesh_locally_relevant, mpi_communicator);
-  //if we are just starting, we need to initialize mesh_vertices
-   if(this->timestep_number == 0)
-   {
-       pcout << "FS: get initial mesh vertices" << std::endl;
+    mesh_vertices.reinit(mesh_locally_owned, mesh_locally_relevant, mpi_communicator);
+    //if we are just starting, we need to initialize mesh_vertices
+    if (this->timestep_number == 0)
+      {
+        pcout << "FS: get initial mesh vertices" << std::endl;
 
-     LinearAlgebra::Vector distributed_mesh_vertices;
-     distributed_mesh_vertices.reinit(mesh_locally_owned, mpi_communicator);
+        LinearAlgebra::Vector distributed_mesh_vertices;
+        distributed_mesh_vertices.reinit(mesh_locally_owned, mpi_communicator);
 
-     const std::vector<Point<dim> > mesh_support_points
-       = free_surface_fe.base_element(0).get_unit_support_points();
-     FEValues<dim> mesh_points (mapping, free_surface_fe,
-         mesh_support_points, update_quadrature_points);
-     std::vector<unsigned int> cell_dof_indices (free_surface_fe.dofs_per_cell);
+        const std::vector<Point<dim> > mesh_support_points
+          = free_surface_fe.base_element(0).get_unit_support_points();
+        FEValues<dim> mesh_points (mapping, free_surface_fe,
+                                   mesh_support_points, update_quadrature_points);
+        std::vector<unsigned int> cell_dof_indices (free_surface_fe.dofs_per_cell);
 
-     typename DoFHandler<dim>::active_cell_iterator cell = free_surface_dof_handler.begin_active(),
-                                                    endc = free_surface_dof_handler.end();
-     for(; cell != endc; ++cell)
-       if(cell->is_locally_owned())
-       {
-         mesh_points.reinit(cell);
-         cell->get_dof_indices (cell_dof_indices);
-         for(unsigned int j=0; j<free_surface_fe.base_element(0).dofs_per_cell; ++j)
-           for(unsigned int dir=0; dir<dim; ++dir)
-           {
-              unsigned int support_point_index
-                 = free_surface_fe.component_to_system_index(/*velocity component=*/ dir,
-                                                            /*dof index within component=*/ j);
-             distributed_mesh_vertices[cell_dof_indices[support_point_index]] = mesh_points.quadrature_point(j)[dir];
-           }
-       }
+        typename DoFHandler<dim>::active_cell_iterator cell = free_surface_dof_handler.begin_active(),
+                                                       endc = free_surface_dof_handler.end();
+        for (; cell != endc; ++cell)
+          if (cell->is_locally_owned())
+            {
+              mesh_points.reinit(cell);
+              cell->get_dof_indices (cell_dof_indices);
+              for (unsigned int j=0; j<free_surface_fe.base_element(0).dofs_per_cell; ++j)
+                for (unsigned int dir=0; dir<dim; ++dir)
+                  {
+                    unsigned int support_point_index
+                      = free_surface_fe.component_to_system_index(/*velocity component=*/ dir,
+                                                                                          /*dof index within component=*/ j);
+                    distributed_mesh_vertices[cell_dof_indices[support_point_index]] = mesh_points.quadrature_point(j)[dir];
+                  }
+            }
 
-     distributed_mesh_vertices.compress(VectorOperation::insert);
-     mesh_vertices = distributed_mesh_vertices;
-   }
+        distributed_mesh_vertices.compress(VectorOperation::insert);
+        mesh_vertices = distributed_mesh_vertices;
+      }
 
-  free_surface_make_constraints();
+    free_surface_make_constraints();
 
-  // matrix
-  {
-    mesh_matrix.clear ();
+    // matrix
+    {
+      mesh_matrix.clear ();
 
-    Table<2,DoFTools::Coupling> coupling (dim, dim);
-    coupling.fill(DoFTools::none);
+      Table<2,DoFTools::Coupling> coupling (dim, dim);
+      coupling.fill(DoFTools::none);
 
       for (unsigned int c=0; c<dim; ++c)
-          coupling[c][c] = DoFTools::always;
+        coupling[c][c] = DoFTools::always;
 
 #ifdef USE_PETSC
-    LinearAlgebra::CompressedSparsityPattern sp(error);
+      LinearAlgebra::CompressedSparsityPattern sp(error);
 
 #else
-    TrilinosWrappers::SparsityPattern sp (mesh_locally_owned,mesh_locally_owned,
-                                               mpi_communicator);
+      TrilinosWrappers::SparsityPattern sp (mesh_locally_owned,mesh_locally_owned,
+                                            mpi_communicator);
 #endif
 
-    DoFTools::make_sparsity_pattern (free_surface_dof_handler,
-                                     coupling, sp,
-                                     mesh_constraints, false,
-                                     Utilities::MPI::
-                                     this_mpi_process(mpi_communicator));
+      DoFTools::make_sparsity_pattern (free_surface_dof_handler,
+                                       coupling, sp,
+                                       mesh_constraints, false,
+                                       Utilities::MPI::
+                                       this_mpi_process(mpi_communicator));
 
 #ifdef USE_PETSC
-    SparsityTools::distribute_sparsity_pattern(sp,
-        free_surface_dof_handler.locally_owned_dofs_per_processor(),
-        mpi_communicator, mesh_locally_relevant);
+      SparsityTools::distribute_sparsity_pattern(sp,
+                                                 free_surface_dof_handler.locally_owned_dofs_per_processor(),
+                                                 mpi_communicator, mesh_locally_relevant);
 
-    sp.compress();
+      sp.compress();
 
-    mesh_matrix.reinit (mesh_locally_owned, mesh_locally_owned, sp, mpi_communicator);
+      mesh_matrix.reinit (mesh_locally_owned, mesh_locally_owned, sp, mpi_communicator);
 #else
-    sp.compress();
+      sp.compress();
 
-    mesh_matrix.reinit (sp);
+      mesh_matrix.reinit (sp);
 #endif
 
-  }
+    }
 
 
-}
+  }
 
-template <int dim>
-void Simulator<dim>::free_surface_displace_mesh()
-{
-  pcout << "FS: free_surface_displace_mesh()" << std::endl;
+  template <int dim>
+  void Simulator<dim>::free_surface_displace_mesh()
+  {
+    pcout << "FS: free_surface_displace_mesh()" << std::endl;
 
-  typename DoFHandler<dim>::active_cell_iterator  cell = free_surface_dof_handler.begin_active(),
-                                                     endc = free_surface_dof_handler.end();
+    typename DoFHandler<dim>::active_cell_iterator  cell = free_surface_dof_handler.begin_active(),
+                                                    endc = free_surface_dof_handler.end();
 
-     for(cell = free_surface_dof_handler.begin_active(); cell != endc; ++cell)
-       if(cell->is_artificial() == false)
-         for(unsigned int vertex_no = 0; vertex_no < GeometryInfo<dim>::vertices_per_cell; ++vertex_no)
-         {
-           Point<dim> &v=cell->vertex(vertex_no);
-           for (unsigned int dir=0; dir<dim; ++dir)
-             v(dir) = mesh_vertices(
-                 cell->vertex_dof_index(vertex_no, dir)
-                     ); //enforce the vertex position
-         }
+    for (cell = free_surface_dof_handler.begin_active(); cell != endc; ++cell)
+      if (cell->is_artificial() == false)
+        for (unsigned int vertex_no = 0; vertex_no < GeometryInfo<dim>::vertices_per_cell; ++vertex_no)
+          {
+            Point<dim> &v=cell->vertex(vertex_no);
+            for (unsigned int dir=0; dir<dim; ++dir)
+              v(dir) = mesh_vertices(
+                         cell->vertex_dof_index(vertex_no, dir)
+                       ); //enforce the vertex position
+          }
 
-}
+  }
 
 }
 


More information about the CIG-COMMITS mailing list