~kroq-gar78/ubuntu/precise/meep/fix-990137

« back to all changes in this revision

Viewing changes to tests/bench.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Thorsten Alteholz
  • Date: 2009-10-29 18:00:00 UTC
  • mfrom: (2.2.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091029180000-wekpivz2ct4sggty
Tags: 1.1.1-3
* debian/rules: change configure script to produce meep-mpi paths
                everywhere (closes: #551822)
* debian/control: DM-Upload-Allowed added

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2005-2008 Massachusetts Institute of Technology  
 
1
/* Copyright (C) 2005-2009 Massachusetts Institute of Technology  
2
2
%
3
3
%  This program is free software; you can redistribute it and/or modify
4
4
%  it under the terms of the GNU General Public License as published by
23
23
 
24
24
double one(const vec &) { return 1.0; }
25
25
static double width = 20.0;
26
 
double bump(const vec &v) { return (fabs(v.z()-50.0) > width)?1.0:12.0; }
 
26
double bump(const vec &pt) { return (fabs(pt.z()-50.0) > width)?1.0:12.0; }
27
27
 
28
28
struct bench {
29
29
  double time; // In seconds.
37
37
  const double ttot = 5.0 + 1e5/gridpts;
38
38
  const int m = 0;
39
39
 
40
 
  volume v = volcyl(rmax,zmax,a);
41
 
  structure s(v, eps);
 
40
  grid_volume gv = volcyl(rmax,zmax,a);
 
41
  structure s(gv, eps);
42
42
  fields f(&s, m);
43
43
  f.use_bloch(0.0);
44
44
  f.add_point_source(Ep, 0.7, 2.5, 0.0, 4.0, veccyl(0.5, 0.4), 1.0);
59
59
  const double gridpts = a*zmax;
60
60
  const double ttot = 10.0 + 1e5/zmax;
61
61
 
62
 
  volume v = volone(zmax,a);
63
 
  structure s(v, eps, pml(zmax/6));
 
62
  grid_volume gv = volone(zmax,a);
 
63
  structure s(gv, eps, pml(zmax/6));
64
64
 
65
65
  fields f(&s);
66
66
  f.use_real_fields();
70
70
 
71
71
  while (f.time() <= f.last_source_time()) f.step();
72
72
 
73
 
  volume mid = volone(zmax/3,a);
 
73
  grid_volume mid = volone(zmax/3,a);
74
74
  mid.set_origin(vec(zmax/3));
75
75
  double flux_energy=0.0;
76
76
  double start = wall_time();
91
91
  const double gridpts = a*a*xmax*ymax;
92
92
  const double ttot = 5.0 + 1e5/gridpts;
93
93
 
94
 
  volume v = voltwo(xmax,ymax,a);
95
 
  structure s(v, eps);
 
94
  grid_volume gv = voltwo(xmax,ymax,a);
 
95
  structure s(gv, eps);
96
96
  fields f(&s);
97
97
  f.add_point_source(Ez, 0.8, 0.6, 0.0, 4.0, vec(0.401, 0.301));
98
98
  f.add_point_source(Hz, 0.8, 0.7, 0.0, 4.0, vec(0.431, 0.2));
116
116
  const double gridpts = a*a*xmax*ymax;
117
117
  const double ttot = 5.0 + te_tm_2d_time/gridpts;
118
118
 
119
 
  volume v = voltwo(xmax,ymax,a);
120
 
  structure s(v, eps);
 
119
  grid_volume gv = voltwo(xmax,ymax,a);
 
120
  structure s(gv, eps);
121
121
  s.set_chi3(eps);
122
122
  fields f(&s);
123
123
  f.add_point_source(Ez, 0.8, 0.6, 0.0, 4.0, vec(0.401, 0.301));
139
139
  const double gridpts = a*a*xmax*ymax;
140
140
  const double ttot = 5.0 + te_tm_2d_time/gridpts;
141
141
 
142
 
  volume v = voltwo(xmax,ymax,a);
143
 
  structure s(v, eps);
 
142
  grid_volume gv = voltwo(xmax,ymax,a);
 
143
  structure s(gv, eps);
144
144
  fields f(&s);
145
145
  f.add_point_source(Ez, 0.8, 0.6, 0.0, 4.0, vec(0.401, 0.301));
146
146
 
161
161
  const double gridpts = a*a*xmax*ymax;
162
162
  const double ttot = 5.0 + te_tm_2d_time/gridpts;
163
163
 
164
 
  volume v = voltwo(xmax,ymax,a);
165
 
  structure s(v, eps);
 
164
  grid_volume gv = voltwo(xmax,ymax,a);
 
165
  structure s(gv, eps);
166
166
  fields f(&s);
167
167
  f.add_point_source(Ex, 0.8, 0.6, 0.0, 4.0, vec(0.401, 0.301));
168
168
  f.add_point_source(Hz, 0.6, 0.6, 0.0, 4.0, vec(0.7, 0.5));
184
184
  const double gridpts = a*a*xmax*ymax;
185
185
  const double ttot = 5.0 + te_tm_2d_time/gridpts;
186
186
 
187
 
  volume v = voltwo(xmax,ymax,a);
188
 
  structure s(v, eps);
 
187
  grid_volume gv = voltwo(xmax,ymax,a);
 
188
  structure s(gv, eps);
189
189
  s.set_chi3(eps);
190
190
  fields f(&s);
191
191
  f.add_point_source(Ex, 0.8, 0.6, 0.0, 4.0, vec(0.401, 0.301));
218
218
  const double gridpts = a*a*a*max(xmax,1/a)*max(ymax,1/a)*max(zmax,1/a);
219
219
  const double ttot = 5.0 + 1e5/gridpts;
220
220
 
221
 
  volume v = vol3d(xmax,ymax,zmax,a);
222
 
  structure s(v, eps);
 
221
  grid_volume gv = vol3d(xmax,ymax,zmax,a);
 
222
  structure s(gv, eps);
223
223
  fields f(&s);
224
224
  if (xmax==0) f.use_bloch(X,0.0);
225
225
  if (ymax==0) f.use_bloch(Y,0.0);
243
243
  const double gridpts = a*a*a*xmax*ymax*zmax;
244
244
  const double ttot = 5.0 + 1e5/gridpts;
245
245
 
246
 
  volume v = vol3d(xmax,ymax,zmax,a);
247
 
  structure s(v, eps);
 
246
  grid_volume gv = vol3d(xmax,ymax,zmax,a);
 
247
  structure s(gv, eps);
248
248
  fields f(&s);
249
249
  f.add_point_source(Ez, 0.8, 0.6, 0.0, 4.0, vec(xmax*.5, ymax*.5, zmax*.5));
250
250