~ubuntu-branches/ubuntu/wily/rheolef/wily

« back to all changes in this revision

Viewing changes to nfem/pbin/field.cc

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito, Pierre Saramito, Sylvestre Ledru
  • Date: 2013-04-30 11:29:51 UTC
  • mfrom: (1.2.1) (11.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130430112951-g69nuqin77t75dek
Tags: 6.4-1
[ Pierre Saramito ]
* New upstream release 6.4 (major changes):
  - new powerful c++ expressions for FEM specifications
  - configure script improved (portability increased)
  - minor bug fixes
* control:
  - all architectures are considered (armel & armhf are back)
  - no more circular-dependency librheolef-dev <--> rheolef
* rules: add security compiler flags (hardening and -W,-l,relro)
* watch: include an updated version, thanks to B. Martens <bartm@debian.org>
* copyright: various file format fixes

[ Sylvestre Ledru ]
*  Standards-Version updated to 3.9.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
INPUT FILE SPECIFICATION:
41
41
    @table @code
42
42
 
43
 
    @itemx @var{filename}
 
43
    @item @var{filename}
44
44
        specifies the name of the file containing
45
45
        the input field.
46
46
 
47
 
    @itemx -
 
47
    @item -
48
48
        read field on standard input instead on a file.
49
49
 
50
50
@cindex RHEOPATH environment variable
51
 
    @itemx -I@var{dir} 
 
51
    @item -I@var{dir} 
52
52
    @itemx -I @var{dir} 
53
53
        Add @var{dir} to the rheolef file search path.
54
54
        This option is usefull e.g. when the mesh .geo and the .field fikes are in
65
65
 
66
66
OUTPUT FILE FORMAT OPTIONS:
67
67
  @table @code
68
 
  @itemx -field
 
68
  @item -field
69
69
        output field on standard output stream in field text file format.
70
70
@toindex @code{gmsh}
71
71
@fiindex @file{.gmsh} mesh file
72
72
@fiindex @file{.gmsh_pos} data file
73
 
  @itemx -gmsh
 
73
  @item -gmsh
74
74
        output field on standard output stream in gmsh text file format.
75
 
  @itemx -gmsh-pos
 
75
  @item -gmsh-pos
76
76
        output field on standard output stream in gmsh-pos text file format,
77
77
        suitable for mesh adaptation purpose.
78
78
@toindex @code{bamg}
79
79
@fiindex @file{.bamg} mesh file
80
80
@fiindex @file{.bamg_bb} data file
81
 
  @itemx -bamg-bb
 
81
  @item -bamg-bb
82
82
        output field on standard output stream in bamg-bb text file format,
83
83
        suitable for mesh adaptation purpose.
84
84
@cindex graphic render
89
89
@fiindex @file{.jpg} image
90
90
@fiindex @file{.ps} image
91
91
@fiindex @file{.pdf} image
92
 
  @itemx -image-format @code{string}
 
92
  @item -image-format @code{string}
93
93
        The argument is any valid image format, such as
94
94
        bitmap @code{png}, @code{jpg}, @code{gif} or vectorial @code{ps} or @code{pdf}
95
95
        image file formats, and that could be handled by the corresponding render.
100
100
 
101
101
GETTING INFORMATION:
102
102
    @table @code
103
 
    @itemx -min
 
103
    @item -min
104
104
    @itemx -max
105
105
        print the min (resp. max) value of the scalar field and then exit.
106
106
    @end table
109
109
  @table @code
110
110
 
111
111
@toindex @code{gnuplot}
112
 
  @itemx -gnuplot
 
112
  @item -gnuplot
113
113
        use @code{gnuplot} tool.
114
114
        This is the default in one and two dimension.
115
115
@toindex @code{mayavi}
116
 
  @itemx -mayavi
 
116
  @item -mayavi
117
117
        use @code{mayavi} tool.
118
118
        This is the default for tridimensional geometries.
119
119
  @end table
120
120
 
121
121
RENDERING OPTIONS:
122
122
    @table @code
123
 
    @itemx -color
 
123
    @item -color
124
124
    @itemx -gray
125
125
    @itemx -black-and-white
126
126
    @itemx -bw
127
127
        Use (color/gray scale/black and white) rendering.
128
128
        Color rendering is the default.
129
 
    @itemx -elevation
 
129
    @item -elevation
130
130
    @itemx -noelevation
131
131
        For two dimensional field, represent values as elevation
132
132
        in the third dimension.
133
133
        The default is no evelation.
134
 
    @itemx -scale @var{float}
 
134
    @item -scale @var{float}
135
135
        applies a multiplicative factor to the field.
136
136
        This is useful e.g. in conjonction with the @code{elevation} option.
137
137
        The default value is 1.
138
 
    @itemx -stereo
 
138
    @item -stereo
139
139
    @itemx -nostereo
140
140
        Rendering mode suitable for red-blue anaglyph 3D stereoscopic glasses.
141
141
        This option is only available with @code{mayavi}.
142
 
    @itemx -fill
 
142
    @item -fill
143
143
        isoline intervals are filled with color.
144
144
        This is the default.
145
 
    @itemx -nofill
 
145
    @item -nofill
146
146
        draw isolines by using lines.
147
 
    @itemx -cut
 
147
    @item -cut
148
148
    @itemx -nocut
149
149
        Cut by a specified plane.
150
150
        The cutting plane is specified by its origin point and normal vector.
151
151
        This option requires the @code{mayavi} code.
152
 
    @itemx -origin @var{float} [@var{float} [@var{float}]]
 
152
    @item -origin @var{float} [@var{float} [@var{float}]]
153
153
        set the origin of the cutting plane.
154
154
        Default is (0.5, 0.5, 0.5).
155
 
    @itemx -normal @var{float} [@var{float} [@var{float}]]
 
155
    @item -normal @var{float} [@var{float} [@var{float}]]
156
156
        set the normal of the cutting plane.
157
157
        Default is (1, 0, 0).
158
 
    @itemx -iso [@var{float}]
 
158
    @item -iso [@var{float}]
159
159
        do draw 3d isosurface. When the optional float is not provided,
160
160
        a median value is used.
161
161
        This option requires the @code{mayavi} code.
162
 
    @itemx -noiso
 
162
    @item -noiso
163
163
        do not draw isosurface.
164
 
    @itemx -n-iso @var{int}
 
164
    @item -n-iso @var{int}
165
165
        For 2D visualizations, the isovalue table contains
166
166
        regularly spaced values from fmin to fmax, the bounds
167
167
        of the field.
168
168
@cindex projection
169
 
    @itemx -proj
 
169
    @item -proj
170
170
        Convert all selected fields to Pk-continuous approximation by using a L2 projection.
171
 
    @itemx -round [@var{float}]
 
171
    @item -round [@var{float}]
172
172
        Round the input up to the specifiexd precision.
173
173
        This option, combined with @code{-field}, leads to a round filter.
174
174
        Usefull for non-regression test purpose, in order
177
177
 
178
178
@cindex vorticity
179
179
@cindex stream function
180
 
    @itemx -n-iso-negative @var{int}
 
180
    @item -n-iso-negative @var{int}
181
181
        The isovalue table is splitted into negatives and positives values.
182
182
        Assume there is n_iso=15 isolines: if 4 is requested by this option,
183
183
        then, there will be 4 negatives isolines, regularly spaced
185
185
        from 0 to fmax.
186
186
        This option is usefull when plotting e.g. vorticity or stream
187
187
        functions, where the sign of the field is representative.
188
 
    @itemx -subdivide int
 
188
    @item -subdivide int
189
189
        When using a high order geometry, the number of points per edge used to draw
190
190
        a curved element. Default value is the mesh order.
191
191
 
192
 
    @itemx -deformation
 
192
    @item -deformation
193
193
        Render vector-valued fields as deformed mesh
194
194
        using @code{mayavi} or @code{gnuplot}.
195
195
        This is the default vector field representation.
196
196
 
197
 
    @itemx -velocity
 
197
    @item -velocity
198
198
        Render vector-valued fields as arrows using @code{mayavi}.
199
199
 
200
200
    @end table
201
 
COMPONENT EXTRACTION:
 
201
COMPONENT EXTRACTION AND DOMAIN REDUCTION:
202
202
    @table @code
203
 
    @itemx -comp @var{int}
204
 
        Extract a component of a vector-valued field.
 
203
    @item -comp @var{int}
 
204
    @itemx -comp @var{string}
 
205
        Extract the i-th component of a vector-valued field.
 
206
        For a tensor-valued field, indexing components as "00", "01", "11"... is supported.
 
207
    @item -domain @var{name}
 
208
        Reduce the visualization to the specified domain.
205
209
    @end table
206
210
 
207
211
OTHERS OPTIONS:
208
212
    @table @code
209
 
    @itemx -verbose
 
213
    @item -verbose
210
214
        print messages related to graphic files created and
211
215
       command system calls (this is the default).
212
216
 
213
 
    @itemx -noverbose
 
217
    @item -noverbose
214
218
        does not print previous messages.
215
219
 
216
 
    @itemx -clean
 
220
    @item -clean
217
221
        clear temporary graphic files (this is the default).
218
222
    
219
 
    @itemx -noclean
 
223
    @item -noclean
220
224
        does not clear temporary graphic files.
221
225
 
222
 
    @itemx -execute
 
226
    @item -execute
223
227
        execute graphic command (this is the default).
224
228
    
225
 
    @itemx -noexecute
 
229
    @item -noexecute
226
230
        does not execute graphic command. Generates only 
227
231
        graphic files. This is usefull in conjuction with the
228
232
        @code{-noclean} command.
305
309
           << "[-n-iso-negative int] "
306
310
           << "[-image-format string] "
307
311
           << "[-subdivide int] "
308
 
           << "[-comp int] "
 
312
           << "[-comp string] "
 
313
           << "[-domain string] "
309
314
           << "[-proj] "
310
315
           << "[-round float] "
311
316
           << "[-velocity|-deformation] "
368
373
    bool do_proj = false;
369
374
    bool do_cut  = false;
370
375
    bool do_round = false;
 
376
    std::string reduce_to_domain = "";
371
377
    Float round_prec = sqrt(std::numeric_limits<Float>::epsilon());
372
378
    show_type show = show_none;
373
379
    // ----------------------------
475
481
            if (i+1 == argc || !isdigit(argv[i+1][0])) usage();
476
482
            i_comp_name = argv[++i];
477
483
        }
 
