//outputResults() method for MatrixFreePDE class
#include "../../include/matrixFreePDE.h"
#include <deal.II/numerics/data_out.h>
//output results
template <int dim, int degree>
void MatrixFreePDE<dim,degree>::outputResults() {
//log time
computing_timer.enter_section("matrixFreePDE: output");
//create DataOut object
DataOut<dim> data_out;
//loop over fields
for(unsigned int fieldIndex=0; fieldIndex<fields.size(); fieldIndex++){
//mark field as scalar/vector
std::vector<DataComponentInterpretation::DataComponentInterpretation> dataType \
(fields[fieldIndex].numComponents, \
(fields[fieldIndex].type==SCALAR ? \
DataComponentInterpretation::component_is_scalar: \
DataComponentInterpretation::component_is_part_of_vector));
//add field to data_out
std::vector<std::string> solutionNames (fields[fieldIndex].numComponents, fields[fieldIndex].name.c_str());
data_out.add_data_vector(*dofHandlersSet[fieldIndex], *solutionSet[fieldIndex], solutionNames, dataType);
}
data_out.build_patches (degree);
//write to results file
//file name
std::ostringstream cycleAsString;
cycleAsString << std::setw(std::floor(std::log10(userInputs.totalIncrements))+1) << std::setfill('0') << currentIncrement;
char baseFileName[100], vtuFileName[100];
sprintf(baseFileName, "%s-%s", userInputs.output_file_name.c_str(), cycleAsString.str().c_str());
sprintf(vtuFileName, "%s.%u.%s", baseFileName,Utilities::MPI::this_mpi_process(MPI_COMM_WORLD),userInputs.output_file_type.c_str());
// Write to file in either vtu or vtk format
if (userInputs.output_file_type == "vtu"){
// Set flags to output the time and cycle number as part of the vtu file
dealii::DataOutBase::VtkFlags flags;
flags.time = currentTime;
flags.cycle = currentIncrement;
flags.print_date_and_time = true;
data_out.set_flags(flags);
// Write the results to a file shared between all processes
char svtuFileName[100];
sprintf(svtuFileName, "%s.%s", baseFileName ,userInputs.output_file_type.c_str());
data_out.write_vtu_in_parallel(svtuFileName, MPI_COMM_WORLD);
pcout << "Output written to:" << svtuFileName << "\n\n";
}
//log time
computing_timer.exit_section("matrixFreePDE: output");
}
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/CAMRj59E1v%2BN3%3DXfmqLPV3NX_hhNuG_zwoMsejs_2b_6CL1Grng%40mail.gmail.com.