From: guido Date: Tue, 22 Feb 2000 17:55:28 +0000 (+0000) Subject: oops X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=929ccdd618c185c254ec3d6ec0d05dac09e9a4f6;p=dealii-svn.git oops git-svn-id: https://svn.dealii.org/trunk@2470 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/source/convergence_table.cc b/deal.II/base/source/convergence_table.cc index bf4d181cfd..d94a2fa5fa 100644 --- a/deal.II/base/source/convergence_table.cc +++ b/deal.II/base/source/convergence_table.cc @@ -12,6 +12,7 @@ //---------------------------- convergence_table.cc --------------------------- +#include #include diff --git a/deal.II/base/source/data_out_base.all_dimensions.cc b/deal.II/base/source/data_out_base.all_dimensions.cc index 6a0a13b029..1467e4097f 100644 --- a/deal.II/base/source/data_out_base.all_dimensions.cc +++ b/deal.II/base/source/data_out_base.all_dimensions.cc @@ -12,6 +12,7 @@ //---------------------------- data_out_base.all_dimensions.cc --------------------------- +#include #include diff --git a/deal.II/base/source/data_out_base.cc b/deal.II/base/source/data_out_base.cc index 707e3c7dd6..b3ffdf6dbc 100644 --- a/deal.II/base/source/data_out_base.cc +++ b/deal.II/base/source/data_out_base.cc @@ -12,7 +12,730 @@ //---------------------------- data_out_base.cc --------------------------- -#include \"data.inc\" " << endl; +#include +#include +#include +#include +#include +#include + + +// egcs does not understand this at present. +// +// template +// DataOut::Patch::Patch () : +// n_subdivisions (1) +// // all the rest has a constructor of its own +// {}; + + +template +void DataOutBase::write_ucd (const vector > &patches, + const vector &data_names, + const UcdFlags &flags, + ostream &out) +{ + AssertThrow (out, ExcIO()); + + Assert (patches.size() > 0, ExcNoPatches()); + + const unsigned int n_data_sets = data_names.size(); + + // first count the number of cells + // and cells for later use + unsigned int n_cells = 0, + n_nodes = 0; + for (vector >::const_iterator patch=patches.begin(); + patch!=patches.end(); ++patch) + switch (dim) + { + case 1: + n_cells += patch->n_subdivisions; + n_nodes += patch->n_subdivisions+1; + break; + case 2: + n_cells += patch->n_subdivisions * + patch->n_subdivisions; + n_nodes += (patch->n_subdivisions+1) * + (patch->n_subdivisions+1); + break; + case 3: + n_cells += patch->n_subdivisions * + patch->n_subdivisions * + patch->n_subdivisions; + n_nodes += (patch->n_subdivisions+1) * + (patch->n_subdivisions+1) * + (patch->n_subdivisions+1); + break; + default: + Assert (false, ExcNotImplemented()); + }; + + /////////////////////// + // preamble + if (flags.write_preamble) + { + time_t time1= time (0); + tm *time = localtime(&time1); + out << "# This file was generated by the deal.II library." << endl + << "# Date = " + << time->tm_year+1900 << "/" + << time->tm_mon+1 << "/" + << time->tm_mday << endl + << "# Time = " + << time->tm_hour << ":" + << setw(2) << time->tm_min << ":" + << setw(2) << time->tm_sec << endl + << "#" << endl + << "# For a description of the UCD format see the AVS Developer's guide." + << endl + << "#" << endl; + }; + + // start with ucd data + out << n_nodes << ' ' + << n_cells << ' ' + << n_data_sets << ' ' + << 0 << ' ' // no cell data at present + << 0 // no model data + << endl; + + /////////////////////////////// + // first make up the list of used + // nodes along with their + // coordinates. number them + // consecutively starting with 1 + // + // note that we have to print + // d=1..3 dimensions + if (true) + { + unsigned int present_node = 1; + + for (vector >::const_iterator patch=patches.begin(); + patch!=patches.end(); ++patch) + { + const unsigned int n_subdivisions = patch->n_subdivisions; + + // if we have nonzero values for + // this coordinate + switch (dim) + { + case 1: + { + for (unsigned int i=0; ivertices[1](0) * i / n_subdivisions) + + (patch->vertices[0](0) * (n_subdivisions-i) / n_subdivisions)) + << " 0 0\n"; // fill with zeroes + break; + }; + + case 2: + { + for (unsigned int i=0; ivertices[1] * x_frac) + + (patch->vertices[0] * (1-x_frac))) * (1-y_frac) + + ((patch->vertices[2] * x_frac) + + (patch->vertices[3] * (1-x_frac))) * y_frac) + << " 0\n"; // fill with zeroes + + ++present_node; + }; + + break; + }; + + case 3: + { + for (unsigned int i=0; ivertices[1] * x_frac) + + (patch->vertices[0] * (1-x_frac))) * (1-y_frac) + + ((patch->vertices[2] * x_frac) + + (patch->vertices[3] * (1-x_frac))) * y_frac) * (1-z_frac) + + (((patch->vertices[5] * x_frac) + + (patch->vertices[4] * (1-x_frac))) * (1-y_frac) + + ((patch->vertices[6] * x_frac) + + (patch->vertices[7] * (1-x_frac))) * y_frac) * z_frac) + << endl; + + ++present_node; + }; + + break; + }; + + default: + Assert (false, ExcNotImplemented()); + }; + }; + + // note that we number starting with 1! + Assert (present_node == n_nodes+1, + ExcInternalError()); + }; + + ///////////////////////////////////////// + // write cell. number them consecutively, + // starting with 1 + if (true) + { + unsigned int present_cell = 1; + unsigned int first_vertex_of_patch = 0; + + for (vector >::const_iterator patch=patches.begin(); + patch!=patches.end(); ++patch) + { + const unsigned int n_subdivisions = patch->n_subdivisions; + + // write out the cells making + // up this patch + switch (dim) + { + case 1: + { + for (unsigned int i=0; i >::const_iterator patch=patches.begin(); + patch != patches.end(); ++patch) + { + const unsigned int n_subdivisions = patch->n_subdivisions; + + Assert (patch->data.m() == n_data_sets, + ExcUnexpectedNumberOfDatasets (patch->data.m(), n_data_sets)); + Assert (patch->data.n() == (dim==1 ? + n_subdivisions+1 : + (dim==2 ? + (n_subdivisions+1)*(n_subdivisions+1) : + (dim==3 ? + (n_subdivisions+1)*(n_subdivisions+1)*(n_subdivisions+1) : + 0))), + ExcInvalidDatasetSize (patch->data.n(), n_subdivisions+1)); + + switch (dim) + { + case 1: + { + for (unsigned int i=0; idata(data_set,i) << ' '; + + out << endl; + }; + + break; + }; + + case 2: + { + for (unsigned int i=0; idata(data_set,i*(n_subdivisions+1) + j) << ' '; + + out << endl; + + ++present_node; + }; + + break; + }; + + case 3: + { + for (unsigned int i=0; idata(data_set, + (i*(n_subdivisions+1)+j)*(n_subdivisions+1)+k) + << ' '; + + out << endl; + + ++present_node; + }; + + break; + }; + + default: + Assert (false, ExcNotImplemented()); + }; + }; + }; + + // no model data + + // assert the stream is still ok + AssertThrow (out, ExcIO()); +}; + + +template +void DataOutBase::write_gnuplot (const vector > &patches, + const vector &data_names, + const GnuplotFlags &/*flags*/, + ostream &out) +{ + AssertThrow (out, ExcIO()); + + Assert (patches.size() > 0, ExcNoPatches()); + + const unsigned int n_data_sets = data_names.size(); + + // write preamble + if (true) + { + // block this to have local + // variables destroyed after + // use + const time_t time1= time (0); + const tm *time = localtime(&time1); + out << "# This file was generated by the deal.II library." << endl + << "# Date = " + << time->tm_year+1900 << "/" + << time->tm_mon+1 << "/" + << time->tm_mday << endl + << "# Time = " + << time->tm_hour << ":" + << setw(2) << time->tm_min << ":" + << setw(2) << time->tm_sec << endl + << "#" << endl + << "# For a description of the GNUPLOT format see the GNUPLOT manual." + << endl + << "#" << endl + << "# "; + + switch (dim) + { + case 1: + out << " "; + break; + case 2: + out << " "; + break; + case 3: + out << " "; + break; + + default: + Assert (false, ExcNotImplemented()); + }; + + for (unsigned int i=0; i "; + out << endl; + }; + + +// loop over all patches + for (typename vector >::const_iterator patch=patches.begin(); + patch != patches.end(); ++patch) + { + const unsigned int n_subdivisions = patch->n_subdivisions; + + Assert (patch->data.m() == n_data_sets, + ExcUnexpectedNumberOfDatasets (patch->data.m(), n_data_sets)); + Assert (patch->data.n() == (dim==1 ? + n_subdivisions+1 : + (dim==2 ? + (n_subdivisions+1)*(n_subdivisions+1) : + (dim==3 ? + (n_subdivisions+1)*(n_subdivisions+1)*(n_subdivisions+1) : + 0))), + ExcInvalidDatasetSize (patch->data.n(), n_subdivisions+1)); + + switch (dim) + { + case 1: + { + for (unsigned int i=0; ivertices[1] * i / n_subdivisions) + + (patch->vertices[0] * (n_subdivisions-i) / n_subdivisions)) + << ' '; + + for (unsigned int data_set=0; data_setdata(data_set,i) << ' '; + + out << endl; + }; + + // end of patch + out << endl + << endl; + + break; + }; + + case 2: + { + for (unsigned int i=0; ivertices[1] * x_frac) + + (patch->vertices[0] * (1-x_frac))) * (1-y_frac) + + ((patch->vertices[2] * x_frac) + + (patch->vertices[3] * (1-x_frac))) * y_frac) + << ' '; + + for (unsigned int data_set=0; data_setdata(data_set,i*(n_subdivisions+1) + j) << ' '; + + out << endl; + }; + + // end of row in patch + out << endl; + }; + + // end of patch + out << endl; + + break; + }; + + case 3: + { + // for all grid points: draw + // lines into all positive + // coordinate directions if + // there is another grid point + // there + for (unsigned int i=0; i this_point + = ((((patch->vertices[1] * x_frac) + + (patch->vertices[0] * (1-x_frac))) * (1-y_frac) + + ((patch->vertices[2] * x_frac) + + (patch->vertices[3] * (1-x_frac))) * y_frac) * (1-z_frac) + + (((patch->vertices[5] * x_frac) + + (patch->vertices[4] * (1-x_frac))) * (1-y_frac) + + ((patch->vertices[6] * x_frac) + + (patch->vertices[7] * (1-x_frac))) * y_frac) * z_frac); + + // line into positive x-direction + // if possible + if (i < n_subdivisions) + { + // write point here + // and its data + out << this_point; + for (unsigned int data_set=0; data_setdata(data_set, + (i*(n_subdivisions+1) + j)*(n_subdivisions+1)+k); + out << endl; + + // write point there + // and its data + const double x_frac_new = x_frac + 1./n_subdivisions; + out << ((((patch->vertices[1] * x_frac_new) + + (patch->vertices[0] * (1-x_frac_new))) * (1-y_frac) + + ((patch->vertices[2] * x_frac_new) + + (patch->vertices[3] * (1-x_frac_new))) * y_frac) * (1-z_frac) + + (((patch->vertices[5] * x_frac_new) + + (patch->vertices[4] * (1-x_frac_new))) * (1-y_frac) + + ((patch->vertices[6] * x_frac_new) + + (patch->vertices[7] * (1-x_frac_new))) * y_frac) * z_frac); + for (unsigned int data_set=0; data_setdata(data_set, + ((i+1)*(n_subdivisions+1) + j)*(n_subdivisions+1)+k); + out << endl; + + // end of line + out << endl + << endl; + }; + + // line into positive y-direction + // if possible + if (j < n_subdivisions) + { + // write point here + // and its data + out << this_point; + for (unsigned int data_set=0; data_setdata(data_set, + (i*(n_subdivisions+1) + j)*(n_subdivisions+1)+k); + out << endl; + + // write point there + // and its data + const double z_frac_new = z_frac + 1./n_subdivisions; + out << ((((patch->vertices[1] * x_frac) + + (patch->vertices[0] * (1-x_frac))) * (1-y_frac) + + ((patch->vertices[2] * x_frac) + + (patch->vertices[3] * (1-x_frac))) * y_frac) * (1-z_frac_new) + + (((patch->vertices[5] * x_frac) + + (patch->vertices[4] * (1-x_frac))) * (1-y_frac) + + ((patch->vertices[6] * x_frac) + + (patch->vertices[7] * (1-x_frac))) * y_frac) * z_frac_new); + for (unsigned int data_set=0; data_setdata(data_set, + (i*(n_subdivisions+1) + (j+1))*(n_subdivisions+1)+k); + out << endl; + + // end of line + out << endl + << endl; + }; + + // line into positive z-direction + // if possible + if (k < n_subdivisions) + { + // write point here + // and its data + out << this_point; + for (unsigned int data_set=0; data_setdata(data_set, + (i*(n_subdivisions+1) + j)*(n_subdivisions+1)+k); + out << endl; + + // write point there + // and its data + const double y_frac_new = y_frac + 1./n_subdivisions; + out << ((((patch->vertices[1] * x_frac) + + (patch->vertices[0] * (1-x_frac))) * (1-y_frac_new) + + ((patch->vertices[2] * x_frac) + + (patch->vertices[3] * (1-x_frac))) * y_frac_new) * (1-z_frac) + + (((patch->vertices[5] * x_frac) + + (patch->vertices[4] * (1-x_frac))) * (1-y_frac_new) + + ((patch->vertices[6] * x_frac) + + (patch->vertices[7] * (1-x_frac))) * y_frac_new) * z_frac); + for (unsigned int data_set=0; data_setdata(data_set, + (i*(n_subdivisions+1) + j)*(n_subdivisions+1)+k+1); + out << endl; + + // end of line + out << endl + << endl; + }; + + }; + + break; + }; + + default: + Assert (false, ExcNotImplemented()); + }; + }; + + AssertThrow (out, ExcIO()); +}; + + +template +void DataOutBase::write_povray (const vector > &patches, + const vector &data_names, + const PovrayFlags &flags, + ostream &out) +{ + AssertThrow (out, ExcIO()); + + Assert (patches.size() > 0, ExcNoPatches()); + Assert (dim==2, ExcNotImplemented()); // only for 2-D + + const unsigned int n_data_sets = data_names.size(); + + // write preamble + if (true) + { + // block this to have local + // variables destroyed after use + const time_t time1= time (0); + const tm *time = localtime(&time1); + out << "/* This file was generated by the deal.II library." << endl + << " Date = " + << time->tm_year+1900 << "/" + << time->tm_mon+1 << "/" + << time->tm_mday << endl + << " Time = " + << time->tm_hour << ":" + << setw(2) << time->tm_min << ":" + << setw(2) << time->tm_sec << endl + << endl + << " For a description of the POVRAY format see the POVRAY manual." + << endl + << "*/ " << endl; + + // include files + out << "#include \"colors.inc\" " << endl + << "#include \"textures.inc\" " << endl; + + +// use external include file for textures, + // camera and light + if (flags.external_data) + out << "#include \"data.inc\" " << endl; else // all definitions in data file { // camera diff --git a/deal.II/base/source/exceptions.cc b/deal.II/base/source/exceptions.cc index e5109b1a39..2cff5a7e34 100644 --- a/deal.II/base/source/exceptions.cc +++ b/deal.II/base/source/exceptions.cc @@ -12,6 +12,8 @@ //---------------------------- exceptions.cc --------------------------- +#include +#include #include diff --git a/deal.II/base/source/function.cc b/deal.II/base/source/function.cc index 794d994b6a..244b0c6d1f 100644 --- a/deal.II/base/source/function.cc +++ b/deal.II/base/source/function.cc @@ -12,6 +12,9 @@ //---------------------------- function.cc --------------------------- +#include +#include +#include #include diff --git a/deal.II/base/source/function_lib.cc b/deal.II/base/source/function_lib.cc index 9a5a142db8..d5df1d87ca 100644 --- a/deal.II/base/source/function_lib.cc +++ b/deal.II/base/source/function_lib.cc @@ -12,6 +12,9 @@ //---------------------------- function_lib.cc --------------------------- +#include +#include + #include //TODO: Derivatives in 3d wrong (GK!) diff --git a/deal.II/base/source/job_identifier.cc b/deal.II/base/source/job_identifier.cc index 4fe1a81369..3bbc1df6e0 100644 --- a/deal.II/base/source/job_identifier.cc +++ b/deal.II/base/source/job_identifier.cc @@ -12,6 +12,7 @@ //---------------------------- job_identifier.cc --------------------------- +#include #include diff --git a/deal.II/base/source/log.cc b/deal.II/base/source/log.cc index dfc27ff29a..a799ae2b1e 100644 --- a/deal.II/base/source/log.cc +++ b/deal.II/base/source/log.cc @@ -12,6 +12,10 @@ //---------------------------- log.cc --------------------------- +#include +#include + +#include #include LogStream deallog; diff --git a/deal.II/base/source/parameter_handler.cc b/deal.II/base/source/parameter_handler.cc index c602aab557..d70ae47a54 100644 --- a/deal.II/base/source/parameter_handler.cc +++ b/deal.II/base/source/parameter_handler.cc @@ -12,6 +12,12 @@ //---------------------------- parameter_handler.cc --------------------------- +#include +#include +#include +#include +#include +#include #include diff --git a/deal.II/base/source/quadrature.cc b/deal.II/base/source/quadrature.cc index 65afff7526..6c817780a5 100644 --- a/deal.II/base/source/quadrature.cc +++ b/deal.II/base/source/quadrature.cc @@ -12,6 +12,7 @@ //---------------------------- quadrature.cc --------------------------- +#include #include diff --git a/deal.II/base/source/quadrature_lib.cc b/deal.II/base/source/quadrature_lib.cc index 30117523b1..b4bc6549f3 100644 --- a/deal.II/base/source/quadrature_lib.cc +++ b/deal.II/base/source/quadrature_lib.cc @@ -12,6 +12,7 @@ //---------------------------- quadrature_lib.cc --------------------------- +#include #include diff --git a/deal.II/base/source/table_handler.cc b/deal.II/base/source/table_handler.cc index 32f3688277..6b2eea8517 100644 --- a/deal.II/base/source/table_handler.cc +++ b/deal.II/base/source/table_handler.cc @@ -12,6 +12,9 @@ //---------------------------- table_handler.cc --------------------------- +#include + +#include #include diff --git a/deal.II/base/source/tensor.cc b/deal.II/base/source/tensor.cc index 74d5b2ebf1..bcab0b9673 100644 --- a/deal.II/base/source/tensor.cc +++ b/deal.II/base/source/tensor.cc @@ -12,6 +12,8 @@ //---------------------------- tensor.cc --------------------------- +#include +#include #include diff --git a/deal.II/base/source/tensor_function.cc b/deal.II/base/source/tensor_function.cc index 6fc4e4fdb2..a625d9b79f 100644 --- a/deal.II/base/source/tensor_function.cc +++ b/deal.II/base/source/tensor_function.cc @@ -12,6 +12,10 @@ //---------------------------- tensor_function.cc --------------------------- +#include +#include +#include +#include #include diff --git a/deal.II/base/source/timer.cc b/deal.II/base/source/timer.cc index 9c17fd9573..c87e0bd688 100644 --- a/deal.II/base/source/timer.cc +++ b/deal.II/base/source/timer.cc @@ -12,6 +12,12 @@ //---------------------------- timer.cc --------------------------- +#include + + +// these includes should probably be properly +// ./configure'd using the AC_HEADER_TIME macro: +#include #include Timer::Timer()