~ubuntu-branches/ubuntu/trusty/rheolef/trusty

« back to all changes in this revision

Viewing changes to nfem/ptst/field_iter_tst.cc

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito
  • Date: 2012-04-06 09:12:21 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120406091221-m58me99p1nxqui49
Tags: 6.0-1
* New upstream release 6.0 (major changes):
  - massively distributed and parallel support
  - full FEM characteristic method (Lagrange-Gakerkin method) support
  - enhanced users documentation 
  - source code supports g++-4.7 (closes: #667356)
* debian/control: dependencies for MPI distributed solvers added
* debian/rules: build commands simplified
* debian/librheolef-dev.install: man1/* to man9/* added
* debian/changelog: package description rewritted (closes: #661689)

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
size_t N;
26
26
Float f (const point& x) { return 1+(0.5/N)*(x[0]*(1-x[0])+x[1]*(1-x[1])+x[2]*(1-x[2])); }
27
27
int main(int argc, char**argv) {
28
 
  environment distributed(argc, argv);
 
28
  environment rheolef(argc, argv);
29
29
  geo omega (argv[1]);
30
30
  Float prec = (argc > 2) ? atof(argv[2]) : 1e-10;
31
31
  space Vh (omega, "P1");
32
32
  N = omega.dimension();
33
33
  field fh = interpolate(Vh, f);
34
34
  Float sum = 0;
35
 
  for (field::const_iterator iter = fh.begin(), last = fh.end(); iter != last; iter++) {
 
35
  for (field::const_iterator iter = fh.begin_dof(), last = fh.end_dof(); iter != last; iter++) {
36
36
      sum += sqr(*iter);
37
37
  }
38
38
#ifndef _RHEOLEF_HAVE_MPI
39
 
  dcout << "euclidian_norm(fh) = " << sqrt(sum) << endl;
 
39
  dout << "euclidian_norm(fh) = " << sqrt(sum) << endl;
40
40
#else // _RHEOLEF_HAVE_MPI
41
41
  Float dis_sum = mpi::all_reduce (fh.comm(), sum, std::plus<Float>());
42
 
  dcout << "euclidian_norm(fh) = " << sqrt(dis_sum) << endl;
 
42
  dout << "euclidian_norm(fh) = " << sqrt(dis_sum) << endl;
43
43
#endif // _RHEOLEF_HAVE_MPI
44
44
}