484
        else if (strcmp (argv[i], "-domain") == 0)   {
 
485
 
 
486
            if (i+1 == argc) usage();
 
487
            reduce_to_domain = argv[++i];
 
488
        }
478
489
        else if (strcmp (argv[i], "-round") == 0)   {
479
490
 
480
491
            do_round = true;
559
570
      if (!def_fill_opt)       dout.os() << nofill;
560
571
    }
561
572
    if (i_comp_name != "") {
562
 
      // compute i_comp:
 
573
      // compute uh[i_comp]:
563
574
      switch (uh.valued_tag()) {
564
575
        case space_constant::vector: {
565
576
          i_comp = atoi (i_comp_name.c_str());
579
590
      field_basic<Float,sequential> vh = uh[i_comp];
580
591
      uh = vh;
581
592
    }
 
593
    if (reduce_to_domain != "") {
 
594
      field_basic<Float,sequential> vh = uh[reduce_to_domain];
 
595
      uh = vh;
 
596
    }
582
597
    if (! do_proj && render == mayavi_render && uh.valued() != "scalar"
583
 
        && ! uh.get_space().get_numbering().is_continuous()) {
 
598
        && uh.get_space().get_numbering().has_compact_support_inside_element()) {
584
599
      // non-scalar vector & tensor mayavi visualization may be continuous
585
600
      warning_macro ("mayavi: perform L2-projection to continuous space");
586
601
      do_proj = true;
587
602
    }
588
 
    if (do_proj && ! uh.get_space().get_numbering().is_continuous()) {
 
603
    if (do_proj && uh.get_space().get_numbering().has_compact_support_inside_element()) {
589
604
      const space_basic<Float,sequential>& Uh = uh.get_space();
590
605
      size_t k = Uh.degree();
591
606
      if (k == 0) k++;
621
636
               << uh.max() << endl;
622
637
          return 0;
623
638
    }
 
639
    // generates label (mayavi support it now):
 
640
    {
 
641
      string root_filename = iorheo::getbasename(dout.os());
 
642
      string label = (root_filename == "output") ? "" : root_filename;
 
643
      if (mark != "") {
 
644
        // label = (label == "") ? mark : label + "." + mark;
 
645
        label = mark;
 
646
      }
 
647
      if (i_comp_name != "") { 
 
648
         label = (label == "") ? "value" : label;
 
649
         label = label + "[" + i_comp_name + "]";
 
650
      }
 
651
      if (reduce_to_domain != "") {
 
652
         label = (label == "") ? "value" : label;
 
653
         label = label + "[" + reduce_to_domain + "]";
 
654
      }
 
655
      dout.os() << setmark (label);
 
656
    }
 
657
    // final output:
624
658
    dout << uh;
625
659
}