[cig-commits] commit 1956 by bangerth to /var/svn/dealii/aspect
dealii.demon at gmail.com
dealii.demon at gmail.com
Mon Oct 14 21:15:37 PDT 2013
Revision 1956
Actually create output. Not quite clear how this worked before.
U trunk/aspire/source/postprocess/visualization.cc
http://www.dealii.org/websvn/revision.php?repname=Aspect+Repository&path=%2F&rev=1956&peg=1956
Diff:
Modified: trunk/aspire/source/postprocess/visualization.cc
===================================================================
--- trunk/aspire/source/postprocess/visualization.cc 2013-10-15 04:06:53 UTC (rev 1955)
+++ trunk/aspire/source/postprocess/visualization.cc 2013-10-15 04:15:25 UTC (rev 1956)
@@ -101,9 +101,9 @@
{
mesh_changed = true;
}
-
-
-
+
+
+
template <int dim>
std::pair<std::string,std::string>
Visualization<dim>::execute (TableHandler &statistics)
@@ -122,77 +122,77 @@
FESystem<dim> fe_system (this->get_fe_velocity (), 1,
this->get_fe_advection (), 1 + this->n_compositional_fields ());
DoFHandler<dim> dof_handler (this->get_triangulation ());
-
+
dof_handler.distribute_dofs (fe_system);
-
+
// create a DataOut object on the heap; ownership of this
// object will later be transferred to a different thread
// that will write data in the background. the other thread
// will then also destroy the object
DataOut<dim> data_out;
-
+
data_out.attach_dof_handler (dof_handler);
// create joint solution
LinearAlgebra::Vector locally_relevant_solution;
-
+
{
const LinearAlgebra::BlockVector& solution_velocity = this->get_solution_velocity ();
const LinearAlgebra::Vector& solution_temperature = this->get_solution_temperature ();
const LinearAlgebra::BlockVector& solution_composition = this->get_solution_composition ();
LinearAlgebra::Vector solution;
-
+
solution.reinit (dof_handler.locally_owned_dofs (), this->get_mpi_communicator ());
-
+
std::vector<types::global_dof_index> cell_dof_indices (fe_system.dofs_per_cell);
std::vector<types::global_dof_index> cell_velocity_dof_indices (fe_system.base_element (0).dofs_per_cell);
std::vector<types::global_dof_index> cell_advection_dof_indices (fe_system.base_element (1).dofs_per_cell);
typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active ();
typename DoFHandler<dim>::active_cell_iterator cell_velocity = this->get_dof_handler_velocity ().begin_active ();
typename DoFHandler<dim>::active_cell_iterator cell_advection = this->get_dof_handler_advection ().begin_active ();
-
+
for (; cell != dof_handler.end (); ++cell, ++cell_velocity, ++cell_advection)
if (cell->is_locally_owned ())
{
cell->get_dof_indices (cell_dof_indices);
cell_velocity->get_dof_indices (cell_velocity_dof_indices);
cell_advection->get_dof_indices (cell_advection_dof_indices);
-
+
for (unsigned int i = 0; i < fe_system.dofs_per_cell; ++i)
{
const std::pair<std::pair<unsigned int, unsigned int>, unsigned int>& system_to_base_index
= fe_system.system_to_base_index (i);
-
+
if (system_to_base_index.first.first == 0)
solution (cell_dof_indices[i]) = solution_velocity (cell_velocity_dof_indices[system_to_base_index.second]);
-
+
else
if (system_to_base_index.first.second == 0)
solution (cell_dof_indices[i]) = solution_temperature (cell_advection_dof_indices[system_to_base_index.second]);
-
+
else
solution (cell_dof_indices[i])
= solution_composition.block (system_to_base_index.first.second - 1) (cell_advection_dof_indices[system_to_base_index.second]);
}
}
-
+
IndexSet locally_relevant_dofs (dof_handler.n_dofs ());
-
+
DoFTools::extract_locally_relevant_dofs (dof_handler, locally_relevant_dofs);
locally_relevant_solution.reinit (locally_relevant_dofs, this->get_mpi_communicator ());
locally_relevant_solution = solution;
}
-
+
// add the primary variables
std::vector<std::string> solution_names (dim, "velocity");
solution_names.push_back ("p");
solution_names.push_back ("T");
-
+
{
std::vector<std::string> composition_names (this->n_compositional_fields ());
-
+
this->get_material_model ().get_composition_names (composition_names);
-
+
for (unsigned int c = 0; c < this->n_compositional_fields (); ++c)
solution_names.push_back (composition_names[c]);
}
@@ -313,7 +313,7 @@
// version of deal.II, otherwise use the old data format
#if DEAL_II_VERSION_MAJOR*100 + DEAL_II_VERSION_MINOR > 800
DataOutBase::DataOutFilter data_filter(DataOutBase::DataOutFilterFlags(true, true));
-
+
// If the mesh changed since the last output, make a new mesh file
if (mesh_changed) last_mesh_file_name = mesh_file_prefix + ".h5";
data_out.write_filtered_data(data_filter);
@@ -335,7 +335,7 @@
this->get_mpi_communicator());
#endif
xdmf_entries.push_back(new_xdmf_entry);
- data_out.write_xdmf_file(xdmf_entries, xdmf_filename.c_str(),
+ data_out.write_xdmf_file(xdmf_entries, xdmf_filename.c_str(),
this->get_mpi_communicator ());
mesh_changed = false;
}
@@ -347,7 +347,7 @@
data_out.write_vtu_in_parallel((this->get_output_directory() + solution_file_prefix +
".vtu").c_str(),
this->get_mpi_communicator());
-
+
if (Utilities::MPI::this_mpi_process(this->get_mpi_communicator()) == 0)
{
std::vector<std::string> filenames;
@@ -390,6 +390,9 @@
vtk_flags.time = this->get_time();
#endif
data_out.set_flags (vtk_flags);
+
+ data_out.write (tmp, DataOutBase::parse_output_format(output_format));
+ file_contents = new std::string (tmp.str());
}
// let the master processor write the master record for all the distributed
@@ -750,7 +753,7 @@
// solution variables to compute what they compute
if (SimulatorAccess<dim> *x = dynamic_cast<SimulatorAccess<dim>*>(& **p))
x->initialize (simulator);
-
+
// Also set up a listener to check when the mesh changes
mesh_changed = true;
this->get_triangulation().signals.post_refinement.connect(std_cxx1x::bind(&Visualization::mesh_changed_signal, std_cxx1x::ref(*this)));
More information about the CIG-COMMITS
mailing list