Dear Bruno, Daniel and all,

Thank you so much for all of your help. 

I finally made out my code. But it still has something wrong with the 
DataOut part, perhaps I made some mistakes with the DataPostprocessor when 
using it for output postprocessing. Here is the code snippet, wherein the 
"StressPostprocessor" is a DataPostprocessor class I created for outputting 
stress, and the "displacement_solutions" is a vector I computed out in the 
prior steps. And the bold lines are where compiler says there is sth wrong 
with:

  template <int dim, int fe_degree>
  void PlaneStress<dim, fe_degree>::output_displacement_and_stress_solutions
(unsigned int current_time_step)
  {
      std::vector<DataComponentInterpretation::DataComponentInterpretation>
      data_component_interpretation (dim, DataComponentInterpretation::
component_is_part_of_vector);

      DataOut<dim> u_data;
      std::string displacement_filename = "displacement_solution_"
                                          + Utilities::int_to_string(
current_time_step)
                                          + ".vtk";
      u_data.attach_dof_handler (dof_handler);
      *u_data.add_data_vector (displacement_solutions,*
                              std::string("displacement_solution_")
                                + Utilities::int_to_string(current_time_step
),
                                DataOut<dim>::type_dof_data,
                                data_component_interpretation);
      std::ofstream u_output_stream (displacement_filename.c_str());
      u_data.write_vtk(u_output_stream);
      u_output_stream.close();

      DataOut<dim> stress_data;
      std::string stress_filename = "stress_solution_"
                                    + Utilities::int_to_string(
current_time_step)
                                    + ".vtk";
      stress_data.attach_dof_handler (dof_handler);
      *StressPostprocessor<dim> stress_out;*
      *stress_data.add_data_vector(displacement_solutions, stress_out);*
      stress_data.build_patches ();
      std::ofstream stess_output_stream (stress_filename.c_str());
      stress_data.write_vtk (stess_output_stream);
      stess_output_stream.close();
  }

And the error message on this part of code is:

error: undefined reference to 'void 
dealii::DataOut_DoFData<dealii::DoFHandler<2, 2>, 2, 
2>::add_data_vector<std::vector<double, std::allocator<double> > 
>(std::vector<double, std::allocator<double> > const&, std::string const&, 
dealii::DataOut_DoFData<dealii::DoFHandler<2, 2>, 2, 2>::DataVectorType, 
std::vector<dealii::DataComponentInterpretation::DataComponentInterpretation, 
std::allocator<dealii::DataComponentInterpretation::DataComponentInterpretation>
 
> const&)'

error: undefined reference to 
'PlaneStress::StressPostprocessor<2>::StressPostprocessor()'

error: undefined reference to 'void 
dealii::DataOut_DoFData<dealii::DoFHandler<2, 2>, 2, 
2>::add_data_vector<std::vector<double, std::allocator<double> > 
>(std::vector<double, std::allocator<double> > const&, 
dealii::DataPostprocessor<2> const&)'
collect2: error: ld returned 1 exit status


I can't get any hint from this error message. Someone please help. Thanks 
so much!

Best regard,
David


-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to