~ubuntu-branches/ubuntu/raring/rheolef/raring-proposed

« back to all changes in this revision

Viewing changes to doc/refman/rheolef.info

  • 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:
109
109
All these documentations are downloadable in various formats from the
110
110
`rheolef' home page.    These files are also locally installed   during
111
111
the `make install' stage.  The users guide is generated in `pdf' format:
112
 
              evince usrman.pdf
 
112
              evince rheolef.pdf
113
113
 
114
114
The reference manual is generated in `html' format:
115
115
              firefox http://ljk.imag.fr/membres/Pierre.Saramito/rheolef/rheolef.html
130
130
              ./configure --prefix=$HOME/sys
131
131
In that case, you have to add the folowing lines at the end    of your
132
132
`.profile' or `.bash_profile' file:
133
 
              export PATH="$PATH:$HOME/sys/bin"
134
 
              export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/sys/lib"
135
 
              export MANPATH="$MANPATH:$HOME/man"
 
133
              export PATH="$HOME/sys/bin:$PATH"
 
134
              export LD_LIBRARY_PATH="$HOME/sys/lib:$LD_LIBRARY_PATH"
 
135
              export MANPATH="$HOME/sys/man:$MANPATH"
136
136
assuming you are using the `sh' or the `bash' unix interpreter.
137
137
Conversely, if you are using `csh' or `tcsh', add    at the bottom of
138
138
your `.cshrc' file:
139
 
              set path = ($path $HOME/sys/bin)
140
 
              setenv LD_LIBRARY_PATH "$LD_LIBRARY_PATH:$HOME/sys/lib"
141
 
              setenv MANPATH "$MANPATH:$HOME/sys/man"
 
139
              set path = ($HOME/sys/bin $path)
 
140
              setenv LD_LIBRARY_PATH "$HOME/sys/lib:$LD_LIBRARY_PATH"
 
141
              setenv MANPATH "$HOME/sys/man:$MANPATH"
142
142
   If you are unure about unix interpreter, get the SHELL value:
143
143
              echo $SHELL
144
144
Then, you have to _source_ the modified file, e.g.:
480
480
Regenerating the full documention requires also optional tools.
481
481
 
482
482
 
483
 
              xdvi      doc/usrman/usrman.dvi
484
 
              ghostview doc/usrman/usrman.ps
485
483
              xpdf      doc/usrman/usrman.pdf
486
484
 
487
485
The reference manual is available in `.info', `.dvi',  `.ps', `.pdf',
489
487
 
490
488
 
491
489
              info -f   doc/refman/rheolef.info
492
 
              xdvi      doc/refman/rheolef.dvi
493
 
              ghostview doc/refman/rheolef.ps
494
490
              xpdf      doc/refman/rheolef.pdf
495
 
              lynx      doc/refman/rheolef_toc.html
496
 
              vi        doc/refman/rheolef.txt
 
491
              firefox   doc/refman/rheolef.html
497
492
 
498
493
2.14 Documentation using doxygen
499
494
================================
625
620
 
626
621
* Menu:
627
622
 
628
 
* mkgeo_grid command::
629
 
* mfield command::
630
 
* grummp2geo command::
631
 
* tetgen2geo command::
632
623
* geo command::
633
 
* bamg2geo command::
634
 
* mesh2geo command::
635
624
* field command::
636
 
* cemagref2field command::
637
 
* qmg2geo command::
638
 
* space command::
639
625
* msh2geo command::
640
 
* branch command::
641
 
* cad command::
642
626
* rheolef-config command::
643
627
 
644
628
 
645
 
File: rheolef.info,  Node: mkgeo_grid command,  Up: Commands
646
 
 
647
 
4.1 mkgeo_grid - build a regular grid mesh in 1d, 2d or 3d
648
 
==========================================================
649
 
 
650
 
(Source file: `nfem/bin/mkgeo_grid') 
651
 
 
652
 
Synopsis
653
 
--------
654
 
 
655
 
             mkgeo_grid OPTIONS [NX [NY [NZ]]]
656
 
 
657
 
Example
658
 
-------
659
 
 
660
 
The following command build a triangular based 2d 10x10 grid   of the
661
 
unit square:
662
 
             mkgeo_grid -t 10 > square-10.geo
663
 
             geo square-10.geo
664
 
or in one comand line:
665
 
             mkgeo_grid -t 10 | geo -
666
 
 
667
 
Description
668
 
-----------
669
 
 
670
 
This command is usefull when testing programs on simple geometries.
671
 
It avoid the preparation of an input file for a mesh generator.    The
672
 
optional NX, NY and NZ arguments are integer   that specifies the
673
 
subdivision in each direction. By default   NX=10, NY=NX and NZ=NY.
674
 
The mesh files goes on standard output.
675
 
 
676
 
The command supports all the possible element types: edges, triangles,
677
 
rectangles, tetraedra, prisms and hexahedra.
678
 
 
679
 
Element type options
680
 
--------------------
681
 
 
682
 
`-e'
683
 
     1d mesh using edges.
684
 
 
685
 
`-t'
686
 
     2d mesh using triangles.
687
 
 
688
 
`-q'
689
 
     2d mesh using quadrangles (rectangles).
690
 
 
691
 
`-T'
692
 
     3d mesh using tetraedra.
693
 
 
694
 
`-P'
695
 
     3d mesh using prisms.
696
 
 
697
 
`-H'
698
 
     3d mesh using hexahedra.
699
 
 
700
 
The geometry
701
 
------------
702
 
 
703
 
The geometry can be any [a,b] segment, [a,b]x[c,d] rectangle   or
704
 
[a,b]x[c,d]x[f,g] parallelotope. By default a=c=f=0 and b=d=g=1, thus,
705
 
the unit boxes are considered. For instance, the following   command
706
 
meshes the [-2,2]x[-1.5, 1.5] rectangle:
707
 
             mkgeo_grid -t 10 -a -2 -b 2 -c -1.5 -d 1.5 | geo -
708
 
 
709
 
`-a FLOAT'
710
 
`-b FLOAT'
711
 
`-c FLOAT'
712
 
`-d FLOAT'
713
 
`-f FLOAT'
714
 
`-g FLOAT'
715
 
 
716
 
Boundary domains
717
 
----------------
718
 
 
719
 
`-boundary'
720
 
     The boundary domains for boxes uses names: `left', `right',
721
 
     `top', `bottom',`front' and `back'.    Instead of splitting the
722
 
     boundary in faces, this option   groups all boundary faces in one
723
 
     domain named `boundary'.
724
 
 
725
 
             mkgeo_grid -t 10 -boundary | geo -
726
 
 
727
 
Regions
728
 
-------
729
 
 
730
 
`-region'
731
 
     The whole domain is splitted into two subdomains: `east' and
732
 
     `west',   This option is used for testing computations with
733
 
     subdomains (e.g. transmission   problem; see the user manual).
734
 
 
735
 
             mkgeo_grid -t 10 -region | geo -
736
 
 
737
 
Corners
738
 
-------
739
 
 
740
 
`-corner'
741
 
     The corners (four in 2D and eight in 3D) are defined as OD-domains.
742
 
      This could be usefull for some special boundary conditions.
743
 
 
744
 
             mkgeo_grid -t 10 -corner | geo -
745
 
             mkgeo_grid -T  5 -corner | geo -
746
 
 
747
 
Coordinate system option
748
 
------------------------
749
 
 
750
 
Most of rheolef codes are coordinate-system independant.     The
751
 
coordinate system is specified in the geometry file `.geo'.
752
 
`-rz'
753
 
     the 2d mesh is axisymmetric.
754
 
 
755
 
 
756
 
File: rheolef.info,  Node: mfield command,  Up: Commands
757
 
 
758
 
4.2 `mfield' - handle multi-field files
759
 
=======================================
760
 
 
761
 
(Source file: `nfem/bin/mfield.cc') 
762
 
 
763
 
Synopsis
764
 
--------
765
 
 
766
 
             mfield {-FIELD-NAME}+ [-IDIR] FILENAME
767
 
 
768
 
Example
769
 
-------
770
 
 
771
 
This command performs a _velocity_ graphical   output for vector-valued
772
 
fields:
773
 
             mfield -u square.mfield -velocity
774
 
             mfield -u square.mfield -deformation
775
 
             mfield -s square.mfield -proj -tensor
776
 
  It is also convenient for selecting some scalar fields, e.g.    to
777
 
pipe to another processor
778
 
             mfield -psi square.mfield | field -
779
 
             mfield -u0  square.mfield | field -
780
 
             mfield -u1  square.mfield | field -
781
 
 
782
 
Description
783
 
-----------
784
 
 
785
 
Read and output multiple finite element fields from file,   in field
786
 
text file format.    Fields are preceded by a label, in the following
787
 
`.mfield' file format:
788
 
           mfield
789
 
           1 2
790
 
           #u0
791
 
             FIELD U0...
792
 
           #u1
793
 
             FIELD U1...
794
 
           #p
795
 
             FIELD P...
796
 
           #psi
797
 
             FIELD PSI...
798
 
  Such labeled file format could be easily generated   using the
799
 
`catchmark' stream manipulator   (*note iorheo class::).
800
 
           cout << catchmark("u")   << uh
801
 
                << catchmark("p")   << ph
802
 
                << catchmark("psi") << psih;
803
 
 
804
 
Options
805
 
-------
806
 
 
807
 
`-IDIR'
808
 
     add DIR to the RHEOPATH search path.          See also *note geo
809
 
     class:: for RHEOPATH mechanism.
810
 
 
811
 
`FILENAME'
812
 
     specifies the name of the file containing         the input field.
813
 
 
814
 
`-all'
815
 
     all fields are selected for stdout printing.
816
 
 
817
 
`-'
818
 
     read field on standard input instead on a file.
819
 
 
820
 
`-ndigit INT'
821
 
     number of digits used to print floating point values         when
822
 
     using the `-geo' option.          Default depends upon the machine
823
 
     precision associated to the         `Float' type.
824
 
 
825
 
`-verbose'
826
 
     print messages related to graphic files created and        command
827
 
     system calls (this is the default).
828
 
 
829
 
`-noverbose'
830
 
     does not print previous messages.
831
 
 
832
 
`-round [FLOAT]'
833
 
     Round the output, in order for the non-regression tests to
834
 
     be portable across platforms. Floating point are machine-dependent.
835
 
            The round value is optional. default value is 1e-10.
836
 
 
837
 
 
838
 
Render options
839
 
--------------
840
 
 
841
 
`-velocity'
842
 
     Render vector-valued fields as arrows         using `plotmtv',
843
 
     `mayavi' or `vtk'.          The the numeric extension is assumed:
844
 
           use e.g. `-u' option instead of `-u0', `-u1' options.
845
 
 
846
 
`-deformation'
847
 
     Render vector-valued fields as deformed mesh         using
848
 
     `plotmtv', `mayavi' or `vtk'.          The the numeric extension
849
 
     is assumed:         use e.g. `-u' option instead of `-u0', `-u1'
850
 
     options.
851
 
 
852
 
`-tensor'
853
 
     Render tensor-valued fields as ellipses         using `mayavi'.
854
 
          The the numeric extension is assumed:         use e.g. `-tau'
855
 
     option instead of `-tau00', `-tau01'...          Warning: in
856
 
     development stage.
857
 
 
858
 
`-vscale FLOAT'
859
 
     scale vector values by specified factor. Default value is 1.
860
 
 
861
 
`-proj'
862
 
     Convert all selected fields to P1-continuous approximation by
863
 
     using a L2 projection.          Only valid yet together with the
864
 
     `-tensor' option.
865
 
 
866
 
Render tool selection
867
 
---------------------
868
 
 
869
 
`-mayavi'
870
 
     use `mayavi' tool.          This is the default for bi- and
871
 
     tridimensional geometries.          The environment variable
872
 
     RHEOLEF_RENDER may be set to one of the choices below to override
873
 
     this default.
874
 
 
875
 
`-plotmtv'
876
 
     use `plotmtv' plotting command.
877
 
 
878
 
`-vtk'
879
 
     use `vtk' tool.          Old style for 3d problems: superseted by
880
 
     `-mayavi'.
881
 
 
882
 
 
883
 
Others render options
884
 
---------------------
885
 
 
886
 
`-color'
887
 
`-gray'
888
 
`-black-and-white'
889
 
     Use (color/gray scale/black and white) rendering.          Color
890
 
     rendering is the default.      
891
 
 
892
 
`-stereo'
893
 
`-nostereo'
894
 
     rendering mode: suitable for red-blue anaglyph 3D stereoscopic
895
 
     glasses.
896
 
 
897
 
`-fill'
898
 
     vector norm isolines intervals are filled with color.
899
 
 
900
 
`-nofill'
901
 
     vector norm isolines are drawed by using colored mesh edges.
902
 
       This is the default.
903
 
 
904
 
`-verbose'
905
 
     print messages related to graphic files created and        command
906
 
     system calls (this is the default).
907
 
 
908
 
`-noverbose'
909
 
     does not print previous messages.
910
 
 
911
 
`-clean'
912
 
     clear temporary graphic files (this is the default).
913
 
 
914
 
`-noclean'
915
 
     does not clear temporary graphic files.
916
 
 
917
 
`-execute'
918
 
     execute graphic command (this is the default).
919
 
 
920
 
`-noexecute'
921
 
     does not execute graphic command. Generates only         graphic
922
 
     files. This is usefull in conjuction with the         `-noclean'
923
 
     command.
924
 
 
925
 
To do
926
 
-----
927
 
 
928
 
Check if selected fields appear in file.      Otherwise, send some
929
 
error message.
930
 
 
931
 
 
932
 
File: rheolef.info,  Node: grummp2geo command,  Up: Commands
933
 
 
934
 
4.3 grummp2geo - convert grummp mesh in geo format
935
 
==================================================
936
 
 
937
 
(Source file: `nfem/bin/grummp2geo') 
938
 
 
939
 
Synopsis
940
 
--------
941
 
 
942
 
       grummp OPTIONS INPUT[.g] [INPUT[.dmn]]
943
 
 
944
 
Description
945
 
-----------
946
 
 
947
 
Convert a grummp `.g' into `.geo' one.  The output goes to standart
948
 
output.  The `.dmn' file specifies the domain names, since `grummp'
949
 
mesh generators use numbers as domain labels.
950
 
 
951
 
Example
952
 
-------
953
 
 
954
 
       grummp2geo toto.g toto.dmn > toto.geo
955
 
 
956
 
 
957
 
File: rheolef.info,  Node: tetgen2geo command,  Up: Commands
958
 
 
959
 
4.4 tetgen2geo - convert tetgen mesh in geo format
960
 
==================================================
961
 
 
962
 
(Source file: `nfem/bin/tetgen2geo') 
963
 
 
964
 
Synopsis
965
 
--------
966
 
 
967
 
       tetgen2geo OPTIONS INPUT[.node] INPUT[.ele] INPUT[.face] INPUT[.dmn]
968
 
 
969
 
Description
970
 
-----------
971
 
 
972
 
Convert a tetgen mesh into `.geo' one.  The output goes to standart
973
 
output.  The `.dmn' file specifies the domain names, since `tetgen'
974
 
mesh generator uses numbers as domain labels.
975
 
 
976
 
Example
977
 
-------
978
 
 
979
 
       tetgen toto.smesh
980
 
       tetgen2geo toto.1.node toto.1.ele toto.1.face toto.dmn > toto.geo
981
 
 
982
 
Domain name file
983
 
----------------
984
 
 
985
 
This auxilliary `.dmn' file defines the boundary domain names as used
986
 
by Rheolef, since `tetgen' uses numeric labels for domains.
987
 
 
988
 
Options
989
 
-------
990
 
 
991
 
`-upgrade'
992
 
`-noupgrade'
993
 
     Default is to output a version 2 `.geo' file format. *Note geo
994
 
     command::.          With the `-noupgrade', a version 1 file format
995
 
     is assumed.
996
 
 
997
 
 
998
629
File: rheolef.info,  Node: geo command,  Up: Commands
999
630
 
1000
 
4.5 `geo' - plot a finite element mesh
 
631
4.1 `geo' - plot a finite element mesh
1001
632
======================================
1002
633
 
1003
 
(Source file: `nfem/bin/xgeo.cc') 
 
634
(Source file: `nfem/pbin/geo.cc') 
1004
635
 
1005
636
Synopsis
1006
637
--------
1007
638
 
1008
 
             geo OPTIONS MESH[.geo]
 
639
             geo OPTIONS MESH[.geo[.gz]]
1009
640
 
1010
641
Description
1011
642
-----------
1012
643
 
1013
 
Plot a 2d or 3d finite element mesh.
1014
 
 
1015
 
The input file format is described with the `geo'   class manual (*note
1016
 
geo class::).
1017
 
 
1018
 
Example
1019
 
-------
1020
 
 
1021
 
Enter commands as:
1022
 
             geo -vtk bielle.geo
1023
 
             geo -vtk -fill bielle.geo
1024
 
  or, for 2D meshes:
1025
 
             geo -plotmtv square.geo
 
644
Plot or upgrade a finite element mesh.
 
645
 
 
646
Examples
 
647
--------
 
648
 
 
649
Plot a mesh:
 
650
             geo square.geo
 
651
             geo box.geo
 
652
             geo box.geo -full
 
653
  Plot a mesh into a file:
 
654
             geo square.geo -image-format png
 
655
  Convert from a old geo file format to the new one:
 
656
             geo -upgrade - < square-old.geo > square.geo
 
657
  See below for the geo file format scpecification.    The old file
 
658
format does not contains edges and faces connectivity in 3d geometries,
 
659
 or edges connectivity in 2d geometries.    The converter add it
 
660
automatically into the upgraded file format.    Conversely, the old
 
661
file format is usefull when translating from another   file format,
 
662
e.g. `gmsh' or `bamg'.
1026
663
 
1027
664
Input file specification
1028
665
------------------------
1031
668
     specifies the name of the file containing         the input mesh.
1032
669
     The ".geo" extension is assumed.
1033
670
 
1034
 
`-IGEODIR'
1035
 
     add GEODIR to the mesh search path.          This mechanism
1036
 
     initializes a search path given by the environment variable
1037
 
     `RHEOPATH'. If the environment variable         `RHEOPATH' is not
1038
 
     set, the         default value is the current directory
1039
 
     (*note geo class::).
1040
 
 
1041
671
`-'
1042
672
     read mesh on standard input instead on a file.
1043
673
 
1048
678
     output formats (graphic, format conversion)         that creates
1049
679
     auxilliary files, based on this name.
1050
680
 
1051
 
Inquire options
1052
 
---------------
1053
 
 
1054
 
`-size'
1055
 
     print the number of elements in the mesh and exit.
1056
 
 
1057
 
`-n-node'
1058
 
     print the number of nodes in the mesh and exit.
1059
 
 
1060
 
`-hmin'
1061
 
     print the smallest edge length in the mesh and exit.
1062
 
 
1063
 
`-hmax'
1064
 
     print the largest edge length in the mesh and exit.
1065
 
 
1066
 
`-xmin'
1067
 
     print the lower-left-bottom vertice in the mesh and exit.
1068
 
 
1069
 
`-xmax'
1070
 
     print the upper-right-top vertice in the mesh and exit.
1071
 
 
1072
 
Render options
1073
 
--------------
1074
 
 
1075
 
The default render could also specified by using the RHEOLEF_RENDER
1076
 
environment variable.
1077
 
`-mayavi'
1078
 
     use Mayavi.          This is the default.
1079
 
 
1080
 
`-plotmtv'
1081
 
     use plotmtv tool.
 
681
Render specification
 
682
--------------------
1082
683
 
1083
684
`-gnuplot'
1084
685
     use gnuplot tool.
1085
686
 
1086
 
`-vtk'
1087
 
     use Visualization Toolkit.
1088
 
 
1089
 
`-x3d'
1090
 
     use x3d visualization tool.
1091
 
 
1092
 
`-atom'
1093
 
     use PlotM atom representation (from lassp, Cornell).
1094
 
 
1095
 
Graphic options
1096
 
---------------
1097
 
 
1098
 
`-color'
1099
 
     use colors. This is the default.
1100
 
 
1101
 
`-black-and-white'
1102
 
     Option only available with `mayavi'.
1103
 
 
1104
 
`-stereo'
1105
 
     Rendering mode suitable for red-blue anaglyph 3D stereoscopic
1106
 
     glasses.          Option only available with `mayavi'.
1107
 
 
1108
 
`-grid'
1109
 
     rendering mode. This is the default.
1110
 
 
1111
 
`-fill'
1112
 
     rendering mode. Fill mesh faces using light effects when available.
1113
 
 
1114
 
`-shrink'
1115
 
     rendering mode. Shrink 3d elements (with vtk only).
1116
 
 
1117
 
`-tube'
1118
 
     rendering mode. All edges appears as tubes (with vtk only).
1119
 
 
1120
 
`-ball'
1121
 
     rendering mode. Vertices appears as balls (with vtk only).
 
687
Render options
 
688
--------------
 
689
 
 
690
`-lattice'
 
691
`-nolattice'
 
692
     When using a high order geometry, the lattice inside any element
 
693
     appears.          Default is on;
1122
694
 
1123
695
`-full'
1124
 
     rendering mode. All edges appears (with vtk only).
1125
 
 
1126
 
`-cut'
1127
 
     rendering mode. cut by plane and clip (with vtk only).
1128
 
     Works with `-full', `-tube' or `-ball' modes.          Does not
1129
 
     clip mesh with `-fill' and `-grid' modes.          Does not work
1130
 
     yet with `-shrink' mode.          This option is still in
1131
 
     development.
1132
 
 
1133
 
`-origin X [Y [Z]]'
1134
 
     set the origin point of the cutting plane         when using with
1135
 
     the `-cut' option.          Default is (0.5,0.5,0.5).
1136
 
 
1137
 
`-normal NX [NY [NZ]]'
1138
 
     set the normal vector of the cutting plane.          when using
1139
 
     with the `-cut' option.          Default is (1,0,0).
1140
 
 
1141
 
`-split'
1142
 
     split each edge by inserting a node.          The resulting mesh
1143
 
     is P2-iso-P1.
1144
 
 
1145
 
Output format options
1146
 
---------------------
 
696
`-nofull'
 
697
     All internal edges appears, for 3d meshes.          Default is off;
 
698
 
 
699
Output file format options
 
700
--------------------------
1147
701
 
1148
702
`-geo'
1149
703
     output mesh on standard output stream in geo text file format,
1150
704
        instead of plotting it.
1151
705
 
1152
 
`-bamg'
1153
 
     output mesh on standard output stream in bamg text file format,
1154
 
         instead of plotting it.
1155
 
 
1156
 
`-gmsh'
1157
 
     output mesh on standard output stream in gmsh ascii file format,
1158
 
          instead of plotting it.
1159
 
 
1160
 
`-tegen'
1161
 
     output mesh on stream in tegen text file format,         instead
1162
 
     of plotting it (TODO).
1163
 
 
1164
 
`-mmg3d'
1165
 
     output mesh on standard output stream in mmg3d text file format,
1166
 
          instead of plotting it.
1167
 
 
1168
 
`-cemagref'
1169
 
     output mesh on standard output stream in cemagref text file format,
1170
 
            instead of plotting it. Notices that the mesh does not
1171
 
     contains         the topographic elevation. If you want to include
1172
 
     the elevation,         in the output, use the `field' command with
1173
 
     the `-cemagref' option.
1174
 
 
1175
706
`-upgrade'
1176
 
     edges and faces are numbered. This numbering is required
1177
 
     for the quadratic approximation.
1178
 
 
1179
 
`-ndigit INT'
1180
 
     number of digits used to print floating point values         when
1181
 
     using the `-geo' option.          Default depends upon the machine
1182
 
     precision         of the `Float' type.
1183
 
 
1184
 
`-output-as-double'
1185
 
     Avoid variation of output float formats         when using high
1186
 
     precision `doubledouble' or         `bigfloat' classes.
1187
 
     This option is used for non-regression test purpose.
1188
 
 
1189
 
 
1190
 
Input format options
1191
 
--------------------
1192
 
 
1193
 
`-input-geo'
1194
 
     read the mesh in the `.geo' format.          This is the default.
1195
 
 
1196
 
`-input-bamg'
1197
 
     read the mesh in the `.bamg' format.          Since edges are not
1198
 
     numbered in `.bamg' format,         this file format is not
1199
 
     suitable for using P2 elements.          This format is supported
1200
 
     only for format conversion purpose.          See `-upgrade' for
1201
 
     edge numbering while         converting to `.geo'.
1202
 
 
1203
 
`-input-gmsh'
1204
 
     read the mesh in the `.msh' format.          Since edges in 2D and
1205
 
     faces in 3D are not numbered in `.msh'         format, this file
1206
 
     format is not suitable for using P2 elements.          This format
1207
 
     is supported only for format conversion purpose.          See
1208
 
     `-upgrade' for edge numbering while         converting to `.geo'.
1209
 
 
1210
 
`-input-tetgen'
1211
 
     read the mesh as the concatenation of `.node', `.ele' and `.face'
1212
 
     tetgen format.          Since in 3D are not all numbered in tetgen
1213
 
            format, this file format is not suitable for using P2
1214
 
     elements.          This format is supported only for format
1215
 
     conversion purpose.          See `-upgrade' for edge numbering
1216
 
     while         converting to `.geo'.
1217
 
 
1218
 
`-input-mmg3d'
1219
 
     read the mesh in the `.mmg3d' format.          Since edges and
1220
 
     faces are not numbered in `.mmg3d' format,         this file
1221
 
     format is not suitable for using P2 elements.          This format
1222
 
     is supported only for format conversion purpose.          See
1223
 
     `-upgrade' for edge numbering while         converting to `.geo'.
1224
 
 
1225
 
`-input-grummp'
1226
 
     read the mesh on standard input stream in grummp text file format.
1227
 
            The `.g' grummp file format is defined         grummp
1228
 
     `.template' specification file
1229
 
                    newfile g
1230
 
                    "grummp"
1231
 
                    "2" nverts ncells nbfaces
1232
 
                    verts: coords
1233
 
                    cells: verts region
1234
 
                    bdryfaces: verts bc
1235
 
             Conversely, for tridimensionnal meshes, the         grummp
1236
 
     `.template' specification file is:
1237
 
                    newfile g
1238
 
                    "grummp"
1239
 
                    "3" nverts ncells nbfaces
1240
 
                    verts: coords
1241
 
                    cells: verts region
1242
 
                    bdryfaces: verts bc
1243
 
             Such files can be generated with the `tri' and `tetra'
1244
 
        grummp mesh file generators. The grummp mesh generators suport
1245
 
           multi-regions geometries. These regions are translated to
1246
 
     bi- or         tri-dimensional domains, that are no boundary
1247
 
     domains.          A file format conversion writes:
1248
 
                     geo -input-grummp -geo -upgrade -noverbose - < hex-multi.g > hex-multi.geo
1249
 
 
1250
 
`-input-qmg'
1251
 
     output mesh on standard output stream in qmg text file format.
1252
 
         instead of plotting it.          Since edges are not numbered
1253
 
     in `.qmg' format,         this file format is not suitable for
1254
 
     using P2 elements.          This format is supported only for
1255
 
     format conversion purpose.          See `-upgrade' for edge
1256
 
     numbering while         converting to `.geo'.
1257
 
 
1258
 
`-dmn DOMAIN-NAMES-FILE'
1259
 
     An auxilliary `.dmn' file defining the boundary domain names
1260
 
      as used by `rheolef' could be used, since `bamg', `mmg3d',
1261
 
     `tetgen'         and `grummp' use numeric         labels for
1262
 
     domains. Example of a `multi-domain.dmn'         with two regions
1263
 
     and four boundary domains file:
1264
 
                    EdgeDomainNames
1265
 
                      4
1266
 
                      bottom
1267
 
                      right
1268
 
                      top
1269
 
                      left
1270
 
                    FaceDomainNames
1271
 
                      2
1272
 
                      hard
1273
 
                      soft
1274
 
             `geo' recognized this format as an extension at the end
1275
 
         of the `.bamg', `.mesh' (mmg3d) or the `.g' file.          The
1276
 
     complete file format conversion writes:
1277
 
                    cat multi-domain.g multi-domain.dmn | \\
1278
 
                      geo -input-grummp -upgrade -geo -  > multi-domain.geo
1279
 
             If this file is not provided, boundary domains are named
1280
 
          `boundary1', `boundary2', ...          and region domain are
1281
 
     named         `region1', `region2', ...          The
1282
 
     tridimensionnal domain name file contains         the
1283
 
     `FaceDomainNames' and `VolumeDomainNames'         keywords, for
1284
 
     boundary and region domains, respectively.
1285
 
 
1286
 
`-input-cemagref'
1287
 
     read the mesh in the `.cemagref' format.          Notices that the
1288
 
     reader skip the topographic elevation informations.          If
1289
 
     you want to load the elevation, use the `field'         command
1290
 
     with the `-input-cemagref' option.
1291
 
 
 
707
     Convert from a old geo file format to the new one.  
 
708
 
 
709
`-image-format `string''
 
710
     The argument is any valid image format, such as         bitmap
 
711
     `png', `jpg', `gif' or vectorial `ps' or `pdf'         image file
 
712
     formats, and that could be handled by the corresponding render.
 
713
          The output file is e.g. `_basename_.png' when _basename_
 
714
       is the name of the mesh, or can be set with the `-name' option.
1292
715
 
1293
716
Others options
1294
717
--------------
1318
741
`-dump'
1319
742
     used for debug purpose.
1320
743
 
1321
 
Graphic output file
1322
 
-------------------
1323
 
 
1324
 
You can generate a `postscript',     `latex' or `Fig'     output of
1325
 
your mesh, using     the `geo' command with     `-gnuplot -noclean'
1326
 
options, and then modifying the     `.plot' generated file.
1327
 
 
1328
744
Geo file format
1329
745
---------------
1330
746
 
1331
 
This is the default mesh file format. It contains two entitiess, namely
1332
 
a mesh and a list of domains. The mesh entity starts with the header.
1333
 
The header contains the `mesh' keyword followed by a line containing a
1334
 
format version number, the space dimension (e.g. 1, 2 or 3), the number
1335
 
of vertices, the number of elements. For file format version 2, when
1336
 
dimension is three, the number of faces is specified, and then, when
1337
 
dimension is two or three, the number of edges is also specified.
1338
 
Follows the vertex coordinates, the elements and the faces or edges.
1339
 
One element starts with a letter indicating the element type
1340
 
`p'
1341
 
     point
1342
 
 
1343
 
`e'
1344
 
     edge
1345
 
 
1346
 
`t'
1347
 
     triangle
1348
 
 
1349
 
`q'
1350
 
     quadrangle
1351
 
 
1352
 
`T'
1353
 
     tetrahedron
1354
 
 
1355
 
`P'
1356
 
     prism
1357
 
 
1358
 
`H'
1359
 
     hexaedron
1360
 
Then, we have the vertex indexes.  A vertex index is numbered in the
1361
 
C-style, i.e. the first index is numbered 0.  An edge is a couple of
1362
 
index.
1363
 
 
1364
 
Geo version 1 file format (obsolete) does neither give any information
1365
 
about edges for 2d meshes nor for faces in 3d. This information is
1366
 
requiered for maintaining P2 approximation file in a consistent way,
1367
 
since edge and face numbering algorithm should vary from one version to
1368
 
another, and thus may be stored on file.
1369
 
 
1370
 
Nevertheless, geo version 1 file format is still supported, since it is
1371
 
a convenient way to build and import meshes (*note geo command::).
1372
 
 
1373
 
A sample mesh is in version 1 writes
1374
 
             mesh
1375
 
             1 2 4 2
1376
 
             0 0
1377
 
             1 0
1378
 
             1 1
1379
 
             0 1
1380
 
             t   0 1 3
1381
 
             t   1 2 3
1382
 
 
1383
 
the same in version 2
1384
 
             mesh
1385
 
             2 2 4 2 5
1386
 
             0 0
1387
 
             1 0
1388
 
             1 1
1389
 
             0 1
1390
 
             t   0 1 3
1391
 
             t   1 2 3
1392
 
             0 1
1393
 
             1 2
1394
 
             2 3
1395
 
             3 0
1396
 
             1 3
1397
 
 
1398
 
The second entity is a list of domains, that finishes with the end of
1399
 
file. A domain starts with the `domain' keyword, followed by a domain
1400
 
name.  Then, the format version number (i.e. 1 today), and the number
1401
 
of sides. Follows the sides
1402
 
             domain
1403
 
             bottom
1404
 
             1 1 1
1405
 
             e   0 1
1406
 
 
1407
 
             domain
1408
 
             top
1409
 
             1 1 1
1410
 
             e   2 3
1411
 
 
1412
 
 
1413
 
File: rheolef.info,  Node: bamg2geo command,  Up: Commands
1414
 
 
1415
 
4.6 bamg2geo - convert bamg mesh in geo format
1416
 
==============================================
1417
 
 
1418
 
(Source file: `nfem/bin/bamg2geo') 
1419
 
 
1420
 
Synopsis
1421
 
--------
1422
 
 
1423
 
       bamg2geo OPTIONS INPUT[.bamg] INPUT[.dmn]
1424
 
       bamg2geo OPTIONS INPUT[.bamg] -Cl DOMLABEL
1425
 
       bamg2geo OPTIONS INPUT[.bamg] {-dom DOMNAME}*
1426
 
 
1427
 
Description
1428
 
-----------
1429
 
 
1430
 
Convert a bamg `.bamg' into `.geo' one.  The output goes to standart
1431
 
output.  The `.dmn' file specifies the domain names, since `bamg' mesh
1432
 
generator uses numbers as domain labels.
1433
 
 
1434
 
Example
1435
 
-------
1436
 
 
1437
 
       bamg -g toto.bamgcad -o toto.bamg
1438
 
       bamg2geo toto.bamg toto.dmn > toto.geo
1439
 
 
1440
 
Bamg cad file
1441
 
-------------
1442
 
 
1443
 
This file describe the boundary of the mesh geometry.  A basic example
1444
 
writes (See bamg documentation for more);
1445
 
       MeshVersionFormatted
1446
 
         0
1447
 
       Dimension
1448
 
         2
1449
 
       Vertices
1450
 
         4
1451
 
         0  0     1
1452
 
         1  0     2
1453
 
         1  1     3
1454
 
         0  1     4
1455
 
       Edges
1456
 
         4
1457
 
         1  2     101
1458
 
         2  3     102
1459
 
         3  4     103
1460
 
         4  1     104
1461
 
       hVertices
1462
 
         0.1 0.1 0.1 0.1
1463
 
 
1464
 
Domain name file
1465
 
----------------
1466
 
 
1467
 
This auxilliary `.dmn' file defines the boundary domain names as used
1468
 
by Rheolef, since `bamg' uses numeric labels for domains.
1469
 
       EdgeDomainNames
1470
 
         4
1471
 
         bottom
1472
 
         right
1473
 
         top
1474
 
         left
1475
 
 
1476
 
The domain name file can also specify additional vertices domain
1477
 
----------------------------------------------------------------
1478
 
 
1479
 
       EdgeDomainNames
1480
 
         4
1481
 
         bottom
1482
 
         right
1483
 
         top
1484
 
         left
1485
 
       VerticeDomainNames
1486
 
         4
1487
 
         left_bottom
1488
 
         right_bottom
1489
 
         right_top
1490
 
         left_top
1491
 
Vertice domain names are usefull for some special boundary conditions.
1492
 
 
1493
 
Options
1494
 
-------
1495
 
 
1496
 
`-upgrade'
1497
 
`-noupgrade'
1498
 
     Default is to output a version 2 `.geo' file format. *Note geo
1499
 
     command::.          With the `-noupgrade', a version 1 file format
1500
 
     is assumed.
1501
 
 
1502
 
`-dom DOM1 ... -dom DOMN'
1503
 
`-Cl {poi|sed|sec|tro|con|NONE}'
1504
 
     Predefined domain name convention. See next section.
1505
 
 
1506
 
 
1507
 
File: rheolef.info,  Node: mesh2geo command,  Up: Commands
1508
 
 
1509
 
4.7 mesh2geo - convert mmg3d mesh in geo format
1510
 
===============================================
1511
 
 
1512
 
(Source file: `nfem/bin/mesh2geo') 
1513
 
 
1514
 
Synopsis
1515
 
--------
1516
 
 
1517
 
       mesh2geo OPTIONS INPUT[.mesh] INPUT[.dmn]
1518
 
 
1519
 
Description
1520
 
-----------
1521
 
 
1522
 
Convert a mesh `.mesh' into `.geo' one.  The output goes to standart
1523
 
output.  The `.dmn' file specifies the domain names, since `mmg3d' mesh
1524
 
generator uses numbers as domain labels.
1525
 
 
1526
 
Example
1527
 
-------
1528
 
 
1529
 
       mmg3d -O 1 -in toto.mesh -out toto-opt.mesh
1530
 
       mesh2geo toto-opt.mesh toto.dmn > toto-opt.geo
1531
 
 
1532
 
Domain name file
1533
 
----------------
1534
 
 
1535
 
This auxilliary `.dmn' file defines the boundary domain names as used
1536
 
by Rheolef, since `mmg3d' uses numeric labels for domains.
1537
 
 
1538
 
Options
1539
 
-------
1540
 
 
1541
 
`-upgrade'
1542
 
`-noupgrade'
1543
 
     Default is to output a version 2 `.geo' file format. *Note geo
1544
 
     command::.          With the `-noupgrade', a version 1 file format
1545
 
     is assumed.
 
747
TODO
 
748
 
 
749
Input format options
 
750
--------------------
 
751
 
 
752
TODO
 
753
 
 
754
Inquire options
 
755
---------------
 
756
 
 
757
TODO
1546
758
 
1547
759
 
1548
760
File: rheolef.info,  Node: field command,  Up: Commands
1549
761
 
1550
 
4.8 `field' - plot a field
 
762
4.2 `field' - plot a field
1551
763
==========================
1552
764
 
1553
 
(Source file: `nfem/bin/xfield.cc') 
 
765
(Source file: `nfem/pbin/field.cc') 
1554
766
 
1555
767
Synopsis
1556
768
--------
1557
769
 
1558
 
             field [-IDIR] FILENAME
 
770
             field OPTIONS FILENAME[.field[.gz]]
1559
771
 
1560
772
Description
1561
773
-----------
1573
785
Input file specification
1574
786
------------------------
1575
787
 
1576
 
`-IDIR'
1577
 
     add DIR to the RHEOPATH search path.          See also *note geo
1578
 
     class:: for RHEOPATH mechanism.
1579
 
 
1580
788
`FILENAME'
1581
789
     specifies the name of the file containing         the input field.
1582
790
 
1583
791
`-'
1584
792
     read field on standard input instead on a file.
1585
793
 
1586
 
`-name'
1587
 
     when field data comes from standard input, the field name
1588
 
     is not known and is set to "output" by default.          This
1589
 
     option allows to change this default.          Useful when dealing
1590
 
     with output formats (graphic, format conversion)         that
1591
 
     creates auxilliary files, based on this name.
1592
 
 
1593
 
 
1594
 
Input format options
1595
 
--------------------
1596
 
 
1597
 
`-input-field'
1598
 
     read the data in the `.field' format.          This is the default.
1599
 
 
1600
 
`-input-cemagref'
1601
 
     input data in cemagref file format.          The field represents
1602
 
     the topographic elevation         and is assumed to be a `P1'
1603
 
     approximation.
1604
 
 
1605
 
Output format options
1606
 
---------------------
 
794
 
 
795
Output file format options
 
796
--------------------------
1607
797
 
1608
798
`-field'
1609
 
`-text'
1610
 
     output field on standard output stream in field text file format.
1611
 
 
1612
 
`-bamg'
1613
 
     output field on standard output stream in bamg file format.
1614
 
 
1615
 
`-mmg3d'
1616
 
     output field on standard output stream in mmg3d file format.
1617
 
 
1618
 
`-gmsh'
1619
 
     output field on standard output stream in gmsh file format.
1620
 
 
1621
 
`-cemagref'
1622
 
     output field on standard output stream in cemagref file format.
1623
 
          The field represents         the topographic elevation and is
1624
 
     assumed to be a `P1' approximation.          This option is
1625
 
     suitable for file format conversion:
1626
 
 
1627
 
`-ndigit INT'
1628
 
     number of digits used to print floating point values.
1629
 
     Default depends upon the machine precision associated to the
1630
 
      `Float' type.
1631
 
 
1632
 
`-round'
1633
 
     Round the output, in order for the non-regression tests to
1634
 
     be portable across platforms. Floating point are machine-dependent.
1635
 
 
1636
 
 
1637
 
File format conversions
1638
 
-----------------------
1639
 
 
1640
 
Input and output options can be combined for efficient     file format
1641
 
conversion:
1642
 
                 field -input-cemagref -field - < mytopo.cemagref > mytopo.field
1643
 
                 field myfile.field -bamg > myfile.bb
1644
 
    can be performed in one pass:
1645
 
                 field -input-cemagref -bamg  - < mytopo.cemagref > myfile.bb
1646
 
 
1647
 
Getting information
1648
 
-------------------
1649
 
 
1650
 
`-min'
1651
 
`-max'
1652
 
     print the min (resp. max) value of the scalar field and then exit.
 
799
     output field on standard output stream in field text file format.  
 
800
 
 
801
`-image-format `string''
 
802
     The argument is any valid image format, such as         bitmap
 
803
     `png', `jpg', `gif' or vectorial `ps' or `pdf'         image file
 
804
     formats, and that could be handled by the corresponding render.
 
805
          The output file is e.g. `_basename_.png' when _basename_
 
806
       is the name of the mesh, or can be set with the `-name' option.
 
807
 
1653
808
 
1654
809
Render options
1655
810
--------------
1660
815
     use `gnuplot' tool.          This is the default for
1661
816
     monodimensional geometries.
1662
817
 
1663
 
`-mayavi'
1664
 
     use `mayavi' tool.          This is the default for bi- and
1665
 
     tridimensional geometries.
1666
 
 
1667
 
`-plotmtv'
1668
 
     use `plotmtv' plotting command, for bidimensional geometries.
1669
 
 
1670
 
`-vtk'
1671
 
     use `vtk' tool.          This is the old (no more supported) tool
1672
 
     for tridimensional geometries.          Could be used in 2d also.
1673
 
 
1674
818
 
1675
819
Rendering options
1676
820
-----------------
1679
823
`-gray'
1680
824
`-black-and-white'
1681
825
     Use (color/gray scale/black and white) rendering.          Color
1682
 
     rendering is the default.      
1683
 
 
1684
 
`-stereo'
1685
 
`-nostereo'
1686
 
     rendering mode: suitable for red-blue anaglyph 3D stereoscopic
1687
 
     glasses.
 
826
     rendering is the default.
1688
827
 
1689
828
`-fill'
1690
829
     isoline intervals are filled with color.          This is the
1693
832
`-nofill'
1694
833
     draw isolines by using lines.
1695
834
 
1696
 
`-grid'
1697
 
     mesh edges appear also.
1698
 
 
1699
 
`-nogrid'
1700
 
     prevent mesh edges drawing.          This is the default.
1701
 
 
1702
 
`-proj'
1703
 
     Convert all selected fields to P1-continuous approximation by
1704
 
     using a L2 projection.          Usefull when input is a
1705
 
     discontinuous field (e.g. P0 or P1d).
1706
 
 
1707
 
`-iso FLOAT'
1708
 
     extract an iso-value set of points (1d), lines (2d)         or
1709
 
     surfaces (3d) for a specified value. Output         the surface in
1710
 
     text format (with `-text' option)         or using a graphic
1711
 
     driver.          This option requires the `vtk' code.
1712
 
 
1713
 
`-noiso'
1714
 
     do not draw isosurface.
1715
 
 
1716
 
`-volume'
1717
 
`-novolume'
1718
 
     This is an experimental volume representation by using ray cast
1719
 
     (mayavi and vtk graphics).
1720
 
 
1721
 
`-n-iso INT'
1722
 
     For 2D visualizations, the isovalue table contains
1723
 
     regularly spaced values from fmin to fmax, the bounds         of
1724
 
     the field.  
1725
 
 
1726
 
`-n-iso-negative INT'
1727
 
     The isovalue table is splitted into negatives and positives values.
1728
 
            Assume there is n_iso=15 isolines: if 4 is requested by
1729
 
     this option,         then, there will be 4 negatives isolines,
1730
 
     regularly spaced         from fmin to 0 and 11=15-4 positive
1731
 
     isolines, regularly spaced         from 0 to fmax.          This
1732
 
     option is usefull when plotting e.g. vorticity or stream
1733
 
     functions, where the sign of the field is representative.
1734
 
 
1735
 
`-label'
1736
 
`-nolabel'
1737
 
     Write or do not write labels for values on isolines on         2d
1738
 
     contour plots when using  `plotmtv' output.  
1739
 
 
1740
835
`elevation'
1741
836
     For two dimensional field, represent values as elevation
1742
837
     in the third dimension.
1745
840
     Prevent from the `elevation' representation.          This is the
1746
841
     default.
1747
842
 
1748
 
`-scale FLOAT'
1749
 
     applies a multiplicative factor to the field.          This is
1750
 
     useful e.g. in conjonction with the `elevation' option.
1751
 
     The default value is 1.
1752
 
 
1753
 
`-cut'
1754
 
     show a cut by a specified plane.          The cutting plane is
1755
 
     specified by its origin point and normal vector.          This
1756
 
     option requires the `vtk' code.
1757
 
 
1758
 
`-origin FLOAT [FLOAT [FLOAT]]'
1759
 
     set the origin of the cutting plane.          Default is (0.5,
1760
 
     0.5, 0.5).
1761
 
 
1762
 
`-normal FLOAT [FLOAT [FLOAT]]'
1763
 
     set the normal of the cutting plane.          Default is (1, 0, 0).
1764
 
 
1765
843
 
1766
844
Others options
1767
845
--------------
1819
897
  This command generates the isosurface as a 3d surface mesh in
1820
898
`.geo' format. This is suitable for others treatments.
1821
899
 
1822
 
 
1823
 
File: rheolef.info,  Node: cemagref2field command,  Up: Commands
1824
 
 
1825
 
4.9 cemagref2field - convert cemagref topography in field and geo formats
1826
 
=========================================================================
1827
 
 
1828
 
(Source file: `nfem/bin/cemagref2field') 
1829
 
 
1830
 
Synopsis
1831
 
--------
1832
 
 
1833
 
       cemagref2field OPTIONS INPUT[.cemagref]
1834
 
 
1835
 
Description
1836
 
-----------
1837
 
 
1838
 
Convert a cemagref `.cemagref' topography data file into `.field' and
1839
 
its associated `.geo' files.  The `.field' output goes to standart
1840
 
output, while the compressed `.geo' is created as INPUT.`geo.gz' using
1841
 
`gzip'.
1842
 
 
1843
 
Example
1844
 
-------
1845
 
 
1846
 
       cemagref2field toto.cemagref > toto-z.field
1847
 
       cemagref2field -cemagref toto.dat > toto-z.field
1848
 
and a `toto.geo.gz'.
1849
 
 
1850
 
Options
1851
 
-------
1852
 
 
1853
 
`-cemagref INPUT'
1854
 
     specifies directly the input file, for an alternate suffix
1855
 
     convention.
1856
 
 
1857
 
 
1858
 
File: rheolef.info,  Node: qmg2geo command,  Up: Commands
1859
 
 
1860
 
4.10 qmg2geo - convert qmg mesh in geo format
1861
 
=============================================
1862
 
 
1863
 
(Source file: `nfem/bin/qmg2geo') 
1864
 
 
1865
 
Description
1866
 
-----------
1867
 
 
1868
 
Convert a qmg `.qmg' into `.geo' one.  The output goes to standart
1869
 
output.
1870
 
 
1871
 
Synopsis
1872
 
--------
1873
 
 
1874
 
       qmg2geo [-qmg] INPUT.qmg INPUT.dmn
1875
 
 
1876
 
Domain name file
1877
 
----------------
1878
 
 
1879
 
This auxilliary `.dmn' file defines the boundary domain names as used
1880
 
by Rheolef, since `qmg' uses numeric labels for domains.
1881
 
       EdgeDomainNames
1882
 
         4
1883
 
         bottom
1884
 
         right
1885
 
         top
1886
 
         left
1887
 
 
1888
 
 
1889
 
File: rheolef.info,  Node: space command,  Up: Commands
1890
 
 
1891
 
4.11 `space' - print a finite element space
1892
 
===========================================
1893
 
 
1894
 
(Source file: `nfem/bin/xspace.cc')
1895
 
 
1896
 
Synopsis
1897
 
--------
1898
 
 
1899
 
            `space' FILENAME[.space]
1900
 
 
1901
 
Description
1902
 
-----------
1903
 
 
1904
 
Read and re-output a finite element space.
1905
 
 
1906
 
Example
1907
 
-------
1908
 
 
1909
 
enter command as:
1910
 
           space < my.space
1911
 
 
1912
 
Space format
1913
 
------------
1914
 
 
1915
 
This is the default space file format.      The file     starts with
1916
 
the header: the "space" keyword followed by     a line containing a
1917
 
format version number (i.e. 1 today),     and the number of degrees of
1918
 
freedom.      Follows the numbering and an optional 'B' label, if the
1919
 
 degree of freedom is blocked.      A sample space is:
1920
 
 
1921
 
            space
1922
 
            1 3
1923
 
            0 B
1924
 
            1 B
1925
 
            0
1926
 
            2 B
1927
 
            1
 
900
Input file format options
 
901
-------------------------
 
902
 
 
903
TODO
 
904
 
 
905
File format conversions
 
906
-----------------------
 
907
 
 
908
TODO
 
909
 
 
910
Getting information
 
911
-------------------
 
912
 
 
913
TODO
1928
914
 
1929
915
 
1930
916
File: rheolef.info,  Node: msh2geo command,  Up: Commands
1931
917
 
1932
 
4.12 msh2geo - convert gmsh mesh in geo format
1933
 
==============================================
 
918
4.3 `msh2geo' - msh2geo - convert gmsh mesh in geo format
 
919
=========================================================
1934
920
 
1935
 
(Source file: `nfem/bin/msh2geo') 
 
921
(Source file: `nfem/pbin/msh2geo.cc') 
1936
922
 
1937
923
Synopsis
1938
924
--------
1939
925
 
1940
 
       msh2geo OPTIONS INPUT[.msh]
 
926
       msh2geo < INPUT[.msh] > OUTPUT.geo
1941
927
 
1942
928
Description
1943
929
-----------
1944
930
 
1945
931
Convert a gmsh `.msh' into `.geo' one.  The output goes to standart
1946
 
output.
 
932
output.  See the `gmsh' documentation for a detailed description of the
 
933
`.mshcad' input file for `gmsh'.
1947
934
 
1948
935
Example
1949
936
-------
1950
937
 
1951
938
       gmsh -2 toto.mshcad -o toto.msh
1952
 
       msh2geo toto.msh > toto.geo
1953
 
See the `gmsh' documentation for a detailed description  of the
1954
 
`.mshcad' input file for `gmsh'.
1955
 
 
1956
 
 
1957
 
File: rheolef.info,  Node: branch command,  Up: Commands
1958
 
 
1959
 
4.13 `branch' - handle a family of fields
1960
 
=========================================
1961
 
 
1962
 
(Source file: `nfem/bin/branch.cc')
1963
 
 
1964
 
Synopsis
1965
 
--------
1966
 
 
1967
 
             branch [OPTIONS] FILENAME
1968
 
 
1969
 
Example
1970
 
-------
1971
 
 
1972
 
Generates vtk file colection for visualization with paraview:
1973
 
             branch output.branch -paraview
1974
 
 
1975
 
Description
1976
 
-----------
1977
 
 
1978
 
Read and output a branch of finite element fields from file,   in field
1979
 
text file format.
1980
 
 
1981
 
Input file specification
1982
 
------------------------
1983
 
 
1984
 
`-IDIR'
1985
 
     add DIR to the RHEOPATH search path.          See also *note geo
1986
 
     class:: for RHEOPATH mechanism.
1987
 
 
1988
 
`FILENAME'
1989
 
     specifies the name of the file containing         the input field.
1990
 
 
1991
 
`-'
1992
 
     read field on standard input instead on a file.
1993
 
 
1994
 
`-ndigit INT'
1995
 
     Number of digits used to print floating point values         when
1996
 
     using the `-geo' option.          Default depends upon the machine
1997
 
     precision associated to the         `Float' type.
1998
 
 
1999
 
 
2000
 
Output and render specification
2001
 
-------------------------------
2002
 
 
2003
 
`-extract INT'
2004
 
     Extract the i-th record in the file. The output         is a field
2005
 
     or multi-field file format.
2006
 
 
2007
 
`-branch'
2008
 
     Output on stdout in `.branch' format.          This is the default.
2009
 
 
2010
 
`-paraview'
2011
 
     Generate a collection of `vtk' files         for using `paraview'.
2012
 
 
2013
 
`-vtk'
2014
 
     Generate a single `vtk' file         with numbered fields.
2015
 
 
2016
 
`-gnuplot'
2017
 
     Run 1d animation using `gnuplot'.
2018
 
 
2019
 
`-plotmtv'
2020
 
     This driver is unsupported for animations.
2021
 
 
2022
 
 
2023
 
Other options
2024
 
-------------
2025
 
 
2026
 
`-topography FILENAME[.field[.gz]]'
2027
 
     performs a tridimensionnal elevation view based         on the
2028
 
     topographic data.
2029
 
 
2030
 
`-proj'
2031
 
     performs a `P1' projection on the fly.          This option is
2032
 
     useful when rendering `P0' data         while `vtk' render
2033
 
     requieres `P1' description.
2034
 
 
2035
 
`-elevation'
2036
 
     For  two  dimensional  field, represent values as elevation in the
2037
 
     third dimension.          This is the default.
2038
 
 
2039
 
`-noelevation'
2040
 
     Prevent from the elevation representation.
2041
 
 
2042
 
`-scale FLOAT'
2043
 
     applies a multiplicative factor to the field.          This is
2044
 
     useful e.g. in conjonction with the `elevation' option.
2045
 
     The default value is 1.
2046
 
 
2047
 
`-verbose'
2048
 
     print messages related to graphic files created and        command
2049
 
     system calls (this is the default).
2050
 
 
2051
 
`-noverbose'
2052
 
     does not print previous messages.
2053
 
 
2054
 
`-clean'
2055
 
     clear temporary graphic files (this is the default).
2056
 
 
2057
 
`-noclean'
2058
 
     does not clear temporary graphic files.
2059
 
 
2060
 
`-execute'
2061
 
     execute graphic command (this is the default).
2062
 
 
2063
 
`-noexecute'
2064
 
     does not execute graphic command. Generates only         graphic
2065
 
     files. This is usefull in conjuction with the         `-noclean'
2066
 
     command.
2067
 
 
2068
 
 
2069
 
Branch file format
 
939
       msh2geo < toto.msh > toto.geo
 
940
       gmsh -2 -order 2 toto.mshcad -o toto2.msh
 
941
       msh2geo < toto2.msh > toto2.geo
 
942
 
 
943
Notes
 
944
-----
 
945
 
 
946
Pk triangle, when k>=5, may have internal nodes renumbered: from the
 
947
 
 
948
Gmsh documentation
2070
949
------------------
2071
950
 
2072
 
The `.branch' file format bases on the `.field' one:
2073
 
            EXAMPLE          GENERAL FORM
2074
 
 
2075
 
             #!branch        #!branch
2076
 
             branch          branch
2077
 
               1 1 11        <version> <nfield=1> <nvalue=N>
2078
 
               time u        <key> <field name>
2079
 
 
2080
 
               #time 3.14    #<key> <key value 1>
2081
 
               #u            #<field name>
2082
 
               field         <field 1>
2083
 
               .....         ....
2084
 
 
2085
 
               .....         ....
2086
 
               #time 6.28    #<key> <key value N>
2087
 
               #u            #<field name>
2088
 
               field         <field N>
2089
 
               .....         ....
2090
 
   The key name is here `time', but could be any string (without
2091
 
spaces).     The previous example contains one `field' at each time
2092
 
step.     Labels appears all along the file to facilitate direct jumps
2093
 
and field and step skips.
2094
 
 
2095
 
The format supports several fields, such as (t,u(t),p(t)), where u could
2096
 
  be a multi-component (e.g. a vector) field:
2097
 
             #!branch
2098
 
             branch
2099
 
               1 2 11
2100
 
               time u p
2101
 
 
2102
 
               #time 3.14
2103
 
               #u
2104
 
               mfield
2105
 
               1 2
2106
 
               #u0
2107
 
               field
2108
 
               ...
2109
 
               #u1
2110
 
               field
2111
 
               ...
2112
 
               #p
2113
 
 
2114
 
               #time 6.28
2115
 
               ...
2116
 
 
2117
 
 
2118
 
File: rheolef.info,  Node: cad command,  Up: Commands
2119
 
 
2120
 
4.14 `cad' - plot a boundary file
2121
 
=================================
2122
 
 
2123
 
(Source file: `nfem/bin/cad.cc') 
2124
 
 
2125
 
Description
2126
 
-----------
2127
 
 
2128
 
Manipulates geometry boundary files (CAD, Computer Aid Design):
2129
 
visualizations and file conversions.    This command is under
2130
 
development.
2131
 
 
2132
 
Synopsis
2133
 
--------
2134
 
 
2135
 
             col < FILE[.qmgcad] | cad -input-qmg - OPTIONS...
2136
 
 
2137
 
Examples
2138
 
--------
2139
 
 
2140
 
The `qmg' logo:
2141
 
             col < ../data/logo2.qmgcad  | cad -input-qmg - -noclean
2142
 
             gnuplot output.plot
2143
 
  A torus:
2144
 
             col < ../data/test2-out.qmgcad | cad -input-qmg -
2145
 
  In the `geomview' window, enter '2as' key sequence to switch to a
2146
 
smooth   rendering.
2147
 
 
2148
 
Unresolved issues
2149
 
-----------------
2150
 
 
2151
 
The `qmg' demonstration files comes from PC-DOS and contains line-feed
2152
 
characters that are not filtered by `flex' when reading   file. Thus,
2153
 
the `col' filter is required.
2154
 
 
2155
 
Included surfaces, such as cracks, are hiden in 3D with `geomview'.
2156
 
Thus, `vtk' rendering with some transparency factor would be better.
2157
 
 
2158
 
`bamg' and `grummp' boundary files are not yet supported.    They will
2159
 
be in the future.
2160
 
 
2161
 
Input file specification
2162
 
------------------------
2163
 
 
2164
 
`FILENAME'
2165
 
     specifies the name of the file containing         the input mesh.
2166
 
     The ".cad" extension is assumed.
2167
 
 
2168
 
`-ICADDIR'
2169
 
     add CADDIR to the mesh search path.          This mechanism
2170
 
     initializes a search path given by the environment variable
2171
 
     `RHEOPATH'. If the environment variable         `RHEOPATH' is not
2172
 
     set, the         default value is the current directory
2173
 
     (*note cad class::).
2174
 
 
2175
 
`-'
2176
 
     read mesh on standard input instead on a file.
2177
 
 
2178
 
Input format options
2179
 
--------------------
2180
 
 
2181
 
`-input-cad'
2182
 
     read the boundary in the `.cad' format.          This is the
2183
 
     default         (TODO: not yet, uses qmg instead).
2184
 
 
2185
 
`-input-qmg'
2186
 
     read the boundary in the `.qmgcad' format.          In `qmg', this
2187
 
     file format is known as _brep_, that         stands for boundary
2188
 
     representation.
2189
 
 
2190
 
Output format options
2191
 
---------------------
2192
 
 
2193
 
`-cad'
2194
 
     output boundary on standard output stream in cad text file format,
2195
 
            instead of plotting it.
2196
 
 
2197
 
`-geomview'
2198
 
     use geomview rendering tool.          This is the default for
2199
 
     tridimensional data.
2200
 
 
2201
 
`-gnuplot'
2202
 
     use gnuplot rendering tool.          This is the default for
2203
 
     bidimensional data.
2204
 
 
2205
 
Render options
2206
 
--------------
2207
 
 
2208
 
`-subdivide NSUB'
2209
 
     Subdivide each Bezier patch in DEGREE*NSUB linear
2210
 
     sub-element.          For rendering tools that does not support
2211
 
     Bezier patches, such         as `gnuplot' or `geomview'.
2212
 
     Default is NSUB=3 for tridimensional data and         NSUB=50 for
2213
 
     bidimensional data.
2214
 
 
2215
 
`-no-bezier-adapt'
2216
 
     Subdivide each Bezier patch in NSUB instead         of DEGREE*NSUB.
2217
 
 
2218
 
`-bezier-adapt'
2219
 
     Subdivide each Bezier patch in of DEGREE*NSUB.          This is
2220
 
     the default.
2221
 
 
2222
 
Others options
2223
 
--------------
2224
 
 
2225
 
`-verbose'
2226
 
     print messages related to graphic files created and
2227
 
     command system calls (this is the default).
2228
 
 
2229
 
`-noverbose'
2230
 
     does not print previous messages.
2231
 
 
2232
 
`-clean'
2233
 
     clear temporary graphic files (this is the default).
2234
 
 
2235
 
`-noclean'
2236
 
     does not clear temporary graphic files.
2237
 
 
2238
 
`-execute'
2239
 
     execute graphic command (this is the default).
2240
 
 
2241
 
`-noexecute'
2242
 
     does not execute graphic command. Generates only         graphic
2243
 
     files. This is usefull in conjuction with the         "-noclean"
2244
 
     command.
2245
 
 
 
951
       The nodes of a curved element are numbered in the following order:
 
952
 
 
953
         the element principal vertices;
 
954
         the internal nodes for each edge;
 
955
         the internal nodes for each face;
 
956
         the volume internal nodes.
 
957
 
 
958
       The numbering for face and volume internal nodes is recursive,
 
959
       i.e., the numbering follows that of the nodes of an embedded face/volume.
 
960
       The higher order nodes are assumed to be equispaced on the element.
 
961
 
 
962
In rheolef, internal triangle nodes are numbered from left to right and
 
963
then from bottom to top. The numbering differ for triangle when k >= 5.
 
964
Thus, `msh2geo' fix the corresponding internal nodes numbering during
 
965
the conversion.
 
966
 
 
967
Pk tetrahedrons and hexaedrons in gmsh and rheolef has not the same
 
968
edge-node order nd orientation.  E.g. for tetrahedrons, edges 13 and 23
 
969
should be swaped and reoriented as 32 and 31.  Thus, `msh2geo' fix the
 
970
corresponding internal nodes numbering.
 
971
 
 
972
Todo
 
973
----
 
974
 
 
975
Fix for P3-tetra: swap edges orientations for 3,4,5 and swap faces 1
 
976
and 2. Check P4(T) for face orientation.  Perform face visualisation
 
977
with gnuplot face fill.
 
978
 
 
979
See also hexa edges orient and faces numbers and orient.
 
980
 
 
981
Check that node are numbered by vertex-node, then edge-node, then
 
982
face(tri,qua)-node and then volume(T,P,H)-node.  Otherwise, renumber
 
983
all nodes.
 
984
 
 
985
Support for high order >= 6 element ? not documented in gmsh, but gmsh
 
986
supports it at run
2246
987
 
2247
988
 
2248
989
File: rheolef.info,  Node: rheolef-config command,  Up: Commands
2249
990
 
2250
 
4.15 rheolef-config - get installation directories
2251
 
==================================================
 
991
4.4 rheolef-config - get installation directories
 
992
=================================================
2252
993
 
2253
994
(Source file: `rheolef-config.in') 
2254
995
 
2338
1079
`--hardcode-libdir-flag-spec'
2339
1080
     flag to hardcode a libdir into a binary during linking.
2340
1081
 
 
1082
`--is-distributed'
 
1083
     true or false: whether it is the distributed version.
 
1084
 
2341
1085
 
2342
1086
File: rheolef.info,  Node: Classes,  Up: Top
2343
1087
 
2346
1090
 
2347
1091
* Menu:
2348
1092
 
2349
 
* cad class::
2350
1093
* geo class::
2351
 
* form_diag_manip class::
 
1094
* geo_domain class::
 
1095
* geo_domain_indirect class::
2352
1096
* space class::
2353
 
* form_diag class::
2354
 
* form_manip class::
 
1097
* form_element class::
 
1098
* domain_indirect class::
 
1099
* rheolef class::
2355
1100
* field class::
2356
 
* trace class::
2357
 
* domain class::
 
1101
* element class::
2358
1102
* form class::
2359
 
* branch class::
2360
1103
* tensor class::
2361
1104
* point class::
2362
 
* ic0 class::
2363
 
* permutation class::
 
1105
* pcg class::
 
1106
* index_set class::
 
1107
* mpi_assembly_end class::
 
1108
* msg_left_permutation_apply class::
 
1109
* polymorphic_map class::
 
1110
* mpi_polymorphic_assembly_begin class::
 
1111
* polymorphic_array class::
 
1112
* mpi_polymorphic_assembly_end class::
 
1113
* distributor class::
 
1114
* msg_from_context_indices class::
 
1115
* msg_both_permutation_apply class::
 
1116
* msg_right_permutation_apply class::
 
1117
* mpi_assembly_begin class::
 
1118
* solver class::
 
1119
* array class::
2364
1120
* vec class::
2365
 
* ssk class::
 
1121
* msg_local_optimize class::
 
1122
* msg_to_context class::
 
1123
* asr class::
2366
1124
* csr class::
2367
 
* diag class::
 
1125
* msg_from_context_pattern class::
 
1126
* msg_local_context class::
 
1127
* mpi_scatter_init class::
 
1128
* eye class::
 
1129
* mpi_scatter_begin class::
 
1130
* mpi_scatter_end class::
2368
1131
* iorheo class::
2369
1132
* Vector class::
2370
1133
* catchmark class::
2371
1134
* rheostream class::
2372
1135
 
2373
1136
 
2374
 
File: rheolef.info,  Node: cad class,  Up: Classes
2375
 
 
2376
 
5.1 `cad' - the boundary definition class
2377
 
=========================================
2378
 
 
2379
 
(Source file: `nfem/lib/cad.h') 
2380
 
 
2381
 
Description
2382
 
-----------
2383
 
 
2384
 
The `cad' class defines a container for the   description of the
2385
 
boundary of a geometry, by using   Bezier patches.
2386
 
 
2387
 
The aim is to handle high-level polynomial interpolation   together
2388
 
with curved boundaries (non-polynomial). So, the   description bases on
2389
 
Bezier curves and surfaces.
2390
 
 
2391
 
Also, the adaptive mesh loop requieres interpolation on the   boundary,
2392
 
and this class should facilitates such procedures.
2393
 
 
2394
 
This class is actually under development.
2395
 
 
2396
 
File format
2397
 
-----------
2398
 
 
2399
 
Under definition.
2400
 
 
2401
 
File format conversion
2402
 
----------------------
2403
 
 
2404
 
Under development.    Conversion to geomview and vtk for visualization.
2405
 
 Also to and from qmg, grummp, modulef/ghs, opencascade for
2406
 
compatibility.
2407
 
 
2408
 
Implementation
2409
 
--------------
2410
 
 
2411
 
     class cad : public smart_pointer<cad_rep> {
2412
 
     public:
2413
 
     // typedefs:
2414
 
 
2415
 
             typedef cad_rep::size_type size_type;
2416
 
 
2417
 
 
2418
 
     // allocator:
2419
 
 
2420
 
             cad();
2421
 
             cad (const std::string& file_name);
2422
 
 
2423
 
     // accessors:
2424
 
 
2425
 
             size_type dimension() const;
2426
 
             size_type n_face() const;
2427
 
 
2428
 
             const point& xmin() const;
2429
 
             const point& xmax() const;
2430
 
 
2431
 
             void  eval (const cad_element& S, const point& ref_coord, point & real_coord) const;
2432
 
             point eval (const cad_element& S, const point& ref_coord) const;
2433
 
 
2434
 
     // input/output:
2435
 
 
2436
 
             friend std::istream& operator >> (std::istream& is, cad& x);
2437
 
             friend std::ostream& operator << (std::ostream& os, const cad& x);
2438
 
     };
2439
 
 
2440
 
 
2441
1137
File: rheolef.info,  Node: geo class,  Up: Classes
2442
1138
 
2443
 
5.2 `geo' - the finite element mesh class
2444
 
=========================================
 
1139
5.1 geo - finite element mesh
 
1140
=============================
2445
1141
 
2446
 
(Source file: `nfem/lib/geo.h') 
 
1142
(Source file: `nfem/plib/geo.h')
2447
1143
 
2448
1144
Synopsys
2449
1145
--------
2450
1146
 
2451
 
The `geo' class defines a container for a finite element mesh. This
2452
 
describes the nodes coordinates and the connectivity.  `geo' can
2453
 
contains domains, usefull for boundary condition setting.
2454
 
 
2455
 
Example
2456
 
-------
2457
 
 
2458
 
A sample usage of the geo class writes
2459
 
        geo omega;
2460
 
        cin >> omega;
2461
 
        cout << mayavi << full << omega;
2462
 
 
2463
 
Description
2464
 
-----------
2465
 
 
2466
 
The empty constructor makes an empty geo.  A string argument, as
2467
 
             geo g("square");
2468
 
will recursively look for a `square.geo[.gz]' file in the directory
2469
 
mentionned by the RHEOPATH environment variable, while `gzip'
2470
 
decompression is assumed.  If the file starts with `.' as `./square' or
2471
 
with a `/' as in `/home/oscar/square', no search occurs.  Also, if the
2472
 
environment variable RHEOPATH is not set, the default value is the
2473
 
current directory.
2474
 
 
2475
 
Input and output on streams are available, and manipulators works for
2476
 
text or graphic output (*note geo command::).
2477
 
 
2478
 
Finally, an STL-like interface provides efficient accesses to nodes,
2479
 
elements and domains.
2480
 
 
2481
 
Mesh adaptation
2482
 
---------------
2483
 
 
2484
 
The `geo_adapt' functions performs a mesh adaptation to improve the
2485
 
`P1'-Lagrange interpolation of the `field' given in argument (*note
2486
 
field class::).
2487
 
 
2488
 
Axisymetric geometry
2489
 
--------------------
2490
 
 
2491
 
The `coordinate_system' and `set_coordinate_system' members supports
2492
 
both `cartesian', `rz' and `zr' (axisymmetric) coordinate systems. This
2493
 
information is used by the `form' class (*note form class::).
2494
 
 
2495
 
Access to connectivity
2496
 
----------------------
2497
 
 
2498
 
The folowing code prints triangle vertex numbers
2499
 
       geo omega ("circle");
2500
 
       for (geo::const_iterator i = g.begin(); i != i.end(); i++) {
2501
 
         const geo_element& K = *i;
2502
 
         if (K.name() != 't') continue;
2503
 
         for (geo::size_type j = 0; j < 3; j++)
2504
 
           cout << K [j] << " ";
2505
 
         cout << endl;
2506
 
       }
2507
 
*Note geo_element internal::.
2508
 
 
2509
 
Access to vertice coordinates
2510
 
-----------------------------
2511
 
 
2512
 
The folowing code prints vertices coordinate
2513
 
       for (geo::const_iterator_vertex i = g.begin_vertex(); i != g.end_node(); i++) {
2514
 
         const point& xi = *i;
2515
 
         for (geo::size_type j = 0; j < g.dimension(); j++)
2516
 
           cout << xi [j] << " ";
2517
 
         cout << endl;
2518
 
       }
2519
 
 
2520
 
Access to domains
2521
 
-----------------
2522
 
 
2523
 
The following code prints edges on domain:
2524
 
       for (geo::const_iterator_domain i = g.begin_domain(); i != i.end_domain(); i++) {
2525
 
         const domain& dom = *i;
2526
 
         if (dom.dimension() != 2) continue;
2527
 
         for (domain::const_iterator j = dom.begin(); j < dom.end(); j++) {
2528
 
           const geo_element& E = *j;
2529
 
           cout << E [0] << " " << E[1] << endl;
2530
 
         }
2531
 
         cout << endl;
2532
 
       }
2533
 
*Note domain class::.
2534
 
 
2535
 
Environs
2536
 
--------
2537
 
 
2538
 
RHEOPATH: search path for geo data file.     Also *note form class::.
2539
 
 
2540
 
Implementation
2541
 
--------------
2542
 
 
2543
 
     class geo : public smart_pointer<georep> {
2544
 
     public:
2545
 
 
2546
 
     // typedefs:
2547
 
 
2548
 
       typedef georep::plot_options          plot_options;
2549
 
       void write_gnuplot_postscript_options (std::ostream& plot, const plot_options& opt) const;
2550
 
 
2551
 
       typedef georep::iterator              iterator;
2552
 
       typedef georep::const_iterator        const_iterator;
2553
 
       typedef georep::elemlist_type         elemlist_type;
2554
 
       typedef georep::nodelist_type         nodelist_type;
2555
 
       typedef georep::size_type             size_type;
2556
 
       typedef georep::domlist_type          domlist_type;
2557
 
 
2558
 
       typedef georep::const_iterator_node   const_iterator_node;
2559
 
       typedef georep::const_iterator_vertex const_iterator_vertex;
2560
 
       typedef georep::const_iterator_domain const_iterator_domain;
2561
 
       typedef georep::iterator_node         iterator_node;
2562
 
       typedef georep::iterator_vertex       iterator_vertex;
2563
 
       typedef georep::iterator_domain       iterator_domain;
2564
 
 
2565
 
     // allocators/deallocators:
2566
 
 
2567
 
       explicit geo (const std::string& filename, const std::string& coord_sys = "cartesian");
2568
 
       geo(const geo& g, const domain& d);
2569
 
       geo(const nodelist_type& p, const geo& g);
2570
 
       geo();
2571
 
 
2572
 
       friend geo geo_adapt (const class field& criteria, const Float& hcoef,
2573
 
             bool reinterpolate_criteria = false);
2574
 
 
2575
 
       friend geo geo_adapt (const class field& criteria,
2576
 
             const adapt_option_type& = adapt_option_type(),
2577
 
             bool reinterpolate_criteria = false);
2578
 
 
2579
 
       friend geo geo_metric_adapt (const field& mh,
2580
 
             const adapt_option_type& = adapt_option_type());
2581
 
 
2582
 
     // input/output:
2583
 
 
2584
 
       friend std::istream& operator >> (std::istream&, geo&);
2585
 
       friend std::ostream& operator << (std::ostream&, const geo&);
2586
 
       void save () const;
2587
 
       void use_double_precision_in_saving();
2588
 
       std::ostream& dump (std::ostream& s = std::cerr) const;
2589
 
       std::ostream& put_mtv_domains (std::ostream&, size_type=0) const;
2590
 
 
2591
 
     // accessors:
2592
 
 
2593
 
       const point&       vertex  (size_type i) const;
2594
 
       const geo_element& element (size_type K_idx) const;
2595
 
       Float              measure (const geo_element& K) const;
2596
 
 
2597
 
       std::string name() const;
2598
 
       //  Family name plus number
2599
 
       std::string basename() const;
2600
 
       //  For moving boundary problems
2601
 
       std::string familyname() const;
2602
 
       //  Number of moving boundary mesh
2603
 
       size_type number() const;
2604
 
       //  Refinment iteration for the current mesh number
2605
 
       size_type version() const;
2606
 
       size_type dimension() const;
2607
 
       size_type map_dimension() const;
2608
 
       std::string coordinate_system () const; // "cartesian", "rz", "zr"
2609
 
       fem_helper::coordinate_type coordinate_system_type() const;
2610
 
 
2611
 
       size_type serial_number() const;
2612
 
 
2613
 
       const domain& boundary() const;
2614
 
       void build_subregion(const domain& start_from, const domain& dont_cross,
2615
 
             std::string name, std::string name_of_complement="");
2616
 
       //  Builds a new domain on the side of domain `dont_cross' on which `start_from'
2617
 
       //  lies. These must have no intersection.
2618
 
 
2619
 
       size_type size() const;
2620
 
       size_type n_element() const;  // same as size()
2621
 
       size_type n_vertex() const;
2622
 
       size_type n_vertice() const;
2623
 
       size_type n_node() const;     // same as n_vertex()
2624
 
       size_type n_edge() const ;
2625
 
       size_type n_face() const ;
2626
 
       size_type n_triangle() const ;
2627
 
       size_type n_quadrangle() const ;
2628
 
       size_type n_volume() const ;
2629
 
       size_type n_tetraedra() const ;
2630
 
       size_type n_prism() const ;
2631
 
       size_type n_hexaedra() const ;
2632
 
       size_type n_subgeo(size_type d) const ;
2633
 
       size_type n_element(reference_element::enum_type t) const;
2634
 
 
2635
 
       Float hmin() const;
2636
 
       Float hmax() const;
2637
 
       const point& xmin() const;
2638
 
       const point& xmax() const;
2639
 
 
2640
 
       meshpoint hatter (const point& x, size_type K) const;
2641
 
       point dehatter (const meshpoint& S) const;
2642
 
       point dehatter (const point& x_hat, size_type e) const;
2643
 
 
2644
 
       const_iterator begin() const;
2645
 
       const_iterator end() const;
2646
 
       const_iterator_node begin_node() const;
2647
 
       const_iterator_node end_node() const;
2648
 
       const_iterator_vertex begin_vertex() const;
2649
 
       const_iterator_vertex end_vertex() const;
2650
 
 
2651
 
       // localizer:
2652
 
       bool localize (const point& x, geo_element::size_type& element) const;
2653
 
       void localize_nearest (const point& x, point& y, geo_element::size_type& element) const;
2654
 
       bool trace (const point& x0, const point& v, point& x, Float& t, size_type& element) const;
2655
 
 
2656
 
       // access to domains:
2657
 
       const domain& get_domain(size_type i) const;
2658
 
       size_type n_domain() const;
2659
 
       bool has_domain (const std::string& domname) const;
2660
 
       const domain& operator[] (const std::string& domname) const;
2661
 
       const_iterator_domain begin_domain() const;
2662
 
       const_iterator_domain end_domain() const;
2663
 
 
2664
 
       point normal (const geo_element& S) const;
2665
 
       point normal (const geo_element& K, georep::size_type side_idx) const;
2666
 
       void
2667
 
       sort_interface(const domain&, const interface&) const;
2668
 
       class field
2669
 
       normal (const class space& Nh, const domain& d,
2670
 
             const std::string& region="") const;
2671
 
       class field
2672
 
       normal (const class space& Nh, const domain& d, const interface& bc) const;
2673
 
       class field
2674
 
       tangent (const class space& Nh, const domain& d,
2675
 
             const std::string& region="") const;
2676
 
       class field
2677
 
       tangent (const class space& Nh, const domain& d, const interface& bc) const;
2678
 
        //  Gives normal to d in discontinuous space Nh (P0 or P1d) and can
2679
 
        //  initialize orientation of domain through `bc' data structure.
2680
 
        //  Currently limited to straight-sided elements.
2681
 
       class field
2682
 
       tangent_spline (const space& Nh, const domain& d, const interface& bc) const;
2683
 
       class field
2684
 
       plane_curvature (const space& Nh, const domain& d,
2685
 
             const interface& bc) const;
2686
 
        //  Gives curvature of d in the (x,y) or (r,z) plane.
2687
 
        //  Currently limited to straight-sided elements.
2688
 
       class field
2689
 
       plane_curvature_spline (const space& Nh, const domain& d,
2690
 
             const interface& bc) const;
2691
 
        //  Gives curvature of d in the (x,y) or (r,z) plane based on a spline interpolation.
2692
 
       class field
2693
 
       plane_curvature_quadratic (const space& Nh, const domain& d,
2694
 
             const interface& bc) const;
2695
 
        //  Gives curvature of d in the (x,y) or (r,z) plane based on a local quadratic interpolation.
2696
 
 
2697
 
       class field
2698
 
       axisymmetric_curvature (const class space& Nh, const domain& d) const;
2699
 
       class field
2700
 
       axisymmetric_curvature (const class space& Nh, const domain& d,
2701
 
             const interface& bc) const;
2702
 
        //  Specific to "rz" and "zr" coordinate systems:
2703
 
        //  Gives curvature of d in a plane orthogonal to the (r,z) plane.
2704
 
        //  Can also initialize orientation of domain through `bc' data structure.
2705
 
        //  Currently limited to straight-sided elements.
2706
 
       void
2707
 
       interface_process (const domain& d, const interface& bc,
2708
 
             geometric_event& event) const;
2709
 
        //  Detects event along domain d sorted according to bc's.
2710
 
 
2711
 
       // construction of jump-interface domain data:
2712
 
       void jump_interface(const domain& interface, const domain& subgeo,
2713
 
             std::map<size_type, tiny_vector<size_type> >& special_elements,
2714
 
             std::map<size_type,size_type>& node_global_to_interface) const;
2715
 
 
2716
 
     // comparator:
2717
 
 
2718
 
       bool operator == (const geo&) const;
2719
 
       bool operator != (const geo&) const;
2720
 
 
2721
 
     // modifiers
2722
 
 
2723
 
       //  build from a list of vertex and elements:
2724
 
       template <class ElementContainer, class VertexContainer>
2725
 
       void build (const ElementContainer&, const VertexContainer&);
2726
 
 
2727
 
       void set_name (const std::string&);
2728
 
       void set_coordinate_system (const std::string&); // "cartesian", "rz", "zr"
2729
 
       void upgrade();
2730
 
       void label_interface(const domain& dom1, const domain& dom2, const std::string& name);
2731
 
 
2732
 
       // modify domains
2733
 
       void erase_domain (const std::string& name);
2734
 
       void insert_domain (const domain&);
2735
 
 
2736
 
     // accessors to internals:
2737
 
       bool localizer_initialized () const;
2738
 
       void init_localizer (const domain& boundary, Float tolerance=-1, int list_size=0) const;
2739
 
       const size_type* get_geo_counter() const;
2740
 
       const size_type* get_element_counter() const;
2741
 
 
2742
 
       // TO BE REMOVED
2743
 
       int gnuplot2d (const std::string& basename,
2744
 
                      plot_options& opt) const;
2745
 
 
2746
 
     // check consistency
2747
 
 
2748
 
       void check()  const;
2749
 
 
2750
 
     protected:
2751
 
 
2752
 
       friend class spacerep;
2753
 
       friend class field;
2754
 
 
2755
 
       void may_have_version_2() const; // fatal if not !
2756
 
 
2757
 
     // modifiers to internals:
2758
 
 
2759
 
       void set_dimension (size_type d);
2760
 
       iterator begin();
2761
 
       iterator end();
2762
 
       iterator_node begin_node();
2763
 
       iterator_node end_node();
2764
 
       iterator_vertex begin_vertex();
2765
 
       iterator_vertex end_vertex();
2766
 
     };
2767
 
 
2768
 
 
2769
 
File: rheolef.info,  Node: form_diag_manip class,  Up: Classes
2770
 
 
2771
 
5.3 `form_diag_manip' - concatenation on a product space
2772
 
========================================================
2773
 
 
2774
 
(Source file: `nfem/lib/form_diag_manip.h')
2775
 
 
2776
 
Description
2777
 
-----------
2778
 
 
2779
 
build a form_diag on a product space.
2780
 
 
2781
 
Example
2782
 
-------
2783
 
 
2784
 
The following example builds a 3-blocks diagonal form:
2785
 
         geo g("toto.geo");
2786
 
         space V(g,"P1");
2787
 
         space T = V*V*V;
2788
 
         form_diag Iv(V) ;
2789
 
         form_diag I(T) ;
2790
 
         form_manip I_manip;
2791
 
         I_manip << size(3) << Iv << Iv << Iv;
2792
 
         I_manip >> I;
2793
 
 
2794
 
Implementation
2795
 
--------------
2796
 
 
2797
 
     class form_diag_manip {
2798
 
     public:
2799
 
 
2800
 
     // typedefs:
2801
 
 
2802
 
         typedef form_diag::size_type size_type;
2803
 
 
2804
 
     // constructors/destructors:
2805
 
 
2806
 
         form_diag_manip();
2807
 
 
2808
 
     // accessors:
2809
 
 
2810
 
         size_type nbloc() const;
2811
 
         size_type nform() const;
2812
 
         form_diag& bloc(size_type i);
2813
 
         const form_diag& bloc(size_type i) const;
2814
 
 
2815
 
     // manipulators:
2816
 
 
2817
 
         form_diag_manip& operator << (const form_diag& a);
2818
 
         form_diag_manip& operator >> (form_diag& a);
2819
 
         friend form_diag_manip& verbose (form_diag_manip &fm);
2820
 
         friend form_diag_manip& noverbose (form_diag_manip &fm);
2821
 
         form_diag_manip& operator<< (form_diag_manip& (*pf)(form_diag_manip&));
2822
 
 
2823
 
     // implementation:
2824
 
 
2825
 
         friend class sized;
2826
 
         friend form_diag_manip& operator << (form_diag_manip &fm, const class sized& s);
2827
 
 
2828
 
     protected:
2829
 
         bool              _verbose;
2830
 
         size_type         _nform;
2831
 
         size_type         _nbloc;
2832
 
         std::vector<form_diag> _a;
2833
 
     };
 
1147
Distributed finite element mesh.
 
1148
 
 
1149
Implementation
 
1150
--------------
 
1151
 
 
1152
     template <class T>
 
1153
     class geo_basic<T,sequential> : public smart_pointer<geo_abstract_rep<T,sequential> > {
 
1154
     public:
 
1155
 
 
1156
     // typedefs:
 
1157
 
 
1158
         typedef sequential                     memory_type;
 
1159
         typedef geo_abstract_rep<T,sequential>          rep;
 
1160
         typedef smart_pointer<rep>                      base;
 
1161
         typedef typename rep::size_type                 size_type;
 
1162
         typedef typename rep::node_type                 node_type;
 
1163
         typedef typename rep::variant_type              variant_type;
 
1164
         typedef typename rep::reference                 reference;
 
1165
         typedef typename rep::const_reference           const_reference;
 
1166
         typedef typename rep::iterator                  iterator;
 
1167
         typedef typename rep::const_iterator            const_iterator;
 
1168
         typedef typename rep::iterator_by_variant       iterator_by_variant;
 
1169
         typedef typename rep::const_iterator_by_variant const_iterator_by_variant;
 
1170
 
 
1171
     // allocators:
 
1172
 
 
1173
         geo_basic ();
 
1174
         geo_basic (std::string name, const communicator& comm = communicator());
 
1175
         void load (std::string name, const communicator& comm = communicator());
 
1176
         geo_basic (const domain_indirect_basic<sequential>& dom, const geo_basic<T,sequential>& omega);
 
1177
 
 
1178
     // accessors:
 
1179
 
 
1180
         std::string                name() const { return base::data().name(); }
 
1181
         size_type             dimension() const { return base::data().dimension(); }
 
1182
         size_type         map_dimension() const { return base::data().map_dimension(); }
 
1183
         size_type                 order() const { return base::data().order(); }
 
1184
         const node_type&           xmin() const { return base::data().xmin(); }
 
1185
         const node_type&           xmax() const { return base::data().xmax(); }
 
1186
         const distributor& geo_element_ownership(size_type dim) const { return base::data().geo_element_ownership(dim); }
 
1187
         const geo_size&      sizes()             const { return base::data().sizes(); }
 
1188
         const geo_size&  ios_sizes()             const { return base::data().ios_sizes(); }
 
1189
         const_reference get_geo_element (size_type dim, size_type ige) const { return base::data().get_geo_element (dim, ige); }
 
1190
               reference get_geo_element (size_type dim, size_type ige)       { return base::data().get_geo_element (dim, ige); }
 
1191
         const node_type&     node (size_type inod) const { return base::data().node(inod); }
 
1192
         const node_type& dis_node (size_type inod) const { return node(inod); }
 
1193
         void dis_inod (const geo_element& K, std::vector<size_type>& dis_inod) const {
 
1194
                     return base::data().dis_inod(K,dis_inod); }
 
1195
 
 
1196
         size_type n_domain_indirect () const { return base::data().n_domain_indirect (); }
 
1197
         const domain_indirect_basic<sequential>& get_domain_indirect (size_type i) const {
 
1198
               return base::data().get_domain_indirect (i); }
 
1199
         const domain_indirect_basic<sequential>& get_domain_indirect (const std::string& name) const {
 
1200
               return base::data().get_domain_indirect (name); }
 
1201
 
 
1202
         size_type n_domain () const { return base::data().n_domain_indirect (); }
 
1203
         geo_basic<T,sequential> get_domain (size_type i) const;
 
1204
         geo_basic<T,sequential> operator[] (const std::string& name) const;
 
1205
 
 
1206
     // extended accessors:
 
1207
 
 
1208
         const communicator& comm()        const { return geo_element_ownership (0).comm(); }
 
1209
         size_type     size(size_type dim) const { return base::data().geo_element_ownership(dim).size(); }
 
1210
         size_type dis_size(size_type dim) const { return base::data().geo_element_ownership(dim).dis_size(); }
 
1211
         size_type     size()              const { return size     (map_dimension()); }
 
1212
         size_type dis_size()              const { return dis_size (map_dimension()); }
 
1213
         size_type     n_vertex()          const { return size     (0); }
 
1214
         size_type dis_n_vertex()          const { return dis_size (0); }
 
1215
         const_reference operator[] (size_type ie) const { return get_geo_element (map_dimension(), ie); }
 
1216
               reference operator[] (size_type ie)       { return get_geo_element (map_dimension(), ie); }
 
1217
         const_iterator begin (size_type dim) const { return base::data().begin(dim); }
 
1218
         const_iterator end   (size_type dim) const { return base::data().end  (dim); }
 
1219
         const_iterator begin ()              const { return begin(map_dimension()); }
 
1220
         const_iterator end   ()              const { return end  (map_dimension()); }
 
1221
 
 
1222
         const_iterator_by_variant begin_by_variant (variant_type variant) const
 
1223
             { return base::data().begin_by_variant (variant); }
 
1224
         const_iterator_by_variant   end_by_variant (variant_type variant) const
 
1225
             { return base::data().  end_by_variant (variant); }
 
1226
     #ifdef TO_CLEAN
 
1227
         iterator_by_variant       begin_by_variant (variant_type variant)
 
1228
             { return base::data().begin_by_variant (variant); }
 
1229
         iterator_by_variant         end_by_variant (variant_type variant)
 
1230
             { return base::data().  end_by_variant (variant); }
 
1231
     #endif // TO_CLEAN
 
1232
 
 
1233
         size_type dis_ige2ios_dis_ige (size_type dim, size_type dis_ige) const { return dis_ige; }
 
1234
 
 
1235
         const geo_basic<T,sequential>& get_background_geo() const; // code in geo_domain.h
 
1236
               geo_basic<T,sequential>  get_background_domain() const;
 
1237
 
 
1238
     // comparator:
 
1239
 
 
1240
         bool operator== (const geo_basic<T,sequential>& omega2) const { return base::data().operator== (omega2.data()); }
 
1241
 
 
1242
     // i/o:
 
1243
 
 
1244
         idiststream& get (idiststream& ips);
 
1245
         odiststream& put (odiststream& ops) const { return base::data().put (ops); }
 
1246
         void dump (std::string name)        const {        base::data().dump (name); }
 
1247
     };
 
1248
 
 
1249
Implementation
 
1250
--------------
 
1251
 
 
1252
     template <class T>
 
1253
     class geo_basic<T,distributed> : public smart_pointer<geo_abstract_rep<T,distributed> > {
 
1254
     public:
 
1255
 
 
1256
     // typedefs:
 
1257
 
 
1258
         typedef distributed                             memory_type;
 
1259
         typedef geo_abstract_rep<T,distributed>         rep;
 
1260
         typedef smart_pointer<rep>                      base;
 
1261
         typedef typename rep::size_type                 size_type;
 
1262
         typedef typename rep::node_type                 node_type;
 
1263
         typedef typename rep::variant_type              variant_type;
 
1264
         typedef typename rep::node_map_type             node_map_type;
 
1265
         typedef typename rep::reference                 reference;
 
1266
         typedef typename rep::const_reference           const_reference;
 
1267
         typedef typename rep::iterator                  iterator;
 
1268
         typedef typename rep::const_iterator            const_iterator;
 
1269
         typedef typename rep::iterator_by_variant       iterator_by_variant;
 
1270
         typedef typename rep::const_iterator_by_variant const_iterator_by_variant;
 
1271
 
 
1272
     // allocators:
 
1273
 
 
1274
         geo_basic ();
 
1275
         geo_basic (std::string name, const communicator& comm = communicator());
 
1276
         void load (std::string name, const communicator& comm = communicator());
 
1277
         geo_basic (const domain_indirect_basic<distributed>& dom, const geo_basic<T,distributed>& omega);
 
1278
 
 
1279
     // accessors:
 
1280
 
 
1281
         std::string                name() const { return base::data().name(); }
 
1282
         size_type             dimension() const { return base::data().dimension(); }
 
1283
         size_type         map_dimension() const { return base::data().map_dimension(); }
 
1284
         size_type                 order() const { return base::data().order(); }
 
1285
         const node_type&           xmin() const { return base::data().xmin(); }
 
1286
         const node_type&           xmax() const { return base::data().xmax(); }
 
1287
         const distributor& geo_element_ownership(size_type dim) const
 
1288
                             { return base::data().geo_element_ownership (dim); }
 
1289
         const geo_size&      sizes()             const { return base::data().sizes(); }
 
1290
         const geo_size&  ios_sizes()             const { return base::data().ios_sizes(); }
 
1291
         const_reference get_geo_element (size_type dim, size_type ige) const
 
1292
                     { return base::data().get_geo_element (dim, ige); }
 
1293
         const_reference dis_get_geo_element (size_type dim, size_type dis_ige) const
 
1294
                     { return base::data().dis_get_geo_element (dim, dis_ige); }
 
1295
         distributor geo_element_ios_ownership (size_type dim) const {
 
1296
             return base::data().geo_element_ios_ownership (dim); }
 
1297
         size_type ige2ios_dis_ige (size_type dim, size_type ige) const {
 
1298
             return base::data().ige2ios_dis_ige (dim,ige); }
 
1299
         size_type dis_ige2ios_dis_ige (size_type dim, size_type dis_ige) const {
 
1300
             return base::data().dis_ige2ios_dis_ige (dim,dis_ige); }
 
1301
         size_type ios_ige2dis_ige (size_type dim, size_type ios_ige) const {
 
1302
             return base::data().ios_ige2dis_ige (dim, ios_ige); }
 
1303
         const node_type&     node(size_type     inod) const { return base::data().node(inod); }
 
1304
         const node_type& dis_node(size_type dis_inod) const { return base::data().dis_node(dis_inod); }
 
1305
         void dis_inod (const geo_element& K, std::vector<size_type>& dis_inod) const {
 
1306
                     return base::data().dis_inod(K,dis_inod); }
 
1307
 
 
1308
         size_type n_domain_indirect () const { return base::data().n_domain_indirect (); }
 
1309
         const domain_indirect_basic<distributed>& get_domain_indirect (size_type i) const {
 
1310
               return base::data().get_domain_indirect (i); }
 
1311
         const domain_indirect_basic<distributed>& get_domain_indirect (const std::string& name) const {
 
1312
               return base::data().get_domain_indirect (name); }
 
1313
 
 
1314
         size_type n_domain () const { return base::data().n_domain_indirect (); }
 
1315
         geo_basic<T,distributed> get_domain (size_type i) const;
 
1316
         geo_basic<T,distributed> operator[] (const std::string& name) const;
 
1317
 
 
1318
     // extended accessors:
 
1319
 
 
1320
         size_type     size(size_type dim) const { return base::data().geo_element_ownership(dim).size(); }
 
1321
         size_type dis_size(size_type dim) const { return base::data().geo_element_ownership(dim).dis_size(); }
 
1322
         const communicator& comm()        const { return geo_element_ownership (0).comm(); }
 
1323
         size_type     size()              const { return size     (map_dimension()); }
 
1324
         size_type dis_size()              const { return dis_size (map_dimension()); }
 
1325
         const_reference operator[] (size_type ie) const
 
1326
                     { return get_geo_element (map_dimension(), ie); }
 
1327
 
 
1328
         const_iterator begin (size_type dim) const { return base::data().begin(dim); }
 
1329
         const_iterator end   (size_type dim) const { return base::data().end  (dim); }
 
1330
         const_iterator begin ()              const { return begin(map_dimension()); }
 
1331
         const_iterator end   ()              const { return end  (map_dimension()); }
 
1332
 
 
1333
         const_iterator_by_variant begin_by_variant (variant_type variant) const
 
1334
             { return base::data().begin_by_variant (variant); }
 
1335
         const_iterator_by_variant   end_by_variant (variant_type variant) const
 
1336
             { return base::data().  end_by_variant (variant); }
 
1337
     #ifdef TO_CLEAN
 
1338
         iterator_by_variant       begin_by_variant (variant_type variant)
 
1339
             { return base::data().begin_by_variant (variant); }
 
1340
         iterator_by_variant         end_by_variant (variant_type variant)
 
1341
             { return base::data().  end_by_variant (variant); }
 
1342
     #endif // TO_CLEAN
 
1343
 
 
1344
         const geo_basic<T,distributed>& get_background_geo() const; // code in geo_domain.h
 
1345
               geo_basic<T,distributed>  get_background_domain() const;
 
1346
 
 
1347
     // comparator:
 
1348
 
 
1349
         bool operator== (const geo_basic<T,distributed>& omega2) const { return base::data().operator== (omega2.data()); }
 
1350
 
 
1351
     // i/o:
 
1352
 
 
1353
         odiststream& put (odiststream& ops) const { return base::data().put (ops); }
 
1354
         idiststream& get (idiststream& ips);
 
1355
     };
 
1356
 
 
1357
 
 
1358
File: rheolef.info,  Node: geo_domain class,  Up: Classes
 
1359
 
 
1360
5.2 `geo_domain' - a named part of a finite element mesh that behaves as a mesh
 
1361
===============================================================================
 
1362
 
 
1363
(Source file: `nfem/plib/geo_domain.h') 
 
1364
 
 
1365
Description
 
1366
-----------
 
1367
 
 
1368
The `geo_domain' class defines a container for a part of a   finite
 
1369
element mesh.    This class re-describes the vertices, edges or faces in
 
1370
 a compact way, i.e. by skipping unused elements from   the surrounding
 
1371
mesh.
 
1372
 
 
1373
Implementation note
 
1374
-------------------
 
1375
 
 
1376
The `geo_domain' class conserves the link to the original mesh   such
 
1377
that fields defined on a `geo_domain' can inter-operate with   fields
 
1378
defined on the surrounding mesh.
 
1379
 
 
1380
 
 
1381
File: rheolef.info,  Node: geo_domain_indirect class,  Up: Classes
 
1382
 
 
1383
5.3 `geo_domain_indirect_rep' - a named part of a finite element mesh
 
1384
=====================================================================
 
1385
 
 
1386
(Source file: `nfem/plib/geo_domain_indirect.h') 
 
1387
 
 
1388
Description
 
1389
-----------
 
1390
 
 
1391
The `geo_domain_indirect_rep' class defines a container for a part of a
 
1392
 finite element mesh.    This describes the connectivity of edges or
 
1393
faces.    This class is usefull for boundary condition setting.
 
1394
 
 
1395
Implementation note
 
1396
-------------------
 
1397
 
 
1398
The `geo_domain_indirect_rep' class is splitted into two parts.    The
 
1399
first one is the `domain_indirect' class, that contains the main
 
1400
renumbering features: it acts as an indirection on a `geo' class(*note
 
1401
geo class::).    The second one is the `geo' class itself, named here
 
1402
the background geo.    Thus, the `geo_domain_indirect' class develops a
 
1403
complete `geo'-like interface,   via the `geo_abstract_rep' pure
 
1404
virtual class derivation,   and can be used by the `space' class (*note
 
1405
space class::).
 
1406
 
 
1407
The split between `domain_indirect' and `geo_domain_indirect' is
 
1408
necessary,   because the `geo' class contains a list of domain_indirect.
 
1409
 The `geo' class cannot contains a list of `geo_domain_indirect'
 
1410
classes, that refers   to the `geo' class itself: a loop in reference
 
1411
counting   leads to a blocking situation in the automatic deallocation.
2834
1412
 
2835
1413
 
2836
1414
File: rheolef.info,  Node: space class,  Up: Classes
2838
1416
5.4 `space' - piecewise polynomial finite element space
2839
1417
=======================================================
2840
1418
 
2841
 
(Source file: `nfem/lib/space.h') 
 
1419
(Source file: `nfem/plib/space.h') 
2842
1420
 
2843
1421
Description
2844
1422
-----------
2845
1423
 
2846
1424
The `space' class contains some numbering for unknowns and blocked
2847
 
_degrees of freedoms_ related to a given mesh and polynomial
 
1425
degrees of freedoms related to a given mesh and polynomial
2848
1426
approximation.
2849
1427
 
2850
 
Degree of freedom numbering
2851
 
---------------------------
2852
 
 
2853
 
Numbering of degrees of freedom (or shortly, "dof") depends upon the
2854
 
mesh and the piecewise polynomial approximation used.  This numbering
2855
 
is then used by the `field' and `form' classes.  See also *note field
2856
 
class:: and *note form class::.
2857
 
 
2858
 
The degree-of-freedom (or shortly, "dof") follows some simple rules,
2859
 
that depends of course of the approximation.  These rules are suitable
2860
 
for easy `.field' file retrieval (*note field class::).
2861
 
 
2862
 
`P0'
2863
 
`bubble'
2864
 
     dof numbers follow element numbers in mesh.
2865
 
 
2866
 
`P1'
2867
 
     dof numbers follow vertice numbers in mesh.
2868
 
 
2869
 
`P2'
2870
 
     dof numbers related to vertices follow vertice numbers in mesh.
2871
 
          Follow dof numbers related to edges, in the edge numbering
2872
 
     order.
2873
 
 
2874
 
`P1d'
2875
 
     dof numbers follow element numbers in mesh. In each element, we
2876
 
         loop on vertices following the local vertice order provided in
2877
 
            the mesh.
2878
 
 
2879
 
Unknown and blocked degree of freedom
2880
 
-------------------------------------
2881
 
 
2882
 
A second numbering is related to the "unknown" and "blocked" degrees of
2883
 
freedom.
2884
 
           geo omega("square");
2885
 
           space V(omega,"P1");
2886
 
           V.block ("boundary");
2887
 
Here, all degrees of freedom located on the domain `"boundary"' are
2888
 
marked as blocked.
2889
 
 
2890
 
File format
2891
 
-----------
2892
 
 
2893
 
File output format for `space' is not of practical interest.  This file
2894
 
format is provided for completness.  Here is a small example
2895
 
        space
2896
 
        1 6
2897
 
        square
2898
 
        P1
2899
 
           0 B
2900
 
           1 B
2901
 
           0
2902
 
           1
2903
 
           2 B
2904
 
           2
2905
 
where the `B' denotes blocked degres of freedom.  The method
2906
 
`set_dof(K, dof_array)' gives the numbering in `dof_array', supplying
2907
 
an element `K'.  The method `index(dof)' gives the unknown or blocked
2908
 
numbering from the initial numbering, suppling a given `dof'
2909
 
 
2910
 
Additional features
2911
 
-------------------
2912
 
 
2913
 
The method `xdof(K, i)' gives the geometrical location of the i-th
2914
 
degree of freedom in the element `K'.
2915
 
 
2916
 
Product spaces, for non-scalar fields, such as vector-valued or
2917
 
tensor-valued (symmetric) fields,
2918
 
 
2919
 
Can also be defined
2920
 
-------------------
2921
 
 
2922
 
           space U (omega, "P1", "vector");
2923
 
           space T (omega, "P1", "tensor");
2924
 
Then, the number of component depends upon the geometrical dimension of
2925
 
the mesh `omega'.
2926
 
 
2927
 
Arbitrarily product spaces can also be constructed
2928
 
           space X = V0*V1;
2929
 
Spaces for fields defined on a boundary domain can also be constructed
2930
 
           space W (omega, omega["top"], "P1");
2931
 
The correspondance between the degree-of-freedom numbering for the
2932
 
space `W' and the global degree-of-freedom numbering for the space `V'
2933
 
is supported.  The method `set_global_dof(S, dof_array)' gives the
2934
 
global numbering in `dof_array', supplying a boundary element `S'.  The
2935
 
method `domain_index(global_dof)' gives the unknown or blocked
2936
 
numbering from the initial numbering, suppling a given `global_dof',
2937
 
related to the space `V'.
2938
 
 
2939
 
Implementation
2940
 
--------------
2941
 
 
2942
 
     class space : public smart_pointer<spacerep> {
2943
 
     public:
2944
 
     // typdefs:
2945
 
 
2946
 
         typedef spacerep::size_type size_type;
2947
 
 
2948
 
     // allocator/deallocator:
2949
 
 
2950
 
         space ();
2951
 
         space (const geo& g, const std::string& approx_name, const std::string& valued = "scalar");
2952
 
         space (const geo& g, const std::string& approx_name,
2953
 
             const domain& interface, const domain& subgeo, const std::string& valued = "scalar");
2954
 
             //  For spaces with a discontinuity through domain `interface', but otherwise continuous
2955
 
         space (const geo& g, const domain& d, const std::string& approx_name);
2956
 
         space(const const_space_component&);
2957
 
 
2958
 
         space operator = (const const_space_component&);
2959
 
         friend space operator * (const space&, const space&);
2960
 
         friend space pow (const space&, size_type);
2961
 
 
2962
 
     // modifiers:
2963
 
 
2964
 
         void block () const;
2965
 
         void block_Lagrange () const;
2966
 
         void block (size_type i_comp) const;
2967
 
         void block_Lagrange (size_type i_comp) const;
2968
 
         void block (const std::string& d_name) const;
2969
 
         void block (const domain& d) const;
2970
 
         void block (const std::string& d_name,  size_type i_comp) const;
2971
 
         void block (const domain& d, size_type i_comp) const;
2972
 
         void block_dof (size_type dof_idx, size_type i_comp) const;
2973
 
         void block_dof (size_type dof_idx) const;
2974
 
         void unblock_dof (size_type dof_idx, size_type i_comp) const;
2975
 
         void unblock_dof (size_type dof_idx) const;
2976
 
         void set_periodic (const domain& d1, const domain& d2) const;
2977
 
         void set_periodic (const std::string& d1_name, const std::string& d2_name) const;
2978
 
         void lock_components (const domain& d, point locked_dir) const;
2979
 
         void lock_components (const std::string& d_name, point locked_dir) const;
2980
 
         template <class Function>
2981
 
         void lock_components (const std::string& d_name, Function locked_dir) const;
2982
 
             //  Allows to enforce vector-boundary conditions.
2983
 
             /*  Allows to enforce vector-boundary conditions.
2984
 
              *!
2985
 
              *! Current limitation: only 2D vector fields with components having same FE approximation.
2986
 
              *! The space has a dof for the direction normal to locked_dir, while the value in the
2987
 
              *! direction locked_dir is blocked.
2988
 
              *! The field::at function implements the reconstruction of the original cartesian components.
2989
 
              */
2990
 
         template <class Function>
2991
 
         void lock_components (const domain& d, Function locked_dir) const;
2992
 
 
2993
 
     // accessors:
2994
 
 
2995
 
         size_type  size()      const;
2996
 
         size_type  degree ()   const;
2997
 
         size_type  n_blocked() const;
2998
 
         size_type  n_unknown() const;
2999
 
         size_type  dimension() const;
3000
 
         std::string coordinate_system() const;
3001
 
         fem_helper::coordinate_type coordinate_system_type() const;
3002
 
 
3003
 
 
3004
 
         const geo&                get_geo   () const;
3005
 
         const basis&              get_basis (size_type i_component = 0) const;
3006
 
         const numbering&          get_numbering (size_type i_component = 0) const;
3007
 
         std::string               get_approx(size_type i_component = 0) const;
3008
 
         const basis&              get_p1_transformation () const;
3009
 
 
3010
 
         std::string               get_valued() const;
3011
 
         fem_helper::valued_field_type get_valued_type() const;
3012
 
 
3013
 
         size_type  n_component() const;
3014
 
         space_component operator [] (size_type i_comp);
3015
 
         const_space_component operator [] (size_type i_comp) const;
3016
 
 
3017
 
         size_type  size_component      (size_type i_component = 0) const;
3018
 
         size_type  n_unknown_component (size_type i_component = 0) const;
3019
 
         size_type  n_blocked_component (size_type i_component = 0) const;
3020
 
         size_type  start               (size_type i_component = 0) const;
3021
 
         size_type  start_unknown       (size_type i_component = 0) const;
3022
 
         size_type  start_blocked       (size_type i_component = 0) const;
3023
 
 
3024
 
         size_type  index              (size_type degree_of_freedom) const;
3025
 
         size_type  period_association (size_type degree_of_freedom) const;
3026
 
         bool       is_blocked         (size_type degree_of_freedom) const;
3027
 
         bool       is_periodic        (size_type degree_of_freedom) const;
3028
 
 
3029
 
         bool       has_locked         () const;
3030
 
                      //  for (2D) vector spaces only, field is only blocked along locked_dir
3031
 
         bool       is_locked          (size_type degree_of_freedom) const;
3032
 
             //  for tangential-normal representation
3033
 
         size_type  locked_with  (size_type degree_of_freedom) const;
3034
 
         size_type  index_locked_with  (size_type degree_of_freedom) const;
3035
 
             //  dof with the other component (thru space::index() as well)
3036
 
         Float      locked_component   (size_type dof, size_type i_comp) const;
3037
 
             //  i-th component of locked direction
3038
 
         Float      unlocked_component (size_type dof, size_type i_comp) const;
3039
 
             //  i-th component of unlocked direction
3040
 
 
3041
 
         void freeze () const;
3042
 
         bool is_frozen() const;
3043
 
 
3044
 
 
3045
 
         // informations related to boundary spaces
3046
 
         bool  is_on_boundary_domain() const;
3047
 
         const domain& get_boundary_domain() const;
3048
 
         const geo&    get_global_geo     () const;
3049
 
         size_type  global_size () const;
3050
 
         size_type  domain_dof   (size_type global_dof) const;
3051
 
         size_type  domain_index (size_type global_dof) const;
3052
 
 
3053
 
         // get indices of degrees of freedom associated to an element
3054
 
             //  the tiny_vector is a "local index" -> "global index" table
3055
 
             //      "global" variants differ only for boundary spaces (non-global uses domain-indices, global use
3056
 
             //  mesh-wide indices)
3057
 
         void  set_dof        (const geo_element& K, tiny_vector<size_type>& idx) const;
3058
 
         void  set_global_dof (const geo_element& K, tiny_vector<size_type>& idx) const;
3059
 
         void  set_dof        (const geo_element& K, tiny_vector<size_type>& idx, size_type i_comp) const;
3060
 
         void  set_global_dof (const geo_element& K, tiny_vector<size_type>& idx, size_type i_comp) const;
3061
 
         void  set_dof        (const geo_element& K, tiny_vector<size_type>& idx, size_type i_comp, reference_element::dof_family_type family) const;
3062
 
         point x_dof      (const geo_element& K, size_type i_local) const;
3063
 
          //  Hermite/Argyris: returns 1 if the global dof contains the derivative along outward normal of K, -1 else
3064
 
         void  dof_orientation(const geo_element& K, tiny_vector<int>& orientation) const;
3065
 
 
3066
 
         // piola transformation
3067
 
         meshpoint hatter (const point& x, size_type K) const;
3068
 
         point dehatter (const meshpoint& S) const;
3069
 
         point dehatter (const point& x_hat, size_type e) const;
3070
 
 
3071
 
     // comparator
3072
 
 
3073
 
         bool operator == (const space&) const;
3074
 
         bool operator != (const space&) const;
3075
 
 
3076
 
     // input/output
3077
 
 
3078
 
        friend std::ostream& operator << (std::ostream&, const space&);
3079
 
        friend std::istream& operator >> (std::istream&, space&);
3080
 
        std::ostream& dump(std::ostream& s = std::cerr) const;
3081
 
        void check() const;
3082
 
 
3083
 
     // inquires:
3084
 
 
3085
 
        static size_type inquire_size(const geo&, const numbering&);
3086
 
 
3087
 
     // implementation:
3088
 
     protected:
3089
 
        space(smart_pointer<spacerep>);
3090
 
        space (const space&, const space&); // X*Y
3091
 
        space (const space&, size_type i_comp); // X[i_comp]
3092
 
        friend class field;
3093
 
     };
3094
 
 
3095
 
 
3096
 
File: rheolef.info,  Node: form_diag class,  Up: Classes
3097
 
 
3098
 
5.5 `form_diag' - diagional form class
3099
 
======================================
3100
 
 
3101
 
(Source file: `nfem/lib/form_diag.h')
3102
 
 
3103
 
Description
3104
 
-----------
3105
 
 
3106
 
Implement a form using two diagonal matrix.
3107
 
 
3108
 
Example
3109
 
-------
3110
 
 
3111
 
Here is the computation of the mass matrix for   the P1 finite element:
3112
 
          geo m("square");
3113
 
          space V(m,"P1");
3114
 
          form_diag m(V,"mass");
3115
 
 
3116
 
Note
3117
 
----
3118
 
 
3119
 
Implementation
3120
 
--------------
3121
 
 
3122
 
     class form_diag {
3123
 
     public:
3124
 
     // typedefs:
3125
 
 
3126
 
         typedef basic_diag<Float>::size_type size_type;
3127
 
 
3128
 
     // allocator/deallocator:
3129
 
 
3130
 
         form_diag ();
3131
 
         form_diag (const space& X);
3132
 
         form_diag (const space& X, const char* op_name);
3133
 
         form_diag (const class field& dh);
3134
 
 
3135
 
     // accessors:
3136
 
 
3137
 
         const space& get_space() const;
3138
 
         const geo&   get_geo() const;
3139
 
         size_type size() const;
3140
 
         size_type nrow() const;
3141
 
         size_type ncol() const;
3142
 
 
3143
 
     // linear algebra (partial):
3144
 
 
3145
 
         friend form_diag operator * (const form_diag&, const form_diag&);
3146
 
         friend class field operator * (const form_diag& a, const class field& x);
3147
 
         friend form_diag operator / (const Float& lambda, const form_diag& m);
3148
 
         //new
3149
 
         friend form_diag operator * (const Float& lambda, const form_diag&);
3150
 
         friend form_diag operator + (const form_diag&, const form_diag&);
3151
 
         friend form_diag operator - (const form_diag&);
3152
 
         friend form_diag operator - (const form_diag&, const form_diag&);
3153
 
         //wen
3154
 
 
3155
 
     // input/output:
3156
 
 
3157
 
         friend std::ostream& operator << (std::ostream& s, const form_diag& a);
3158
 
 
3159
 
     // data
3160
 
     private :
3161
 
         space       X_;
3162
 
     public :
3163
 
         basic_diag<Float> uu;
3164
 
         basic_diag<Float> bb;
3165
 
     };
3166
 
 
3167
 
 
3168
 
File: rheolef.info,  Node: form_manip class,  Up: Classes
3169
 
 
3170
 
5.6 `form_manip' - form concatenation on a product space
3171
 
========================================================
3172
 
 
3173
 
(Source file: `nfem/lib/form_manip.h')
3174
 
 
3175
 
Description
3176
 
-----------
3177
 
 
3178
 
build a form on a product space
3179
 
 
3180
 
To do
3181
 
-----
3182
 
 
3183
 
a general implementation without switch and with a loop.
3184
 
 
3185
 
Implementation
3186
 
--------------
3187
 
 
3188
 
     class form_manip {
3189
 
     public:
3190
 
     // typedefs:
3191
 
 
3192
 
         typedef form::size_type size_type;
3193
 
 
3194
 
     // constructors/destructor:
3195
 
 
3196
 
         form_manip();
3197
 
 
3198
 
     // accessors:
3199
 
 
3200
 
         size_type nform() const;
3201
 
         size_type nrowbloc() const;
3202
 
         size_type ncolbloc() const;
3203
 
         form& bloc(size_type i, size_type j);
3204
 
         const form& bloc(size_type i, size_type j) const;
3205
 
 
3206
 
     // manipulators:
3207
 
 
3208
 
         form_manip& operator << (const form&);
3209
 
         form_manip& operator >> (form&);
3210
 
         form_manip& operator << (form_manip& (*)(form_manip&));
3211
 
 
3212
 
         friend form_manip& verbose (form_manip&);
3213
 
         friend form_manip& noverbose (form_manip&);
3214
 
 
3215
 
     // implementation:
3216
 
 
3217
 
         friend class size;
3218
 
         friend form_manip& operator << (form_manip&, const class size&);
3219
 
 
3220
 
     protected:
3221
 
         bool         _verbose;
3222
 
         size_type    _nform;
3223
 
         size_type    _nrowbloc;
3224
 
         size_type    _ncolbloc;
3225
 
         std::vector<form> _a;
3226
 
     };
 
1428
Implementation
 
1429
--------------
 
1430
 
 
1431
     template <class T>
 
1432
     class space_basic<T,sequential> : public smart_pointer<space_rep<T,sequential> > {
 
1433
     public:
 
1434
 
 
1435
     // typedefs:
 
1436
 
 
1437
         typedef space_rep<T,sequential> rep;
 
1438
         typedef smart_pointer<rep>      base;
 
1439
         typedef typename rep::size_type size_type;
 
1440
 
 
1441
     // allocators:
 
1442
 
 
1443
         space_basic (const geo_basic<T,sequential>& omega = (geo_basic<T,sequential>()), std::string approx = "");
 
1444
 
 
1445
     // accessors:
 
1446
 
 
1447
         void block  (std::string dom_name);
 
1448
         void unblock(std::string dom_name);
 
1449
         void block  (const domain_indirect_basic<sequential>& dom);
 
1450
         void unblock(const domain_indirect_basic<sequential>& dom);
 
1451
 
 
1452
         const distributor&  ownership() const;
 
1453
         const communicator& comm() const;
 
1454
         size_type           size() const;
 
1455
         size_type           dis_size() const;
 
1456
 
 
1457
         const geo_basic<T,sequential>& get_geo() const;
 
1458
         const element<T,sequential>&   get_element() const;
 
1459
         std::string get_stamp() const;
 
1460
 
 
1461
         void get_dis_idof (const geo_element& K, std::vector<size_type>& dis_idof) const;
 
1462
 
 
1463
         const distributor& iu_ownership() const;
 
1464
         const distributor& ib_ownership() const;
 
1465
 
 
1466
         bool      is_blocked (size_type     idof) const;
 
1467
         size_type        iub (size_type     idof) const;
 
1468
         bool  dis_is_blocked (size_type dis_idof) const;
 
1469
         size_type    dis_iub (size_type dis_idof) const;
 
1470
 
 
1471
         const distributor& ios_ownership() const;
 
1472
         size_type idof2ios_dis_idof (size_type idof) const;
 
1473
         size_type ios_idof2dis_idof (size_type ios_idof) const;
 
1474
 
 
1475
         basic_point<T> x_dof (size_type idof) const { return base::data().x_dof (idof); }
 
1476
 
 
1477
         template <class Function>
 
1478
         T momentum (Function f, size_type idof) const;
 
1479
 
 
1480
         array<size_type, sequential> build_indirect_array (
 
1481
             const space_basic<T,sequential>& Wh, const std::string& dom_name) const;
 
1482
 
 
1483
     // comparator:
 
1484
 
 
1485
         bool operator== (const space_basic<T,sequential>& V2) const { return base::data().operator==(V2.data()); }
 
1486
         bool operator!= (const space_basic<T,sequential>& V2) const { return ! operator== (V2); }
 
1487
         friend bool are_compatible (const space_basic<T,sequential>& V1, const space_basic<T,sequential>& V2) {
 
1488
             return are_compatible (V1.data(), V2.data()); }
 
1489
     };
 
1490
 
 
1491
Implementation
 
1492
--------------
 
1493
 
 
1494
     template <class T>
 
1495
     class space_basic<T,distributed> : public smart_pointer<space_rep<T,distributed> > {
 
1496
     public:
 
1497
 
 
1498
     // typedefs:
 
1499
 
 
1500
         typedef space_rep<T,distributed> rep;
 
1501
         typedef smart_pointer<rep>       base;
 
1502
         typedef typename rep::size_type  size_type;
 
1503
 
 
1504
     // allocators:
 
1505
 
 
1506
         space_basic (const geo_basic<T,distributed>& omega = (geo_basic<T,distributed>()), std::string approx = "");
 
1507
 
 
1508
     // accessors:
 
1509
 
 
1510
         void block  (std::string dom_name);
 
1511
         void unblock(std::string dom_name);
 
1512
         void block  (const domain_indirect_basic<distributed>& dom);
 
1513
         void unblock(const domain_indirect_basic<distributed>& dom);
 
1514
 
 
1515
         const distributor&  ownership() const;
 
1516
         const communicator& comm() const;
 
1517
         size_type           size() const;
 
1518
         size_type           dis_size() const;
 
1519
 
 
1520
         const geo_basic<T,distributed>& get_geo() const;
 
1521
         const element<T,distributed>&   get_element() const;
 
1522
         std::string get_stamp() const;
 
1523
 
 
1524
         void get_dis_idof (const geo_element& K, std::vector<size_type>& dis_idof) const;
 
1525
 
 
1526
         const distributor& iu_ownership() const;
 
1527
         const distributor& ib_ownership() const;
 
1528
 
 
1529
         bool      is_blocked (size_type     idof) const;
 
1530
         size_type        iub (size_type     idof) const;
 
1531
 
 
1532
         bool  dis_is_blocked (size_type dis_idof) const;
 
1533
         size_type    dis_iub (size_type dis_idof) const;
 
1534
 
 
1535
         const distributor& ios_ownership() const;
 
1536
         size_type idof2ios_dis_idof (size_type idof) const;
 
1537
         size_type ios_idof2dis_idof (size_type ios_idof) const;
 
1538
 
 
1539
         basic_point<T> x_dof (size_type idof) const { return base::data().x_dof (idof); }
 
1540
 
 
1541
         template <class Function>
 
1542
         T momentum (Function f, size_type idof) const;
 
1543
 
 
1544
         array<size_type, distributed> build_indirect_array (
 
1545
             const space_basic<T,distributed>& Wh, const std::string& dom_name) const;
 
1546
 
 
1547
     // comparator:
 
1548
 
 
1549
         bool operator== (const space_basic<T,distributed>& V2) const { return base::data().operator==(V2.data()); }
 
1550
         bool operator!= (const space_basic<T,distributed>& V2) const { return ! operator== (V2); }
 
1551
         friend bool are_compatible (const space_basic<T,distributed>& V1, const space_basic<T,distributed>& V2) {
 
1552
             return are_compatible (V1.data(), V2.data()); }
 
1553
     };
 
1554
 
 
1555
 
 
1556
File: rheolef.info,  Node: form_element class,  Up: Classes
 
1557
 
 
1558
5.5 `form_element' - bilinear form on a single element
 
1559
======================================================
 
1560
 
 
1561
(Source file: `nfem/plib/form_element.h') 
 
1562
 
 
1563
Synopsys
 
1564
--------
 
1565
 
 
1566
The `form_element' class defines functions that compute   a bilinear
 
1567
form defined between two polynomial basis on a single   geometrical
 
1568
element. This bilinear form is represented   by a matrix.
 
1569
 
 
1570
The bilinear form is designated by a string, e.g. "mass", "grad_grad",
 
1571
...    indicating the form. The form depends also of the geometrical
 
1572
element:   triangle, square, tetrahedron (*note geo_element internal::).
 
1573
 
 
1574
Implementation note
 
1575
-------------------
 
1576
 
 
1577
The `form_element' class   is managed by (*note smart_pointer
 
1578
internal::).    This class uses a pointer on a pure virtual class
 
1579
`form_element_rep'   while the effective code refers to the specific
 
1580
concrete derived classes:   mass, grad_grad, etc.
 
1581
 
 
1582
Implementation
 
1583
--------------
 
1584
 
 
1585
     template <class T, class M>
 
1586
     class form_element : public smart_pointer<form_element_rep<T,M> > {
 
1587
     public:
 
1588
 
 
1589
     // typedefs:
 
1590
 
 
1591
         typedef form_element_rep<T,M>      rep;
 
1592
         typedef smart_pointer<rep>         base;
 
1593
         typedef typename rep::size_type    size_type;
 
1594
         typedef typename rep::vertex_type  vertex_type;
 
1595
         typedef typename rep::element_type element_type;
 
1596
         typedef typename rep::geo_type     geo_type;
 
1597
 
 
1598
     // constructors:
 
1599
 
 
1600
         form_element ();
 
1601
         form_element (
 
1602
             std::string           name,
 
1603
             const element_type&   X,
 
1604
             const element_type&   Y,
 
1605
             const geo_type&       omega);
 
1606
 
 
1607
     // accessors & modifier:
 
1608
 
 
1609
         void operator() (const geo_element& K, ublas::matrix<T>& m) const;
 
1610
         virtual bool is_symmetric () const;
 
1611
 
 
1612
     #ifdef TODO
 
1613
         void set_weight (const field& wh) const;
 
1614
         const field& get_weight() const;
 
1615
         void set_use_coordinate_system_weight(bool use) const;
 
1616
     #endif // TODO
 
1617
     };
 
1618
 
 
1619
 
 
1620
File: rheolef.info,  Node: domain_indirect class,  Up: Classes
 
1621
 
 
1622
5.6 `domain_indirect' - a named part of a finite element mesh
 
1623
=============================================================
 
1624
 
 
1625
(Source file: `nfem/plib/domain_indirect.h') 
 
1626
 
 
1627
Description
 
1628
-----------
 
1629
 
 
1630
The `domain_indirect' class defines a container for a part of a
 
1631
finite element mesh.    This describes the connectivity of edges or
 
1632
faces.    This class is usefull for boundary condition setting.
 
1633
 
 
1634
Implementation note
 
1635
-------------------
 
1636
 
 
1637
The `domain' class is splitted into two parts.    The first one is the
 
1638
`domain_indirect' class, that contains the main   renumbering features:
 
1639
it acts as a indirect on a `geo' class(*note geo class::).    The
 
1640
second one is the `domain' class, that simply contains two
 
1641
smart_pointers: one on a `domain_indirect' and the second on the
 
1642
`geo' where renumbering is acting.    Thus, the domain class develops a
 
1643
complete `geo'-like interface,   via the `geo_abstract_rep' pure
 
1644
virtual class derivation,   and can be used by the `space' class (*note
 
1645
space class::).    The split between domain_indirect and domain is
 
1646
necessary,   because the `geo' class contains a list of domain_indirect.
 
1647
 It cannot contains a list of `domain' classes, that refers   to the
 
1648
geo class itself: a loop in reference counting   leads to a blocking
 
1649
situation in the automatic deallocation.
 
1650
 
 
1651
Implementation
 
1652
--------------
 
1653
 
 
1654
     template <>
 
1655
     class domain_indirect_basic<sequential> : public smart_pointer<domain_indirect_rep<sequential> > {
 
1656
     public:
 
1657
 
 
1658
     // typedefs:
 
1659
 
 
1660
         typedef domain_indirect_rep<sequential> rep;
 
1661
         typedef smart_pointer<rep>        base;
 
1662
         typedef rep::size_type            size_type;
 
1663
         typedef rep::iterator_ioige       iterator_ioige;
 
1664
         typedef rep::const_iterator_ioige const_iterator_ioige;
 
1665
 
 
1666
     // allocators:
 
1667
 
 
1668
         domain_indirect_basic ();
 
1669
         void resize (size_type n);
 
1670
 
 
1671
     // accessors:
 
1672
 
 
1673
         size_type size()     const;
 
1674
         size_type dis_size() const;
 
1675
         const distributor& ownership() const;
 
1676
 
 
1677
         const_iterator_ioige ioige_begin() const;
 
1678
         const_iterator_ioige ioige_end()   const;
 
1679
               iterator_ioige ioige_begin();
 
1680
               iterator_ioige ioige_end();
 
1681
 
 
1682
         const geo_element_indirect& oige (size_type ioige) const;
 
1683
 
 
1684
         void set_name (std::string name);
 
1685
         void set_map_dimension (size_type map_dim);
 
1686
         std::string name ()    const;
 
1687
         size_type map_dimension () const;
 
1688
 
 
1689
     // i/o:
 
1690
 
 
1691
         odiststream& put (odiststream&) const;
 
1692
         template <class T>
 
1693
         idiststream& get (idiststream& ips, const geo_rep<T,sequential>& omega, std::vector<index_set> *ball);
 
1694
     };
 
1695
 
 
1696
Implementation
 
1697
--------------
 
1698
 
 
1699
     template <>
 
1700
     class domain_indirect_basic<distributed> : public smart_pointer<domain_indirect_rep<distributed> > {
 
1701
     public:
 
1702
 
 
1703
     // typedefs:
 
1704
 
 
1705
         typedef domain_indirect_rep<distributed>  rep;
 
1706
         typedef smart_pointer<rep>            base;
 
1707
         typedef rep::size_type                size_type;
 
1708
 
 
1709
     // allocators:
 
1710
 
 
1711
         domain_indirect_basic ();
 
1712
 
 
1713
     // accessors/modifiers:
 
1714
 
 
1715
         size_type size()     const;
 
1716
         size_type dis_size() const;
 
1717
         const distributor& ownership() const;
 
1718
 
 
1719
         const geo_element_indirect& oige (size_type ioige) const;
 
1720
 
 
1721
         void set_name (std::string name);
 
1722
         void set_map_dimension (size_type map_dim);
 
1723
         std::string name () const;
 
1724
         size_type map_dimension () const;
 
1725
 
 
1726
     // distributed specific acessors:
 
1727
 
 
1728
         const distributor& ini_ownership() const;
 
1729
         size_type ioige2ini_dis_ioige (size_type ioige) const;
 
1730
         size_type ini_ioige2dis_ioige (size_type ini_ioige) const;
 
1731
 
 
1732
     // i/o:
 
1733
 
 
1734
         template <class T>
 
1735
         idiststream& get (idiststream& ips, const geo_rep<T,distributed>& omega);
 
1736
         template <class T>
 
1737
         odiststream& put (odiststream& ops, const geo_rep<T,distributed>& omega) const;
 
1738
     };
 
1739
 
 
1740
 
 
1741
File: rheolef.info,  Node: rheolef class,  Up: Classes
 
1742
 
 
1743
5.7 `rheolef' - The finite element library
 
1744
==========================================
 
1745
 
 
1746
(Source file: `nfem/plib/rheolef.h')
 
1747
 
 
1748
Description
 
1749
-----------
 
1750
 
 
1751
The `Rheolef' is a computer environment that serves as a   convenient
 
1752
laboratory for computations involving   finite element methods.    It
 
1753
provides a set of unix commands and C++ algorithms and containers.
 
1754
In particular, this environment   allows the user to express a partial
 
1755
derivative problem   in terms of finite element `space',   discrete
 
1756
`field', bilinear `form',   and `geo', describing geometries and meshes.
 
1757
 
 
1758
This set of data structure is completed by the most   up-to-date
 
1759
algorithms:   preconditioned solvers for incompressible elasticity,
 
1760
Stokes and Navier-Stokes flows, characteristic method   for convection
 
1761
dominated heat problems,...
 
1762
 
 
1763
The pdf file of the user's manual, with many examples,   is located on
 
1764
your distribution in the documentation   directory. This directory is
 
1765
given by the following unix command:
 
1766
         rheolef-config --docdir
 
1767
  All examples presented along the user's manual   are available in the
 
1768
`example/' directory of the   `Rheolef' source distribution:   the
 
1769
directory, where all source code of examples are available,   is given
 
1770
by the following unix command:
 
1771
         rheolef-config --exampledir
3227
1772
 
3228
1773
 
3229
1774
File: rheolef.info,  Node: field class,  Up: Classes
3230
1775
 
3231
 
5.7 `field' - piecewise polynomial finite element field
 
1776
5.8 `field' - piecewise polynomial finite element field
3232
1777
=======================================================
3233
1778
 
3234
 
(Source file: `nfem/lib/field.h')
 
1779
(Source file: `nfem/plib/field.h')
3235
1780
 
3236
1781
Description
3237
1782
-----------
3248
1793
             Vh.block ("boundary");
3249
1794
             field uh (Vh);
3250
1795
             uh ["boundary"] = 0;
3251
 
  Interpolation of a function `u' in a field `uh' with respect to   the
 
1796
 
 
1797
Features
 
1798
--------
 
1799
 
 
1800
Linear algebra, such as uh+vh, uh-vh, lambda*uh + mu*vh, ...are
 
1801
supported.     The Euclidian dot product writes simply dot(uh,vh).
 
1802
The application of a bilinear form (*note form class::)    writes
 
1803
m(uh,vh) and is equivalent to dot(m*uh,vh).
 
1804
 
 
1805
Non-linear operations, such as sqrt(uh) applies to the    set of
 
1806
degrees-of-freedom: sqrt(uh) returns the Lagrange    interpolant of the
 
1807
square root of uh into the same space as uh.     All standard unary and
 
1808
binary math functions abs, cos, sin... are available    on fields. Also
 
1809
sqr(uh), the square of a field, and min(uh,vh), mx(uh,vh)    are
 
1810
provided. Binary functions can be used also with a scalar, as in
 
1811
           field wh = max (abs(uh), 0);
 
1812
           field zh = pow (abs(uh), 1./3);
 
1813
   For applying a user-provided function to a field, use:
 
1814
        field vh = compose(f, uh);
 
1815
        field wh = compose(f, uh, vh);
 
1816
   The composition supports also general unary and binary
 
1817
class-functions.
 
1818
 
 
1819
Todo
 
1820
----
 
1821
 
 
1822
Interpolation of a function `u' in a field `uh' with respect to   the
3252
1823
interpolation writes:
3253
1824
             Float u (const point&);
3254
1825
             uh = interpolate (Vh, u);
3256
1827
Example
3257
1828
-------
3258
1829
 
3259
 
Here is a complete example   using the field class:
 
1830
Here is a complete example using the field class:
3260
1831
             Float u (const point& x) { return x[0]*x[1]; }
3261
 
             main() {
 
1832
             int main() {
3262
1833
               geo omega_h ("square");
3263
1834
               space Vh (omega_h, "P1");
3264
1835
               field uh (Vh);
3266
1837
               cout << plotmtv << u;
3267
1838
             }
3268
1839
 
3269
 
Features
3270
 
--------
3271
 
 
3272
 
Algebra, such as x+y, x*y, x/y, lambda*x, ...are supported
3273
 
 
3274
 
Transformations applies to all values of a field:
3275
 
        field vh = compose(fabs, uh);
3276
 
        field wh = compose(atan2, uh, vh);
3277
 
   The composition supports also general unary and binary
3278
 
class-functions.
 
1840
Todo
 
1841
----
3279
1842
 
3280
1843
Vector-valued and tensor-valued field support is yet partial only.
3281
1844
This feature will be more documented in the future.
3282
1845
 
3283
 
 
3284
 
File: rheolef.info,  Node: trace class,  Up: Classes
3285
 
 
3286
 
5.8 `trace' - restriction to boundary values operator
3287
 
=====================================================
3288
 
 
3289
 
(Source file: `nfem/lib/trace.h') 
3290
 
 
3291
 
Description
3292
 
-----------
3293
 
 
3294
 
The `trace' operator restricts a field to its values located to a
3295
 
boundary value domain.    The `trace' class is a derived class of the
3296
 
`form' class   (*note form class::).    Thus, all operations, such as
3297
 
linear algebra, that applies   to `form', applies also to `trace'.
3298
 
 
3299
 
Example
3300
 
-------
3301
 
 
3302
 
The following example shows how to plot the   trace of a field, from
3303
 
standard input:
3304
 
         int main() {
3305
 
             geo omega ("square");
3306
 
             space Vh (omega "P1");
3307
 
             space Wh (omega, "P1", omega ["top"]);
3308
 
             trace gamma (Vh, Wh);
3309
 
 
3310
 
             field uh;
3311
 
             cin >> uh;
3312
 
             field wh (Wh);
3313
 
             wh = gamma*uh;
3314
 
             cout << wh;
3315
 
         }
 
1846
Implementation note
 
1847
-------------------
 
1848
 
 
1849
The field expression use the expression template technics in   order to
 
1850
avoid temporaries when evaluating complex expressions.
3316
1851
 
3317
1852
Implementation
3318
1853
--------------
3319
1854
 
3320
 
     class trace : public form
3321
 
     {
 
1855
     template <class T, class M = rheo_default_memory_model>
 
1856
     class field_basic : public std::unary_function<basic_point<typename scalar_traits<T>::type>,T> {
3322
1857
     public :
3323
 
 
3324
 
     //  allocator/deallocator:
3325
 
 
3326
 
       trace();
3327
 
       trace(const space& V, const space& W);
3328
 
 
3329
 
     // accessors:
3330
 
 
3331
 
       const space& get_space() const;
3332
 
       const space& get_boundary_space() const;
3333
 
       const geo&   get_geo() const;
3334
 
       const geo&   get_boundary_geo() const;
3335
 
     };
3336
 
 
3337
 
 
3338
 
File: rheolef.info,  Node: domain class,  Up: Classes
3339
 
 
3340
 
5.9 `domain' - part of a finite element mesh
3341
 
============================================
3342
 
 
3343
 
(Source file: `nfem/lib/domain.h') 
3344
 
 
3345
 
Description
3346
 
-----------
3347
 
 
3348
 
The `domain' class defines a container for a part of a   finite element
3349
 
mesh.    This describes the connectivity of edges or faces.    This
3350
 
class is usefull for boundary condition setting.
3351
 
 
3352
 
Implementation
3353
 
--------------
3354
 
 
3355
 
     class domain : public Vector<geo_element> {
3356
 
     public:
3357
 
 
3358
1858
     // typedefs:
3359
1859
 
3360
 
           typedef Vector<geo_element> sidelist_type;
3361
 
           typedef Vector<geo_element>::size_type size_type;
3362
 
 
3363
 
     // allocators/deallocators:
3364
 
 
3365
 
           domain(size_type sz = 0, const std::string& name = std::string());
3366
 
           domain(const domain&);
 
1860
         typedef typename std::size_t            size_type;
 
1861
         typedef T                               value_type;
 
1862
         typedef typename scalar_traits<T>::type float_type;
 
1863
         typedef geo_basic  <float_type,M>       geo_type;
 
1864
         typedef space_basic<float_type,M>       space_type;
 
1865
         class iterator;
 
1866
         class const_iterator;
 
1867
 
 
1868
     // allocator/deallocator:
 
1869
 
 
1870
         field_basic();
 
1871
 
 
1872
         explicit field_basic (
 
1873
             const space_type& V,
 
1874
             const T& init_value = std::numeric_limits<T>::max());
 
1875
 
 
1876
         void resize (
 
1877
             const space_type& V,
 
1878
             const T& init_value = std::numeric_limits<T>::max());
 
1879
 
 
1880
         field_basic                   (const field_indirect<T,M>&);
 
1881
         field_basic<T, M>& operator=  (const field_indirect<T,M>&);
 
1882
         field_basic                   (const field_indirect_const<T,M>&);
 
1883
         field_basic<T, M>& operator=  (const field_indirect_const<T,M>&);
 
1884
         template <class Expr> field_basic                   (const field_expr<Expr>&);
 
1885
         template <class Expr> field_basic<T, M>& operator=  (const field_expr<Expr>&);
 
1886
         field_basic<T, M>& operator=  (const T&);
3367
1887
 
3368
1888
     // accessors:
3369
1889
 
3370
 
           const std::string& name() const;
3371
 
           size_type dimension() const;
3372
 
 
3373
 
     // modifiers:
3374
 
 
3375
 
           void set_name(const std::string&);
3376
 
           void set_dimension(size_type d);
3377
 
           domain& operator=(const domain&);
3378
 
           domain& operator += (const domain&);
3379
 
           friend domain operator + (const domain&, const domain&);
3380
 
           void resize(size_type n);
3381
 
           void cat(const domain& d);
3382
 
           template <class IteratorPair>
3383
 
             void set(IteratorPair p, size_type n, const std::string& name);
3384
 
           template <class IteratorElement>
3385
 
             void set(IteratorElement p, size_type n, size_type dim, const std::string& name);
3386
 
 
3387
 
     //  input/ouput:
3388
 
 
3389
 
           friend std::ostream& operator << (std::ostream& s, const domain& d);
3390
 
           friend std::istream& operator >> (std::istream& s, domain& d);
3391
 
           std::ostream& put_vtk (std::ostream& vtk, Vector<point>::const_iterator first_p,
3392
 
                     Vector<point>::const_iterator last_p) const;
3393
 
           std::ostream& dump (std::ostream& s = std::cerr) const;
3394
 
           void check() const;
 
1890
         const geo_type&   get_geo() const { return _V.get_geo(); }
 
1891
         const space_type& get_space() const { return _V; }
 
1892
         const distributor& ownership() const { return get_space().ownership(); }
 
1893
         const communicator& comm() const { return ownership().comm(); }
 
1894
         size_type dis_size() const { return ownership().dis_size(); }
 
1895
         size_type size() const { return ownership().size(); }
 
1896
         std::string get_stamp() const { return _V.get_stamp(); }
 
1897
 
 
1898
               T& dof (size_type idof);
 
1899
         const T& dof (size_type idof) const;
 
1900
 
 
1901
         basic_point<T> x_dof (size_type idof) const { return get_space().x_dof (idof); }
 
1902
 
 
1903
         field_indirect<T,M>       operator[] (const geo_basic<T,M>& dom);
 
1904
         field_indirect<T,M>       operator[] (std::string dom_name);
 
1905
         field_indirect_const<T,M> operator[] (const geo_basic<T,M>& dom) const;
 
1906
         field_indirect_const<T,M> operator[] (std::string dom_name) const;
 
1907
 
 
1908
         iterator begin();
 
1909
         iterator end();
 
1910
         const_iterator begin() const;
 
1911
         const_iterator end() const;
 
1912
 
 
1913
         T min() const;
 
1914
         T max() const;
 
1915
         T max_abs() const;
 
1916
 
 
1917
     // input/output:
 
1918
 
 
1919
         idiststream& get (idiststream& ips);
 
1920
         odiststream& put (odiststream& ops) const;
 
1921
         odiststream& put_field (odiststream& ops) const;
3395
1922
 
3396
1923
     // data:
3397
1924
     protected:
3398
 
           std::string   _name;
3399
 
           size_type     _dim;
3400
 
 
 
1925
         space_type  _V;
 
1926
     public:
 
1927
         vec<T,M>    u;
 
1928
         vec<T,M>    b;
 
1929
     };
 
1930
     template <class T, class M>
 
1931
     idiststream& operator >> (odiststream& ips, field_basic<T,M>& u);
 
1932
 
 
1933
     template <class T, class M>
 
1934
     odiststream& operator << (odiststream& ops, const field_basic<T,M>& u);
 
1935
 
 
1936
     typedef field_basic<Float> field;
 
1937
 
 
1938
 
 
1939
File: rheolef.info,  Node: element class,  Up: Classes
 
1940
 
 
1941
5.9 `element' - the finite element method
 
1942
=========================================
 
1943
 
 
1944
(Source file: `nfem/plib/element.h') 
 
1945
 
 
1946
Description
 
1947
-----------
 
1948
 
 
1949
Defines the finite element method in use: it is a combination of three
 
1950
choosen ingredients: a geometrical element, a polynomial `basis'
 
1951
(*note basis internal::)   and a set of momentums.    The finite
 
1952
element method is defined on various `reference_element's   (*note
 
1953
reference_element internal::)   and then   transformed on any concrete
 
1954
`geo_element' of a `geo' by using   the Piola transformation   (*note
 
1955
geo_element internal::, *note geo class::).    The `element' class
 
1956
defines also how the basis and momentums are also transformed   by the
 
1957
Piola transformation.
 
1958
 
 
1959
To do
 
1960
-----
 
1961
 
 
1962
The `element' class is a virtual class, basis of a hierarchy   of
 
1963
classes such as `lagrange', `hermitte', etc.    It is used by the
 
1964
`space' class for assembling `field's and `form's   (*note space
 
1965
class::, *note field class::, *note form class::).
 
1966
 
 
1967
Implementation
 
1968
--------------
 
1969
 
 
1970
     template<class T, class M>
 
1971
     class element : public smart_pointer<element_rep<T,M> > {
 
1972
     public:
 
1973
     // typedefs:
 
1974
         typedef element_rep<T,M>        rep;
 
1975
         typedef smart_pointer<rep>      base;
 
1976
         typedef typename rep::size_type size_type;
 
1977
 
 
1978
     // allocators:
 
1979
 
 
1980
         element (std::string name = "");
 
1981
 
 
1982
     // accessors:
 
1983
 
 
1984
         std::string name() const;
 
1985
         const basis& get_basis() const;
 
1986
         const numbering<T,M>& get_numbering() const;
 
1987
         const basis&  get_p1_transformation() const;
 
1988
 
 
1989
         basic_point<T> x_dof (size_type idof, const geo_basic<T,M>& omega) const;
 
1990
         basic_point<T> x_dof (const geo_element& K, size_type loc_idof, const geo_basic<T,M>& omega) const;
 
1991
 
 
1992
     // comparator:
 
1993
 
 
1994
         bool operator== (const element<T,M>& elt) const { return name() == elt.name(); }
3401
1995
     };
3402
1996
 
3403
1997
 
3404
1998
File: rheolef.info,  Node: form class,  Up: Classes
3405
1999
 
3406
 
5.10 `form' - representation of a finite element operator
3407
 
=========================================================
 
2000
5.10 `form' - representation of a finite element bilinear form
 
2001
==============================================================
3408
2002
 
3409
 
(Source file: `nfem/lib/form.h')
 
2003
(Source file: `nfem/plib/form.h')
3410
2004
 
3411
2005
Description
3412
2006
-----------
3413
2007
 
3414
2008
The form class groups four sparse matrix, associated to   a bilinear
3415
 
form on finite element space.    This class is represented by four
3416
 
sparse matrix,   associated to unknown and blocked degrees of freedom
3417
 
of origin and destination spaces   (*note space class::).
 
2009
form on two finite element spaces:
 
2010
            a: U*V   ----> IR
 
2011
              (u,v)  |---> a(u,v)
 
2012
  The operator `A' associated to the bilinear form is   defined by:
 
2013
            A: U  ----> V'
 
2014
               u  |---> A(u)
 
2015
  where `A(u)' is such that `a(u,v)=<A(u),v>'   for all u in U and v in
 
2016
V and where `<.,.>' denotes   the duality product between V and V'.
 
2017
Since V is a   finite dimensional spaces, the duality product is   the
 
2018
euclidian product in IR^dim(V).
 
2019
 
 
2020
Since both U and V are finite dimensional spaces,   the linear operator
 
2021
can be represented by a matrix.    The `form' class is represented by
 
2022
four sparse matrix   in `csr' format (*note csr class::),   associated
 
2023
to unknown and blocked degrees of freedom   of origin and destination
 
2024
spaces (*note space class::).
3418
2025
 
3419
2026
Example
3420
2027
-------
3422
2029
The operator A associated to a bilinear form a(.,.) by   the relation
3423
2030
(Au,v) = a(u,v) could be applied by using   a sample matrix notation
3424
2031
A*u, as shown by the following code:
3425
 
           geo m("square");
3426
 
           space V(m,"P1");
3427
 
           form a(V,V,"grad_grad");
3428
 
           field x(V);
3429
 
           x = fct;
3430
 
           field y = a*x;
3431
 
           cout << plotmtv << y;
 
2032
           geo omega("square");
 
2033
           space V (omega,"P1");
 
2034
           form a (V,V,"grad_grad");
 
2035
           field uh = interpolate (fct, V);
 
2036
           field vh = a*uh;
 
2037
           cout << v;
3432
2038
 
3433
 
This block-matrix operation is equivalent to:
3434
 
          y.u = a.uu*x.u + a.ub*x.b;
3435
 
          y.b = a.bu*x.u + a.bb*x.b;
 
2039
The block-matrix `v=a*u' operation is equivalent to:
 
2040
          vh.u = a.uu*uh.u + a.ub*uh.b;
 
2041
          vh.b = a.bu*uh.u + a.bb*uh.b;
3436
2042
 
3437
2043
Implementation
3438
2044
--------------
3439
2045
 
3440
 
     class form {
 
2046
     template<class T, class M>
 
2047
     class form_basic {
3441
2048
     public :
3442
2049
     // typedefs:
3443
2050
 
3444
 
         typedef csr<Float>::size_type size_type;
 
2051
         typedef typename csr<T,M>::size_type    size_type;
 
2052
         typedef T                               value_type;
 
2053
         typedef typename scalar_traits<T>::type float_type;
 
2054
         typedef geo_basic<float_type,M>         geo_type;
 
2055
         typedef space_basic<float_type,M>       space_type;
3445
2056
 
3446
2057
     // allocator/deallocator:
3447
2058
 
3448
 
         form ();
3449
 
         form (const space& X, const space& Y);
3450
 
             //  locked_boundaries means that special vector BCs are applied,
3451
 
             //  see space::lock_components()
3452
 
         form (const space& X, const space& Y, const std::string& op_name,
3453
 
             bool locked_boundaries=false);
3454
 
         form (const space& X, const space& Y, const std::string& op_name, const domain& d);
3455
 
             //  Currently weighted forms in P2 spaces use a quadrature formula which is
3456
 
             //  limited to double precision floats.
3457
 
         form (const space& X, const space& Y, const std::string& op_name, const field& wh,
3458
 
             bool use_coordinate_system_weight=true);
3459
 
         form (const space& X, const space& Y, const std::string& op_name,
3460
 
             const domain& d, const field& wh, bool use_coordinate_system_weight=true);
3461
 
         form (const space& X, const std::string& op_name);
3462
 
         form (const form_diag& X);
 
2059
         form_basic ();
 
2060
         form_basic (const space_type& X, const space_type& Y, const std::string& name);
 
2061
         form_basic (const space_type& X, const space_type& Y, const std::string& name, const geo_basic<T,M>& gamma);
3463
2062
 
3464
2063
     // accessors:
3465
2064
 
3466
 
         const geo&   get_geo() const;
3467
 
         const space& get_first_space() const;
3468
 
         const space& get_second_space() const;
3469
 
         size_type nrow() const;
3470
 
         size_type ncol() const;
3471
 
         bool for_locked_boundaries() const { return _for_locked_boundaries; }
 
2065
         const space_type& get_first_space() const;
 
2066
         const space_type& get_second_space() const;
 
2067
         const geo_type&   get_geo() const;
 
2068
 
 
2069
         const communicator& comm() const;
3472
2070
 
3473
2071
     // linear algebra:
3474
2072
 
3475
 
         Float operator () (const class field&, const class field&) const;
3476
 
         friend class field operator * (const form& a, const class field& x);
3477
 
         field trans_mult (const field& x) const;
3478
 
         friend form trans(const form&);
3479
 
         friend form operator * (const Float& lambda, const form&);
3480
 
         friend form operator + (const form&, const form&);
3481
 
         friend form operator - (const form&);
3482
 
         friend form operator - (const form&, const form&);
3483
 
         friend form operator * (const form&, const form&);
3484
 
         friend form operator * (const form&, const form_diag&);
3485
 
         friend form operator * (const form_diag&, const form&);
3486
 
 
3487
 
     // input/output:
3488
 
 
3489
 
         friend std::ostream& operator << (std::ostream& s, const form& a);
3490
 
         friend class form_manip;
 
2073
         form_basic<T,M>  operator+ (const form_basic<T,M>& b) const;
 
2074
         form_basic<T,M>  operator- (const form_basic<T,M>& b) const;
 
2075
         field_basic<T,M> operator* (const field_basic<T,M>& xh) const;
 
2076
 
 
2077
         float_type operator () (const field_basic<T,M>& uh, const field_basic<T,M>& vh) const;
 
2078
 
 
2079
     // io:
 
2080
 
 
2081
         odiststream& put (odiststream& ops, bool show_partition = true) const;
 
2082
         void dump (std::string name) const;
3491
2083
 
3492
2084
     // data
3493
2085
     protected:
3494
 
         space      X_;
3495
 
         space      Y_;
3496
 
         bool       _for_locked_boundaries;
3497
 
     public :
3498
 
         csr<Float> uu;
3499
 
         csr<Float> ub;
3500
 
         csr<Float> bu;
3501
 
         csr<Float> bb;
 
2086
         space_type  _X;
 
2087
         space_type  _Y;
 
2088
     public:
 
2089
         csr<T,M>      uu;
 
2090
         csr<T,M>      ub;
 
2091
         csr<T,M>      bu;
 
2092
         csr<T,M>      bb;
 
2093
 
 
2094
     // internals:
 
2095
     protected:
 
2096
         void assembly (const form_element<T,M>&   form_e,
 
2097
                        const geo_basic<T,M>&      X_geo,
 
2098
                        const geo_basic<T,M>&      Y_geo,
 
2099
                        bool  X_geo_is_background = true);
3502
2100
     };
3503
 
     form form_nul(const space& X, const space& Y) ;
3504
 
 
3505
 
 
3506
 
File: rheolef.info,  Node: branch class,  Up: Classes
3507
 
 
3508
 
5.11 `branch' - (t,uh
3509
 
=====================
3510
 
 
3511
 
(Source file: `nfem/lib/branch.h')
3512
 
 
3513
 
Description
3514
 
-----------
3515
 
 
3516
 
Stores a `field' together with its associated parameter   value: a
3517
 
`branch' variable represents a pair (t,uh(t)) for   a specific value of
3518
 
the parameter t.    Applications concern time-dependent problems and
3519
 
continuation methods.
3520
 
 
3521
 
This class is convenient for file inputs/outputs   and building
3522
 
graphical animations.
3523
 
 
3524
 
Examples
3525
 
--------
3526
 
 
3527
 
Coming soon...
3528
 
 
3529
 
Limitations
3530
 
-----------
3531
 
 
3532
 
This class is under development.
3533
 
 
3534
 
The `branch' class store pointers on `field' class   without reference
3535
 
counting. Thus, `branch' automatic   variables cannot be returned by
3536
 
functions. `branch'   variable are limited to local variables.
3537
 
 
3538
 
At each step, meshes are reloaded and spaces are rebuilted, even   when
3539
 
they are identical.
3540
 
 
3541
 
The `vtk' render does not support mesh change during   the loop (e.g.
3542
 
when using adaptive mesh process).
3543
 
 
3544
 
Implementation
3545
 
--------------
3546
 
 
3547
 
     class branch : public std::vector<std::pair<std::string,field> > {
3548
 
     public :
3549
 
 
3550
 
     // allocators:
3551
 
 
3552
 
             branch ();
3553
 
             branch (const std::string& parameter_name, const std::string& u_name);
3554
 
             branch (const std::string& parameter_name, const std::string& u_name, const std::string& p_name);
3555
 
             ~branch ();
3556
 
 
3557
 
     // accessors:
3558
 
 
3559
 
             const Float&  parameter () const;
3560
 
             const std::string& parameter_name () const;
3561
 
             size_type     n_value () const;
3562
 
             size_type     n_field () const;
3563
 
 
3564
 
     // modifiers:
3565
 
 
3566
 
             void set_parameter (const Float& value);
3567
 
 
3568
 
     // input/output:
3569
 
 
3570
 
             // get/set current value
3571
 
             friend std::istream& operator >> (std::istream&, branch&);
3572
 
             friend std::ostream& operator << (std::ostream&, const branch&);
3573
 
 
3574
 
             __branch_header         header ();
3575
 
             __const_branch_header   header () const;
3576
 
             __const_branch_finalize finalize () const;
3577
 
 
3578
 
             __obranch operator() (const Float& t, const field& u);
3579
 
             __obranch operator() (const Float& t, const field& u, const field& p);
3580
 
 
3581
 
             __iobranch operator() (Float& t, field& u);
3582
 
             __iobranch operator() (Float& t, field& u, field& p);
 
2101
     typedef form_basic<Float,rheo_default_memory_model> form;
3583
2102
 
3584
2103
 
3585
2104
File: rheolef.info,  Node: tensor class,  Up: Classes
3586
2105
 
3587
 
5.12 `tensor' - a N*N tensor, N=1,2,3
 
2106
5.11 `tensor' - a N*N tensor, N=1,2,3
3588
2107
=====================================
3589
2108
 
3590
 
(Source file: `nfem/basis/tensor.h') 
 
2109
(Source file: `nfem/geo_element/tensor.h') 
3591
2110
 
3592
2111
Synopsys
3593
2112
--------
3654
2173
             friend tensor operator * (const tensor& a, const tensor& b);
3655
2174
             friend tensor inv        (const tensor& a, size_type d = 3);
3656
2175
             friend tensor diag (const point& d);
 
2176
             friend tensor identity (size_t d=3);
 
2177
             friend tensor dyadic (const point& u, const point& v, size_t d=3);
3657
2178
 
3658
2179
     // metric and geometric transformations:
3659
2180
 
3699
2220
 
3700
2221
File: rheolef.info,  Node: point class,  Up: Classes
3701
2222
 
3702
 
5.13 `point' - vertex of a mesh
 
2223
5.12 `point' - vertex of a mesh
3703
2224
===============================
3704
2225
 
3705
 
(Source file: `nfem/basis/basic_point.h') 
 
2226
(Source file: `nfem/geo_element/basic_point.h') 
3706
2227
 
3707
2228
Description
3708
2229
-----------
3753
2274
             std::istream& get (std::istream& s, int d = 3)
3754
2275
             {
3755
2276
                 switch (d) {
 
2277
                 case 0 : _x[0] = _x[1] = _x[2] = 0; return s;
3756
2278
                 case 1 : _x[1] = _x[2] = 0; return s >> _x[0];
3757
2279
                 case 2 : _x[2] = 0; return s >> _x[0] >> _x[1];
3758
2280
                 default: return s >> _x[0] >> _x[1] >> _x[2];
3862
2384
             const basic_point<T>& c, const basic_point<T>& x = basic_point<T>());
3863
2385
 
3864
2386
 
3865
 
File: rheolef.info,  Node: ic0 class,  Up: Classes
3866
 
 
3867
 
5.14 `ic0' - incomplete Choleski factorization
3868
 
==============================================
3869
 
 
3870
 
(Source file: `skit/lib/ic0.h') 
3871
 
 
3872
 
Description
3873
 
-----------
3874
 
 
3875
 
The class implements the icomplete Choleski factorization IC0(A)  when
3876
 
$A$ is a square symmetric matrix stored in CSR format.
3877
 
             csr<double> a = ...;
3878
 
             ic0<double> fact(a);
3879
 
 
3880
 
Implementation
3881
 
--------------
3882
 
 
3883
 
     template <class T>
3884
 
     class basic_ic0 : public csr<T> {
3885
 
     public:
3886
 
       typedef typename csr<T>::size_type size_type;
3887
 
       typedef          T                 element_type;
3888
 
     // constructors:
3889
 
       basic_ic0 ();
3890
 
       explicit basic_ic0 (const csr<T>& a);
3891
 
     // solver:
3892
 
       void inplace_solve (vec<T>& x) const;
3893
 
       void solve (const vec<T>& b, vec<T>& x) const;
3894
 
       vec<T> solve (const vec<T>& b) const;
 
2387
File: rheolef.info,  Node: pcg class,  Up: Classes
 
2388
 
 
2389
5.13 `pcg' - conjugate gradient algorithm.
 
2390
==========================================
 
2391
 
 
2392
(Source file: `skit/plib2/pcg.h') 
 
2393
 
 
2394
Synopsis
 
2395
--------
 
2396
 
 
2397
         template <class Matrix, class Vector, class Preconditioner, class Real>
 
2398
         int pcg (const Matrix &A, Vector &x, const Vector &b,
 
2399
           const Preconditioner &M, int &max_iter, Real &tol, odiststream *p_derr=0);
 
2400
 
 
2401
Example
 
2402
-------
 
2403
 
 
2404
The simplest call to 'pcg' has the folling form:
 
2405
         size_t max_iter = 100;
 
2406
         double tol = 1e-7;
 
2407
         int status = pcg(a, x, b, EYE, max_iter, tol, &cerr);
 
2408
 
 
2409
Description
 
2410
-----------
 
2411
 
 
2412
`pcg' solves the symmetric positive definite linear   system Ax=b using
 
2413
the Conjugate Gradient method.
 
2414
 
 
2415
The return value indicates convergence within max_iter (input)
 
2416
iterations (0), or no convergence within max_iter iterations (1).
 
2417
Upon successful return, output arguments have the following values:
 
2418
`x'
 
2419
     approximate solution to Ax = b
 
2420
 
 
2421
`max_iter'
 
2422
     the number of iterations performed before the tolerance was reached
 
2423
 
 
2424
`tol'
 
2425
     the residual after the final iteration
 
2426
 
 
2427
Note
 
2428
----
 
2429
 
 
2430
`pcg' is an iterative template routine.
 
2431
 
 
2432
`pcg' follows the algorithm described on p. 15 in
 
2433
 
 
2434
             Templates for the Solution of Linear Systems: Building
 
2435
     Blocks for Iterative Methods,         2nd Edition,         R.
 
2436
     Barrett, M. Berry, T. F. Chan, J. Demmel, J. Donato, J. Dongarra,
 
2437
     V. Eijkhout,         R. Pozo, C. Romine, H. Van der Vorst,
 
2438
     SIAM, 1994,         `ftp.netlib.org/templates/templates.ps'.
 
2439
 
 
2440
The present implementation is inspired from   `IML++ 1.2' iterative
 
2441
method library,   `http://math.nist.gov/iml++'.
 
2442
 
 
2443
Implementation
 
2444
--------------
 
2445
 
 
2446
     template <class Matrix, class Vector, class Vector2, class Preconditioner, class Real, class Size>
 
2447
     int pcg(const Matrix &A, Vector &x, const Vector2 &Mb, const Preconditioner &M,
 
2448
             Size &max_iter, Real &tol, odiststream *p_derr = 0, std::string label = "cg")
 
2449
     {
 
2450
         Vector b = M.solve(Mb);
 
2451
         Real norm2_b = dot(Mb,b);
 
2452
         if (norm2_b == Real(0)) norm2_b = 1;
 
2453
         Vector Mr = Mb - A*x;
 
2454
         Real  norm2_r = 0;
 
2455
         if (p_derr) (*p_derr) << "[" << label << "] #iteration residue" << std::endl;
 
2456
         Vector p;
 
2457
         for (Size n = 0; n <= max_iter; n++) {
 
2458
             Vector r = M.solve(Mr);
 
2459
             Real prev_norm2_r = norm2_r;
 
2460
             norm2_r = dot(Mr, r);
 
2461
             if (p_derr) (*p_derr) << "[" << label << "] " << n << " " << ::sqrt(norm2_r/norm2_b) << std::endl;
 
2462
             if (norm2_r <= sqr(tol)*norm2_b) {
 
2463
               tol = ::sqrt(norm2_r/norm2_b);
 
2464
               max_iter = n;
 
2465
               return 0;
 
2466
             }
 
2467
             if (n == 0) {
 
2468
               p = r;
 
2469
             } else {
 
2470
               Real beta = norm2_r/prev_norm2_r;
 
2471
               p = r + beta*p;
 
2472
             }
 
2473
             Vector Mq = A*p;
 
2474
             Real alpha = norm2_r/dot(Mq, p);
 
2475
             x  += alpha*p;
 
2476
             Mr -= alpha*Mq;
 
2477
         }
 
2478
         tol = ::sqrt(norm2_r/norm2_b);
 
2479
         return 1;
 
2480
     }
 
2481
 
 
2482
 
 
2483
File: rheolef.info,  Node: index_set class,  Up: Classes
 
2484
 
 
2485
5.14 index_set - a set of indexes
 
2486
=================================
 
2487
 
 
2488
(Source file: `skit/plib2/index_set.h')
 
2489
 
 
2490
Synopsys
 
2491
--------
 
2492
 
 
2493
A class for: l = {1,3,...9} i.e. a wrapper for STL `set<size_t>' with
 
2494
 some assignment operators, such as l1 += l2.      This class is
 
2495
suitable for use with the `array<T>' class, as `array<index_set>'
 
2496
(*note array class::).
 
2497
 
 
2498
Implementation
 
2499
--------------
 
2500
 
 
2501
     class index_set : public std::set<std::size_t> {
 
2502
     public:
 
2503
 
 
2504
     // typedefs:
 
2505
 
 
2506
       typedef std::set<std::size_t>    base;
 
2507
       typedef std::size_t              value_type;
 
2508
       typedef std::size_t              size_type;
 
2509
 
 
2510
     // allocators:
 
2511
 
 
2512
       index_set ();
 
2513
       index_set (const index_set& x);
 
2514
       index_set& operator= (const index_set& x);
 
2515
       template <int N>
 
2516
       index_set& operator= (size_type x[N]);
 
2517
       void clear ();
 
2518
 
 
2519
     // basic algebra:
 
2520
 
 
2521
       void       insert     (size_type dis_i);    // a := a union {dis_i}
 
2522
       index_set& operator+= (size_type dis_i);    // idem
 
2523
       index_set& operator+= (const index_set& b); // a := a union b
 
2524
 
 
2525
       // a := a union b
 
2526
       void inplace_union        (const index_set& b);
 
2527
       void inplace_intersection (const index_set& b);
 
2528
 
 
2529
       // c := a union b
 
2530
       friend void set_union        (const index_set& a, const index_set& b, index_set& c);
 
2531
       friend void set_intersection (const index_set& a, const index_set& b, index_set& c);
 
2532
 
 
2533
     // io:
 
2534
 
 
2535
       friend std::istream& operator>> (std::istream& is, index_set& x);
 
2536
       friend std::ostream& operator<< (std::ostream& os, const index_set& x);
 
2537
 
 
2538
     // boost mpi:
 
2539
 
 
2540
       template <class Archive>
 
2541
       void serialize (Archive& ar, const unsigned int version);
 
2542
     };
 
2543
 
 
2544
 
 
2545
File: rheolef.info,  Node: mpi_assembly_end class,  Up: Classes
 
2546
 
 
2547
5.15 msgé_assembly_end - array or matrix assembly
 
2548
==================================================
 
2549
 
 
2550
(Source file: `skit/plib2/mpi_assembly_end.h')
 
2551
 
 
2552
Description
 
2553
-----------
 
2554
 
 
2555
Finish a dense array or sparse matrix assembly.
 
2556
 
 
2557
Complexity
 
2558
----------
 
2559
 
 
2560
**TO DO**
 
2561
 
 
2562
Implementation
 
2563
--------------
 
2564
 
 
2565
     template <
 
2566
         class Container,
 
2567
         class Message,
 
2568
         class Size>
 
2569
     Size
 
2570
     mpi_assembly_end (
 
2571
     // input:
 
2572
         Message&            receive,
 
2573
         Message&            send,
 
2574
         Size                receive_max_size,
 
2575
     // output:
 
2576
         Container           x)
 
2577
     {
 
2578
         typedef Size                          size_type;
 
2579
         typedef typename Container::data_type data_type;
 
2580
         // -----------------------------------------------------------------
 
2581
         // 1) receive data and store it in container
 
2582
         // -----------------------------------------------------------------
 
2583
 
 
2584
         // note: for wait_any, build an iterator adapter that scan the pair.second in [index,request]
 
2585
         // and then get an iterator in the pair using iter.base(): retrive the corresponding index
 
2586
         // for computing the position in the receive.data buffer
 
2587
         typedef boost::transform_iterator<select2nd<size_type,mpi::request>,
 
2588
                     typename std::list<std::pair<size_type,mpi::request> >::iterator>
 
2589
                 request_iterator;
 
2590
 
 
2591
     #define _RHEOLEF_BUG_FOR_NON_MPI_DATA_TYPE
 
2592
     #ifdef _RHEOLEF_BUG_FOR_NON_MPI_DATA_TYPE
 
2593
         while (receive.waits.size() != 0) {
 
2594
             request_iterator iter_r_waits (receive.waits.begin(), select2nd<size_type,mpi::request>()),
 
2595
                              last_r_waits (receive.waits.end(),   select2nd<size_type,mpi::request>());
 
2596
             // waits on any receive...
 
2597
             std::pair<mpi::status,request_iterator> pair_status = mpi::wait_any (iter_r_waits, last_r_waits);
 
2598
             // check status
 
2599
             boost::optional<int> i_msg_size_opt = pair_status.first.template count<data_type>();
 
2600
             check_macro (i_msg_size_opt, "receive wait failed");
 
2601
             int iproc = pair_status.first.source();
 
2602
             check_macro (iproc >= 0, "receive: source iproc = "<<iproc<<" < 0 !");
 
2603
             // get size of receive and number in data
 
2604
             size_type i_msg_size = (size_type)i_msg_size_opt.get();
 
2605
             typename std::list<std::pair<size_type,mpi::request> >::iterator i_pair_ptr = pair_status.second.base();
 
2606
             size_type i_receive = (*i_pair_ptr).first;
 
2607
             size_type i_start = i_receive*receive_max_size;
 
2608
             for (size_type j = i_start; j < i_start + i_msg_size; j++) {
 
2609
                 x (receive.data[j]);
 
2610
             }
 
2611
             receive.waits.erase (i_pair_ptr);
 
2612
         }
 
2613
     #else // _RHEOLEF_BUG_FOR_NON_MPI_DATA_TYPE
 
2614
         // wait_all works better when using an array of non mpi_data_type, as an array of set<size_t>
 
2615
         request_iterator iter_r_waits (receive.waits.begin(), select2nd<size_type,mpi::request>()),
 
2616
                          last_r_waits (receive.waits.end(),   select2nd<size_type,mpi::request>());
 
2617
         std::vector<mpi::status> recv_status (receive.waits.size());
 
2618
         mpi::wait_all (iter_r_waits, last_r_waits, recv_status.begin());
 
2619
         for (size_type i_recv = 0, n_recv = recv_status.size(); i_recv < n_recv; i_recv++) {
 
2620
             boost::optional<int> i_msg_size_opt = recv_status[i_recv].template count<data_type>();
 
2621
             check_macro (i_msg_size_opt, "receive wait failed");
 
2622
             int iproc = recv_status[i_recv].source();
 
2623
             check_macro (iproc >= 0, "receive: source iproc = "<<iproc<<" < 0 !");
 
2624
             // get size of receive and number in data
 
2625
             size_type i_msg_size = (size_type)i_msg_size_opt.get();
 
2626
             size_type i_start = i_recv*receive_max_size;
 
2627
             for (size_type j = i_start; j < i_start + i_msg_size; j++) {
 
2628
                 x (receive.data[j]);
 
2629
             }
 
2630
         }
 
2631
     #endif // _RHEOLEF_BUG_FOR_NON_MPI_DATA_TYPE
 
2632
         // -----------------------------------------------------------------
 
2633
         // 2) wait on sends
 
2634
         // -----------------------------------------------------------------
 
2635
         request_iterator iter_s_waits (send.waits.begin(), select2nd<size_type,mpi::request>()),
 
2636
                          last_s_waits (send.waits.end(),   select2nd<size_type,mpi::request>());
 
2637
         Size send_nproc = send.waits.size();
 
2638
         std::vector<mpi::status> send_status(send_nproc);
 
2639
         mpi::wait_all (iter_s_waits, last_s_waits, send_status.begin());
 
2640
         // -----------------------------------------------------------------
 
2641
         // 3) clear send & receive messages [waits,data]
 
2642
         // -----------------------------------------------------------------
 
2643
         send.waits.clear();
 
2644
         send.data.clear();
 
2645
         receive.waits.clear();
 
2646
         receive.data.clear();
 
2647
         return x.n_new_entry();
 
2648
     }
 
2649
 
 
2650
 
 
2651
File: rheolef.info,  Node: msg_left_permutation_apply class,  Up: Classes
 
2652
 
 
2653
5.16 msg_left_permutation_apply - sequentail apply
 
2654
==================================================
 
2655
 
 
2656
(Source file: `skit/plib2/msg_left_permutation_apply.h')
 
2657
 
 
2658
Description
 
2659
-----------
 
2660
 
 
2661
Applies a left permutation to an array.
 
2662
 
 
2663
Algorithm
 
2664
---------
 
2665
 
 
2666
msg_left_permutation_apply
 
2667
 
 
2668
"input": the length array   |   x(0:nx-1), py(0:n-1)   "output": the
 
2669
pointer array and the total size   |   y(0:n)   begin   |   for i := 0
 
2670
to n-1 do   |     y(py(i)) := x(i)   |   endfor   end
 
2671
 
 
2672
Complexity
 
2673
----------
 
2674
 
 
2675
Time and memory complexity is O(n).
 
2676
 
 
2677
Implementation
 
2678
--------------
 
2679
 
 
2680
     template <
 
2681
         class InputIterator1,
 
2682
         class InputIterator2,
 
2683
         class SetOp,
 
2684
         class OutputRandomIterator>
 
2685
     void
 
2686
     msg_left_permutation_apply (
 
2687
         InputIterator1              x,
 
2688
         SetOp                       op,
 
2689
         InputIterator2              py,
 
2690
         InputIterator2              last_py,
 
2691
         OutputRandomIterator        y)
 
2692
     {
 
2693
         while (py != last_py)
 
2694
             op(y[*py++], *x++);
 
2695
     }
 
2696
 
 
2697
 
 
2698
File: rheolef.info,  Node: polymorphic_map class,  Up: Classes
 
2699
 
 
2700
5.17 polymorphic_map - a map<size_t,T> like polymorphic container
 
2701
=================================================================
 
2702
 
 
2703
(Source file: `skit/plib2/polymorphic_map.h')
 
2704
 
 
2705
Synopsys
 
2706
--------
 
2707
 
 
2708
       template <class T> class polymorphic_map;
 
2709
 
 
2710
Implementation
 
2711
--------------
 
2712
 
 
2713
     template <class T, class V = typename polymorphic_traits<T>::derived_type>
 
2714
     class polymorphic_map : public smart_pointer<polymorphic_map_rep<T,V,mpl::size<V>::value> > {
 
2715
     public:
 
2716
 
 
2717
     // typedefs:
 
2718
 
 
2719
         static const size_t _n_variant  = mpl::size<V>::value;
 
2720
 
 
2721
         typedef sequential                                 memory_type;
 
2722
         typedef polymorphic_map_rep<T,V,_n_variant>        rep;
 
2723
         typedef smart_pointer<rep>                         base;
 
2724
         typedef typename rep::size_type                    size_type;
 
2725
         typedef typename rep::reference                    reference;
 
2726
         typedef typename rep::iterator                     iterator;
 
2727
         typedef typename rep::const_reference              const_reference;
 
2728
         typedef typename rep::const_iterator               const_iterator;
 
2729
 
 
2730
     // allocators:
 
2731
 
 
2732
         polymorphic_map ();
 
2733
 
 
2734
     // accessors & modifiers:
 
2735
 
 
2736
         size_type size () const;
 
2737
         iterator begin ();
 
2738
         iterator end ();
 
2739
         iterator find (size_type dis_i);
 
2740
         const_iterator begin () const;
 
2741
         const_iterator end () const;
 
2742
         const_iterator find (size_type dis_i) const;
 
2743
 
 
2744
     // i/o:
 
2745
 
 
2746
         odiststream& put (odiststream& ops) const;
 
2747
     };
 
2748
 
 
2749
 
 
2750
File: rheolef.info,  Node: mpi_polymorphic_assembly_begin class,  Up: Classes
 
2751
 
 
2752
5.18 mpi_polymorph_assembly_begin - for polymorph_array
 
2753
=======================================================
 
2754
 
 
2755
(Source file: `skit/plib2/mpi_polymorphic_assembly_begin.h')
 
2756
 
 
2757
Description
 
2758
-----------
 
2759
 
 
2760
Start a dense polymorph array matrix assembly.
 
2761
 
 
2762
Complexity
 
2763
----------
 
2764
 
 
2765
Assume that stash has indexes in increasing order.    cpu complexity :
 
2766
O(stash.size + nproc)   memory complexity : O(stash.size + nproc)   msg
 
2767
size complexity : O(stash.size + nproc)
 
2768
 
 
2769
When assembling a finite element matrix, the stash.size is at boundaries
 
2770
 of the mesh partition, and stash.size = O(nrow^alpha), where
 
2771
alpha=(d-1)/d   and d=2,3. Using nproc <= O(nrow^alpha) is performant.
 
2772
 
 
2773
Note
 
2774
----
 
2775
 
 
2776
The stash may be sorted by increasing nows and column.
 
2777
 
 
2778
Inspirated from Petsc (petsc/src/vec/vec/impls/mpi/pdvec.c), here with
 
2779
a pre-sorted stash, thanks to the stl::map data structure.
 
2780
 
 
2781
 
 
2782
File: rheolef.info,  Node: polymorphic_array class,  Up: Classes
 
2783
 
 
2784
5.19 polymorphic_array - an array of derived classes
 
2785
====================================================
 
2786
 
 
2787
(Source file: `skit/plib2/polymorphic_array.h')
 
2788
 
 
2789
Synopsys
 
2790
--------
 
2791
 
 
2792
       template <class T, class V> class polymorphic_array_seq_rep;
 
2793
 
 
2794
Description
 
2795
-----------
 
2796
 
 
2797
Geometric entities of finite elements are implemented by using  a
 
2798
polymorphic hierarchy of classes: the base class `geo_element'  is a
 
2799
pure virtual methods. Then, derived classes, such as  `geo_element_t'
 
2800
for a triangle, are introduced with a storage  zone for the indexes of
 
2801
its vertices in the mesh (See "geo"(3)).
 
2802
 
 
2803
Each element has a fixed size storage zone: a buffer of a  particular
 
2804
element type can be efficiently exchanged with MPI.
 
2805
 
 
2806
Here is an atempt to generalize the distributed array<T>,  with
 
2807
reference counting, to the polymorphic case. The base  class is denoted
 
2808
as T and the derived ones are included as  a vector of type V, e.g.
 
2809
V=mpl::vctor<T0,T1,T2>.
 
2810
 
 
2811
Todo
 
2812
----
 
2813
 
 
2814
Here, class Ti are suposed to have a method :         size_type
 
2815
variant() const;  that returns the class index i=0..n_variant-1.   A
 
2816
more general approch should us run-time type identification.
 
2817
 
 
2818
Finally, the container should honor an optional Allocator template
 
2819
class parameter.
 
2820
 
 
2821
Implementation
 
2822
--------------
 
2823
 
 
2824
     template <class T, class V>
 
2825
     class polymorphic_array<T,sequential,V> : public smart_pointer<polymorphic_array_seq_rep<T,V,mpl::size<V>::value> > {
 
2826
     public:
 
2827
 
 
2828
     // typedefs:
 
2829
 
 
2830
         static const size_t _n_variant  = mpl::size<V>::value;
 
2831
 
 
2832
         typedef sequential                                    memory_type;
 
2833
         typedef polymorphic_array_seq_rep<T,V,_n_variant>     rep;
 
2834
         typedef smart_pointer<rep>                            base;
 
2835
         typedef typename rep::size_type                       size_type;
 
2836
         typedef typename rep::reference                       reference;
 
2837
         typedef typename rep::const_reference                 const_reference;
 
2838
         typedef typename rep::iterator                        iterator;
 
2839
         typedef typename rep::const_iterator                  const_iterator;
 
2840
 
 
2841
     // constructors:
 
2842
 
 
2843
         polymorphic_array (size_type n = 0);
 
2844
         void resize       (size_type n);
 
2845
         polymorphic_array (const distributor& ownership);
 
2846
         void resize       (const distributor& ownership);
 
2847
 
 
2848
     // accessors & modifiers:
 
2849
 
 
2850
         size_type       size () const;
 
2851
         size_type       dis_size() const;
 
2852
         reference       operator[] (size_type i);
 
2853
         const_reference operator[] (size_type i) const;
 
2854
         const_iterator begin () const;
 
2855
         const_iterator end   () const;
 
2856
               iterator begin ();
 
2857
               iterator end   ();
 
2858
 
 
2859
         const distributor&  ownership() const;
 
2860
         const communicator& comm() const;
 
2861
 
 
2862
     // i/o:
 
2863
 
 
2864
         idiststream& get_values (idiststream& ips);
 
2865
         odiststream& put_values (odiststream& ops) const;
 
2866
         template <class PutFunction> odiststream& put_values (odiststream& ops, PutFunction put_element) const;
 
2867
         void dump (std::string name) const;
 
2868
     };
 
2869
     template <class T, class V>
 
2870
     odiststream& operator<< (odiststream& ops, const polymorphic_array<T,sequential,V>& x);
 
2871
 
 
2872
     template <class T, class V>
 
2873
     idiststream& operator>> (idiststream& ips, polymorphic_array<T,sequential,V>& x);
 
2874
 
 
2875
Implementation
 
2876
--------------
 
2877
 
 
2878
     template <class T, class V>
 
2879
     class polymorphic_array<T,distributed,V> : public smart_pointer<polymorphic_array_mpi_rep<T,V,mpl::size<V>::value> > {
 
2880
     public:
 
2881
 
 
2882
     // typedefs:
 
2883
 
 
2884
         static const size_t _n_variant  = mpl::size<V>::value;
 
2885
 
 
2886
         typedef distributed                                   memory_type;
 
2887
         typedef polymorphic_array_mpi_rep<T,V,_n_variant>     rep;
 
2888
         typedef smart_pointer<rep>                            base;
 
2889
         typedef typename rep::size_type                       size_type;
 
2890
         typedef typename rep::reference                       reference;
 
2891
         typedef typename rep::const_reference                 const_reference;
 
2892
         typedef typename rep::iterator                        iterator;
 
2893
         typedef typename rep::const_iterator                  const_iterator;
 
2894
 
 
2895
     // constructors:
 
2896
 
 
2897
     #ifdef TO_CLEAN
 
2898
         polymorphic_array (size_type n = 0);
 
2899
         void resize       (size_type n);
 
2900
     #endif // TO_CLEAN
 
2901
         polymorphic_array (const distributor& ownership = distributor());
 
2902
         void resize       (const distributor& ownership);
 
2903
 
 
2904
     // accessors & modifiers:
 
2905
 
 
2906
         size_type       size () const;
 
2907
         size_type       dis_size () const;
 
2908
         reference       operator[] (size_type i);
 
2909
         const_reference operator[] (size_type i) const;
 
2910
         const_iterator begin () const;
 
2911
         const_iterator end   () const;
 
2912
               iterator begin ();
 
2913
               iterator end   ();
 
2914
 
 
2915
         const distributor&  ownership() const;
 
2916
         const communicator& comm() const;
 
2917
 
 
2918
         void dis_entry_assembly_begin ();
 
2919
         void dis_entry_assembly_end ();
 
2920
 
 
2921
         void repartition (                                        // old_numbering for *this
 
2922
             const array<size_type,distributed>& partition,        // old_ownership
 
2923
             polymorphic_array<T,distributed,V>& new_array,        // new_ownership (created)
 
2924
             array<size_type,distributed>&       old_numbering,    // new_ownership
 
2925
             array<size_type,distributed>&       new_numbering) const; // old_ownership
 
2926
 
 
2927
       template<class Set>
 
2928
       void append_dis_entry (const Set& ext_idx_set, polymorphic_map<T,V>& ext_idx_map) const
 
2929
                     { base::data().append_dis_entry (ext_idx_set, ext_idx_map.data()); }
 
2930
 
 
2931
       template<class Set>
 
2932
       void get_dis_entry (const Set& ext_idx_set, polymorphic_map<T,V>& ext_idx_map) const
 
2933
                     { base::data().get_dis_entry (ext_idx_set, ext_idx_map.data()); }
 
2934
 
 
2935
       template<class Set>
 
2936
       void append_dis_indexes (const Set& ext_idx_set) { base::data().append_dis_indexes (ext_idx_set); }
 
2937
 
 
2938
       template<class Set>
 
2939
       void set_dis_indexes (const Set& ext_idx_set) { base::data().set_dis_indexes (ext_idx_set); }
 
2940
 
 
2941
             T& dis_at (size_type dis_i)       { return base::data().dis_at (dis_i); }
 
2942
       const T& dis_at (size_type dis_i) const { return base::data().dis_at (dis_i); }
 
2943
 
 
2944
     // i/o:
 
2945
 
 
2946
         idiststream& get_values (idiststream& ips);
 
2947
         odiststream& put_values (odiststream& ops) const;
 
2948
         template <class Permutation>
 
2949
         odiststream& permuted_put_values (odiststream& ops, const Permutation& perm) const;
 
2950
         template <class Permutation, class PutFunction>
 
2951
         odiststream& permuted_put_values (odiststream& ops, const Permutation& perm,
 
2952
                                     PutFunction put_element) const;
 
2953
         void dump (std::string name) const;
 
2954
     };
 
2955
     template <class T, class V>
 
2956
     odiststream& operator<< (odiststream& ops, const polymorphic_array<T,distributed,V>& x);
 
2957
 
 
2958
     template <class T, class V>
 
2959
     idiststream& operator>> (idiststream& ips, polymorphic_array<T,distributed,V>& x);
 
2960
 
 
2961
 
 
2962
File: rheolef.info,  Node: mpi_polymorphic_assembly_end class,  Up: Classes
 
2963
 
 
2964
5.20 mpi_polymorphic_assembly_end - polymorphic array assembly
 
2965
==============================================================
 
2966
 
 
2967
(Source file: `skit/plib2/mpi_polymorphic_assembly_end.h')
 
2968
 
 
2969
Description
 
2970
-----------
 
2971
 
 
2972
Finish a dense polymorphic array assembly.
 
2973
 
 
2974
Complexity
 
2975
----------
 
2976
 
 
2977
**TO DO**
 
2978
 
 
2979
Implementation
 
2980
--------------
 
2981
 
 
2982
     template <class Container, class Message>
 
2983
     struct mpi_polymorphic_assembly_end_t<Container,Message,N> {
 
2984
       void operator() (
 
2985
         // input:
 
2986
             const distributor&                             ownership,
 
2987
             Message&                                       receive, // buffer
 
2988
             Message&                                       send,    // buffer
 
2989
             boost::array<typename Container::size_type,N>& receive_max_size,
 
2990
         // output:
 
2991
             Container&                                     x) const;
 
2992
     };
 
2993
 
 
2994
 
 
2995
     template <class Container, class Message>
 
2996
     void
 
2997
     mpi_polymorphic_assembly_end_t<Container,Message,N>::operator() (
 
2998
         // input:
 
2999
             const distributor&                             ownership,
 
3000
             Message&                                       receive, // buffer
 
3001
             Message&                                       send,    // buffer
 
3002
             boost::array<typename Container::size_type,N>& receive_max_size,
 
3003
         // output:
 
3004
             Container&                                     x) const
 
3005
     {
 
3006
         typedef typename Container::size_type size_type;
 
3007
         const size_type  _n_variant = Container::_n_variant; // should be = N
 
3008
         // -----------------------------------------------------------------
 
3009
         // 1) receive data and store it in container
 
3010
         // -----------------------------------------------------------------
 
3011
         // note: for wait_any, build an iterator adapter that scan the pair.second in [index,request]
 
3012
         // and then get an iterator in the pair using iter.base(): retrive the corresponding index
 
3013
         // for computing the position in the receive.data buffer
 
3014
         typedef boost::transform_iterator<
 
3015
                     select2nd<size_type,mpi::request>,
 
3016
                     typename std::list<std::pair<size_type,mpi::request> >::iterator>
 
3017
                 request_iterator;
 
3018
 
 
3019
     #define _RHEOLEF_receive_data(z,k,unused)                                                                       \
 
3020
         while (receive.waits[k].size() != 0) {                                                                      \
 
3021
             typedef typename Container::T##k             T##k;                                                      \
 
3022
             typedef typename std::pair<size_type,T##k>   data##k##_type;                                            \
 
3023
             request_iterator iter_r_waits (receive.waits[k].begin(), select2nd<size_type,mpi::request>()),          \
 
3024
                              last_r_waits (receive.waits[k].end(),   select2nd<size_type,mpi::request>());          \
 
3025
             /* waits on any receive... */                                                                           \
 
3026
             std::pair<mpi::status,request_iterator> pair_status = mpi::wait_any (iter_r_waits, last_r_waits);       \
 
3027
             /* check status */                                                                                      \
 
3028
             boost::optional<int> i_msg_size_opt = pair_status.first.template count<data##k##_type>();               \
 
3029
             check_macro (i_msg_size_opt, "receive wait failed");                                                    \
 
3030
             int iproc = pair_status.first.source();                                                                 \
 
3031
             check_macro (iproc >= 0, "receive: source iproc = "<<iproc<<" < 0 !");                                  \
 
3032
             /* get size of receive and number in data */                                                            \
 
3033
             size_type i_msg_size = (size_type)i_msg_size_opt.get();                                                 \
 
3034
             typename std::list<std::pair<size_type,mpi::request> >::iterator i_pair_ptr                             \
 
3035
                  = pair_status.second.base();                                                                       \
 
3036
             size_type i_receive = (*i_pair_ptr).first;                                                              \
 
3037
             size_type i_start = i_receive*receive_max_size[k];                                                      \
 
3038
             for (size_type j = i_start; j < i_start + i_msg_size; j++) {                                            \
 
3039
                 size_type first_index = ownership.first_index();                                                    \
 
3040
                 size_type index       = receive.data._stack_##k[j].first;                                           \
 
3041
                 T##k      value       = receive.data._stack_##k[j].second;                                          \
 
3042
                 x.assign (index - first_index, value);                                                              \
 
3043
             }                                                                                                       \
 
3044
             receive.waits[k].erase (i_pair_ptr);                                                                    \
 
3045
         }
 
3046
         BOOST_PP_REPEAT(N, _RHEOLEF_receive_data, ~)
 
3047
     #undef _RHEOLEF_receive_data
 
3048
 
 
3049
     #ifdef TODO
 
3050
       size_type  start = ownership().first_index();                                 \
 
3051
       size_type  last  = ownership().last_index();                                  \
 
3052
       if (i_global >= start && i_global < last)                                     \
 
3053
         polymorphic_array_seq_rep<T,V,N>::assign (i_global - start, val);           \
 
3054
 
 
3055
     #endif // TODO
 
3056
         // -----------------------------------------------------------------
 
3057
         // 2) wait on sends
 
3058
         // -----------------------------------------------------------------
 
3059
         for (size_type k = 0; k < _n_variant; k++) {
 
3060
             request_iterator iter_s_waits (send.waits[k].begin(), select2nd<size_type,mpi::request>()),
 
3061
                              last_s_waits (send.waits[k].end(),   select2nd<size_type,mpi::request>());
 
3062
             size_type send_nproc = send.waits[k].size();
 
3063
             std::vector<mpi::status> send_status (send_nproc);
 
3064
             mpi::wait_all (iter_s_waits, last_s_waits, send_status.begin());
 
3065
         }
 
3066
         // -----------------------------------------------------------------
 
3067
         // 3) clear send & receive messages [waits,data]
 
3068
         // -----------------------------------------------------------------
 
3069
     #ifdef TODO
 
3070
         send.waits.clear();
 
3071
         send.data.clear();
 
3072
         receive.waits.clear();
 
3073
         receive.data.clear();
 
3074
     #endif // TODO
 
3075
     }
 
3076
 
 
3077
 
 
3078
File: rheolef.info,  Node: distributor class,  Up: Classes
 
3079
 
 
3080
5.21 distributor - data distribution table
 
3081
==========================================
 
3082
 
 
3083
(Source file: `skit/plib2/distributor.h')
 
3084
 
 
3085
Synopsys
 
3086
--------
 
3087
 
 
3088
Used by "array"(1), "asr"(1) and "csr"(1).     and such classes that
 
3089
distribute data as chunk.
 
3090
 
 
3091
Implementation
 
3092
--------------
 
3093
 
 
3094
     class distributor : public Vector<std::allocator<int>::size_type> {
 
3095
     public:
 
3096
 
 
3097
     // typedefs:
 
3098
 
 
3099
             typedef std::allocator<int>::size_type size_type;
 
3100
             typedef Vector<size_type>              _base;
 
3101
             typedef _base::iterator                iterator;
 
3102
             typedef _base::const_iterator          const_iterator;
 
3103
             typedef int                            tag_type;
 
3104
             typedef communicator                   communicator_type;
 
3105
 
 
3106
     // constants:
 
3107
 
 
3108
             static const size_type decide = size_type(-1);
 
3109
 
 
3110
     // allocators/deallocators:
 
3111
 
 
3112
             distributor(
 
3113
                     size_type dis_size = 0,
 
3114
                     const communicator_type& c = communicator_type(),
 
3115
                     size_type loc_size = decide);
 
3116
 
 
3117
             distributor(const distributor&);
 
3118
             ~distributor();
 
3119
 
 
3120
             void resize(
 
3121
                     size_type dis_size = 0,
 
3122
                     const communicator_type& c = communicator_type(),
 
3123
                     size_type loc_size = decide);
 
3124
 
3895
3125
     // accessors:
3896
 
       size_type nrow () const { return csr<T>::nrow(); }
3897
 
       size_type ncol () const { return csr<T>::ncol(); }
3898
 
       size_type nnz  () const { return csr<T>::nnz(); }
3899
 
     };
3900
 
     template <class T>
3901
 
     basic_ic0<T> ic0 (const csr<T>& a);
3902
 
 
3903
 
 
3904
 
File: rheolef.info,  Node: permutation class,  Up: Classes
3905
 
 
3906
 
5.15 `permutation' - permutation matrix
3907
 
=======================================
3908
 
 
3909
 
(Source file: `skit/lib/permutation.h') 
3910
 
 
3911
 
Description
3912
 
-----------
3913
 
 
3914
 
This class implements a permutation matrix.   Permutation matrix are
3915
 
used in factorization  implementation for optimizing the skyline format,
3916
 
as used by the implementation of the  `ssk' class (*note ssk class::).
3917
 
 
3918
 
Let a be a square invertible matrix in `csr' format  (*note csr
3919
 
class::):
3920
 
             csr<double> a;
3921
 
 
3922
 
We get the optimal Gibbs permutation matrix using  Gibbs, Pooles and
3923
 
Stockmeyer renumbering algorithm by:
3924
 
          permutation p = gibbs(a);
3925
 
 
3926
 
Implementation
3927
 
--------------
3928
 
 
3929
 
     class permutation : public Array<std::vector<int>::size_type> {
3930
 
     public:
3931
 
 
3932
 
     // typedefs:
3933
 
 
3934
 
         typedef Array<int>::size_type       size_type;
3935
 
         typedef Array<int>::difference_type difference_type;
3936
 
 
3937
 
     // allocators/deallocators:
3938
 
 
3939
 
         explicit permutation (size_type n = 0);
3940
 
     };
3941
 
     template<class T>
3942
 
     permutation gibbs (const csr<T>& a);
3943
 
 
3944
 
 
3945
 
File: rheolef.info,  Node: vec class,  Up: Classes
3946
 
 
3947
 
5.16 `vec' - dense vector
3948
 
=========================
3949
 
 
3950
 
(Source file: `skit/lib/vec.h') 
3951
 
 
3952
 
Description
3953
 
-----------
3954
 
 
3955
 
The class implements an array.   A declaration whithout any parametrers
3956
 
correspond to an array with a null size:
3957
 
             vec<Float> x;
3958
 
 Here, a `Float' array is specified.   Note that the `Float' depends
3959
 
upon the configuration  (*note Installing::).   The constructor can be
3960
 
invocated whith a size parameter:
3961
 
             vec<Float> x(n);
3962
 
 Notes that the constructor can be invocated with an initializer:
3963
 
             vec<Float> y = x;
3964
 
 or
3965
 
             Float lambda = 1.3;
3966
 
             vec<Float> y = lambda;
3967
 
 Assignments are
3968
 
             x = y;
3969
 
 or
3970
 
             x = lambda;
3971
 
 Linear combinations are         `x+y',         `x-y',
3972
 
`x*lambda',         `lambda*x',         `x/lambda'.
3973
 
 
3974
 
Others combinations are         `x*y',         `x/y',
3975
 
`lambda/x'.
3976
 
 
3977
 
The euclidian norm is         `norm(x)'  while         `dot(x,y)'
3978
 
denotes the euclidian scalar product,
3979
 
 
3980
 
Input/output routines overload "<<" and ">>" operators:
3981
 
             cin  >> x;
3982
 
 and
3983
 
             cout << x;
3984
 
 *Note iorheo class::.
 
3126
 
 
3127
             const communicator_type& comm() const;
 
3128
 
 
3129
             /// global and local sizes
 
3130
             size_type dis_size () const;
 
3131
 
 
3132
             /// current process id
 
3133
             size_type process () const;
 
3134
 
 
3135
             /// number of processes
 
3136
             size_type n_process () const;
 
3137
 
 
3138
             /// find iproc associated to a global index dis_i: CPU=log(nproc)
 
3139
             size_type find_owner (size_type dis_i) const;
 
3140
 
 
3141
             /// global index range and local size owned by ip-th process
 
3142
             size_type first_index (size_type ip) const;
 
3143
             size_type last_index (size_type ip) const;
 
3144
             size_type size (size_type ip) const;
 
3145
 
 
3146
             /// global index range and local size owned by current process
 
3147
             size_type first_index () const;
 
3148
             size_type last_index () const;
 
3149
             size_type size () const;
 
3150
 
 
3151
             /// true when dis_i in [first_index(ip):last_index(ip)[
 
3152
             bool is_owned (size_type dis_i, size_type ip) const;
 
3153
 
 
3154
             // the same with ip=current process
 
3155
             bool is_owned (size_type dis_i) const;
 
3156
 
 
3157
             /// returns a new tag
 
3158
             static tag_type get_new_tag();
 
3159
 
 
3160
     // data:
 
3161
     protected:
 
3162
             communicator_type _comm;
 
3163
     };
 
3164
 
 
3165
 
 
3166
File: rheolef.info,  Node: msg_from_context_indices class,  Up: Classes
 
3167
 
 
3168
5.22 msg_from_context_indices - gather
 
3169
======================================
 
3170
 
 
3171
(Source file: `skit/plib2/msg_from_context_indices.h')
 
3172
 
 
3173
Description
 
3174
-----------
 
3175
 
 
3176
Computes the receive compressed message pattern for gather   and
 
3177
scatter.    Suppose indexes are sorted by increasing order.
 
3178
 
 
3179
Algorithm
 
3180
---------
 
3181
 
 
3182
msg_from_context_indices
 
3183
 
 
3184
"input": the owner and indice arrays, the current process   |
 
3185
owner(0:nidx-1), idy(0:nidx-1),   |   proc2from_proc(0:nproc-1), my_proc
 
3186
 "input-output": the pointer array, used for accumulation   |
 
3187
ptr(0:nidx)   "output": the receive context (from) indice array   |
 
3188
from_idx(0:nidx-1)   begin   | for k := 0 to nidx-1 do   |   iproc :=
 
3189
owner(k)   |   if iproc <> my_proc then   |     i :=
 
3190
proc2from_proc(iproc)   |     p := ptr(i)   |     ptr(i) := p + 1   |
 
3191
 from_idx(p) := idy(k)   |   endif   | endfor   end
 
3192
 
 
3193
Complexity
 
3194
----------
 
3195
 
 
3196
Complexity is O(nidx).
 
3197
 
 
3198
Todo
 
3199
----
 
3200
 
 
3201
Uses input iterators.
 
3202
 
 
3203
Implementation
 
3204
--------------
 
3205
 
 
3206
     template <
 
3207
         class InputIterator1,
 
3208
         class InputIterator2,
 
3209
         class InputRandomIterator,
 
3210
         class Proc,
 
3211
         class Size,
 
3212
         class MutableRandomIterator,
 
3213
         class OutputIterator>
 
3214
     void
 
3215
     msg_from_context_indices (
 
3216
         InputIterator1              owner,                  // nidx
 
3217
         InputIterator1              last_owner,
 
3218
         InputIterator2              idy,                    // nidx
 
3219
         InputRandomIterator         proc2from_proc,         // nproc
 
3220
         Proc                        my_proc,
 
3221
         Size                        idy_maxval,
 
3222
         MutableRandomIterator       ptr,                    // send_nproc+1
 
3223
         OutputIterator              from_idx)               // nidx
 
3224
     {
 
3225
         Size nidx = distance(owner,last_owner);
 
3226
         for (Size i = 0; i < nidx; i++) {
 
3227
             if (owner[i] != my_proc) {
 
3228
                 assert_macro (idy[i] < idy_maxval, "Scattering past end of TO vector: idy="
 
3229
                     << idy[i] << " out of range 0.." << idy_maxval-1);
 
3230
                 Size p = ptr[proc2from_proc[owner[i]]]++;
 
3231
                 from_idx[p] = idy[i];
 
3232
             }
 
3233
         }
 
3234
     }
 
3235
 
 
3236
 
 
3237
File: rheolef.info,  Node: msg_both_permutation_apply class,  Up: Classes
 
3238
 
 
3239
5.23 msg_both_permutation_apply - sequentail apply
 
3240
==================================================
 
3241
 
 
3242
(Source file: `skit/plib2/msg_both_permutation_apply.h')
 
3243
 
 
3244
Description
 
3245
-----------
 
3246
 
 
3247
Applies permutations when copying an array.
 
3248
 
 
3249
Algorithm
 
3250
---------
 
3251
 
 
3252
msg_both_permutation_apply
 
3253
 
 
3254
"input": the length array   |   px(0:n-1), x(0:nx-1), py(0:n-1)
 
3255
"output": the pointer array and the total size   |   y(0:ny)   begin
 
3256
|   for i := 0 to n-1 do   |     y(py(i)) := x(px(i))   |   endfor   end
 
3257
 
 
3258
Complexity
 
3259
----------
 
3260
 
 
3261
Time and memory complexity is O(n).
 
3262
 
 
3263
Implementation
 
3264
--------------
 
3265
 
 
3266
     template <
 
3267
         class InputIterator1,
 
3268
         class InputIterator2,
 
3269
         class InputRandomIterator,
 
3270
         class SetOp,
 
3271
         class OutputRandomIterator>
 
3272
     void
 
3273
     msg_both_permutation_apply (
 
3274
         InputIterator1              px,
 
3275
         InputIterator1              last_px,
 
3276
         InputRandomIterator         x,
 
3277
         SetOp                       set_op,
 
3278
         InputIterator2              py,
 
3279
         OutputRandomIterator        y)
 
3280
     {
 
3281
         while (px != last_px)
 
3282
             set_op(y[*py++], x[*px++]);
 
3283
     }
 
3284
     } // namespace rheolef
 
3285
 
 
3286
 
 
3287
File: rheolef.info,  Node: msg_right_permutation_apply class,  Up: Classes
 
3288
 
 
3289
5.24 msg_right_permutation_apply - sequentail apply
 
3290
===================================================
 
3291
 
 
3292
(Source file: `skit/plib2/msg_right_permutation_apply.h')
 
3293
 
 
3294
Description
 
3295
-----------
 
3296
 
 
3297
Applies a permutation to an array.
 
3298
 
 
3299
Algorithm
 
3300
---------
 
3301
 
 
3302
msg_right_permutation_apply
 
3303
 
 
3304
"input": the length array   |   perm(0:n-1), x(0:nx-1)   "output": the
 
3305
pointer array and the total size   |   y(0:n)   begin   |   for i := 0
 
3306
to n-1 do   |     y(i) := x(perm(i))   |   endfor   end
 
3307
 
 
3308
Complexity
 
3309
----------
 
3310
 
 
3311
Time and memory complexity is O(n).
 
3312
 
 
3313
Implementation
 
3314
--------------
 
3315
 
 
3316
     template <
 
3317
         class InputIterator,
 
3318
         class InputRandomIterator,
 
3319
         class OutputIterator,
 
3320
         class SetOp>
 
3321
     OutputIterator
 
3322
     msg_right_permutation_apply (
 
3323
         InputIterator               perm,
 
3324
         InputIterator               last_perm,
 
3325
         const InputRandomIterator&  x,
 
3326
         OutputIterator              y,
 
3327
         SetOp                       set_op)
 
3328
     {
 
3329
         for (; perm != last_perm; y++, perm++) {
 
3330
             // something like: (*y++) = x[(*perm++)];
 
3331
             set_op (y, x, *perm);
 
3332
         }
 
3333
         return y;
 
3334
     }
 
3335
 
 
3336
 
 
3337
File: rheolef.info,  Node: mpi_assembly_begin class,  Up: Classes
 
3338
 
 
3339
5.25 mpi_assembly_begin - for array or matrix
 
3340
=============================================
 
3341
 
 
3342
(Source file: `skit/plib2/mpi_assembly_begin.h')
 
3343
 
 
3344
Description
 
3345
-----------
 
3346
 
 
3347
Start a dense array or a sparse matrix assembly.
 
3348
 
 
3349
Complexity
 
3350
----------
 
3351
 
 
3352
Assume that stash has indexes in increasing order.    cpu complexity :
 
3353
O(stash.size + nproc)   memory complexity : O(stash.size + nproc)   msg
 
3354
size complexity : O(stash.size + nproc)
 
3355
 
 
3356
When assembling a finite element matrix, the stash.size is at boundaries
 
3357
 of the mesh partition, and stash.size = O(nrow^alpha), where
 
3358
alpha=(d-1)/d   and d=2,3. Using nproc <= O(nrow^alpha) is performant.
3985
3359
 
3986
3360
Note
3987
3361
----
3988
3362
 
3989
 
Since the `vec<T>' class derives from the  `Array<T>' class, the `vec'
3990
 
class  present also a STL-like container interface.
 
3363
The stash may be sorted by increasing nows and column.
3991
3364
 
3992
 
Actually, the `vec<T>' implementation uses a STL  `vector<T>' class.
 
3365
Inspirated from Petsc (petsc/src/vec/vec/impls/mpi/pdvec.c), here with
 
3366
a pre-sorted stash, thanks to the stl::map data structure.
3993
3367
 
3994
3368
Implementation
3995
3369
--------------
3996
3370
 
3997
 
     template <class T>
3998
 
     class vec : public Array<T>
 
3371
     template <
 
3372
         class Stash,
 
3373
         class Message,
 
3374
         class InputIterator>
 
3375
     typename Stash::size_type
 
3376
     mpi_assembly_begin (
 
3377
      // input:
 
3378
         const Stash&                       stash,
 
3379
         InputIterator                      first_stash_idx, // wrapper in shash
 
3380
         InputIterator                      last_stash_idx,
 
3381
         const distributor&                 ownership,
 
3382
      // ouput:
 
3383
         Message&                           receive,         // buffer
 
3384
         Message&                           send)            // buffer
3999
3385
     {
4000
 
     public:
4001
 
 
4002
 
         typedef          T                   element_type;
4003
 
         typedef typename Array<T>::size_type size_type;
4004
 
 
4005
 
         // cstor, assignment
4006
 
             explicit vec (unsigned int n = 0, const T& init_value = std::numeric_limits<T>::max())
4007
 
               : Array<T>(n, init_value) {}
4008
 
             vec<T> operator = (T lambda);
4009
 
 
4010
 
         // accessors
4011
 
             unsigned int size () const { return Array<T>::size(); }
4012
 
             unsigned int n () const { return size(); }
4013
 
 
4014
 
     #ifdef _RHEOLEF_HAVE_EXPRESSION_TEMPLATE
4015
 
 
4016
 
             template <class X>
4017
 
             vec(const VExpr<X>& x) : Array<T>(x.size()) { assign (*this, x); }
4018
 
 
4019
 
             template <class X>
4020
 
             vec<T>& operator = (const VExpr<X>& x)
4021
 
                                     { logmodif(*this); return assign (*this, x); }
4022
 
     #endif // _RHEOLEF_HAVE_EXPRESSION_TEMPLATE
4023
 
     };
4024
 
     // io routines
4025
 
     template <class T> std::istream& operator >> (std::istream&, vec<T>&);
4026
 
     template <class T> std::ostream& operator << (std::ostream&, const vec<T>&);
 
3386
         typedef typename Stash::size_type      size_type;
 
3387
 
 
3388
         mpi::communicator     comm    = ownership.comm();
 
3389
         size_type             my_proc = ownership.process();
 
3390
         size_type             nproc   = ownership.n_process();
 
3391
         distributor::tag_type tag     = distributor::get_new_tag();
 
3392
 
 
3393
         // ----------------------------------------------------------------
 
3394
         // 1) count the messages contained in stash by process id
 
3395
         // ----------------------------------------------------------------
 
3396
         // assume that stash elements are sorted by increasing stash_idx (e.g. stash = stl::map)
 
3397
         // cpu complexity = O(stash.size + nproc)
 
3398
         // mem complexity = O(stash.size + nproc)
 
3399
         std::vector<size_type> msg_size(nproc, 0);
 
3400
         std::vector<size_type> msg_mark(nproc, 0);
 
3401
         size_type send_nproc = 0;
 
3402
         {
 
3403
           size_type iproc = 0;
 
3404
           size_type i = 0;
 
3405
           for (InputIterator iter_idx = first_stash_idx; iter_idx != last_stash_idx; iter_idx++, i++) {
 
3406
             for (; iproc < nproc; iproc++) {
 
3407
               if (*iter_idx >= ownership[iproc] && *iter_idx < ownership[iproc+1]) {
 
3408
                 msg_size [iproc]++;
 
3409
                 if (!msg_mark[iproc]) {
 
3410
                    msg_mark[iproc] = 1;
 
3411
                    send_nproc++;
 
3412
                 }
 
3413
                 break;
 
3414
               }
 
3415
             }
 
3416
             assert_macro (iproc != nproc, "bad stash data: index "<<*iter_idx<<" out of range [0:"<<ownership[nproc]<<"[");
 
3417
           }
 
3418
         } // end block
 
3419
         // ----------------------------------------------------------------
 
3420
         // 2) avoid to send message to my-proc in counting
 
3421
         // ----------------------------------------------------------------
 
3422
         if (msg_size [my_proc] != 0) {
 
3423
             msg_size [my_proc] = 0;
 
3424
             msg_mark [my_proc] = 0;
 
3425
             send_nproc--;
 
3426
         }
 
3427
         // ----------------------------------------------------------------
 
3428
         // 3) compute number of messages to be send to my_proc
 
3429
         // ----------------------------------------------------------------
 
3430
         // msg complexity : O(nproc) or O(log(nproc)), depending on reduce implementation
 
3431
         std::vector<size_type> work (nproc);
 
3432
         mpi::all_reduce (
 
3433
             comm,
 
3434
             msg_mark.begin().operator->(),
 
3435
             nproc,
 
3436
             work.begin().operator->(),
 
3437
             std::plus<size_type>());
 
3438
         size_type receive_nproc = work [my_proc];
 
3439
         // ----------------------------------------------------------------
 
3440
         // 4) compute messages max size to be send to my_proc
 
3441
         // ----------------------------------------------------------------
 
3442
         // msg complexity : O(nproc) or O(log(nproc)), depending on reduce implementation
 
3443
         mpi::all_reduce (
 
3444
             comm,
 
3445
             msg_size.begin().operator->(),
 
3446
             nproc,
 
3447
             work.begin().operator->(),
 
3448
             mpi::maximum<size_type>());
 
3449
         size_type receive_max_size = work [my_proc];
 
3450
         // ----------------------------------------------------------------
 
3451
         // 5) post receive: exchange the buffer adresses between processes
 
3452
         // ----------------------------------------------------------------
 
3453
         // Each message will consist of ordered pairs (global index,value).
 
3454
         // since we don't know how long each indiidual message is,
 
3455
         // we allocate the largest : receive_nproc*receive_max_size
 
3456
         // potentially, this is a lot of wasted space
 
3457
         // TODO: how to optimize the receive.data buffer ?
 
3458
         // cpu complexity : O(nproc)
 
3459
         // mem complexity : O(nproc*(stash.size/nproc)) = O(stash.size), worst case ?
 
3460
         // msg complexity : O(nproc)
 
3461
         receive.data.resize (receive_nproc*receive_max_size);
 
3462
         for (size_t i_receive = 0; i_receive < receive_nproc; i_receive++) {
 
3463
           mpi::request i_req = comm.irecv (
 
3464
               mpi::any_source,
 
3465
               tag,
 
3466
               receive.data.begin().operator->() + i_receive*receive_max_size,
 
3467
               receive_max_size);
 
3468
           receive.waits.push_back (std::make_pair(i_receive, i_req));
 
3469
         }
 
3470
         // ----------------------------------------------------------------
 
3471
         // 6) copy stash in send buffer
 
3472
         // ----------------------------------------------------------------
 
3473
         // since the stash is sorted by increasing order => simple copy
 
3474
         // cpu complexity : O(stash.size)
 
3475
         // mem complexity : O(stash.size)
 
3476
         send.data.resize (stash.size());
 
3477
         copy (stash.begin(), stash.end(), send.data.begin());
 
3478
         // ---------------------------------------------------------------------------
 
3479
         // 7) do send
 
3480
         // ---------------------------------------------------------------------------
 
3481
         // cpu complexity : O(nproc)
 
3482
         // mem complexity : O(send_nproc) \approx O(nproc), worst case
 
3483
         // msg complexity : O(stash.size)
 
3484
         send.waits.resize(send_nproc);
 
3485
         {
 
3486
           size_type i_send = 0;
 
3487
           size_type i_start = 0;
 
3488
           for (size_type iproc = 0; iproc < nproc; iproc++) {
 
3489
             size_type i_msg_size = msg_size[iproc];
 
3490
             if (i_msg_size == 0) continue;
 
3491
             mpi::request i_req = comm.isend (
 
3492
                 iproc,
 
3493
                 tag,
 
3494
                 send.data.begin().operator->() + i_start,
 
3495
                 i_msg_size);
 
3496
             send.waits.push_back(std::make_pair(i_send,i_req));
 
3497
             i_send++;
 
3498
             i_start += i_msg_size;
 
3499
           }
 
3500
         } // end block
 
3501
         return receive_max_size;
 
3502
     }
4027
3503
 
4028
3504
 
4029
 
File: rheolef.info,  Node: ssk class,  Up: Classes
4030
 
 
4031
 
5.17 `ssk' - symmetric skyline matrix format
4032
 
============================================
4033
 
 
4034
 
(Source file: `skit/lib/ssk.h') 
 
3505
File: rheolef.info,  Node: solver class,  Up: Classes
 
3506
 
 
3507
5.26 `solver' - direct or interative solver interface
 
3508
=====================================================
 
3509
 
 
3510
(Source file: `skit/plib2/solver.h') 
4035
3511
 
4036
3512
Description
4037
3513
-----------
4038
3514
 
4039
 
The class implements a symmetric matrix Choleski factorization.   Let A
4040
 
be a square invertible matrix in  `csr' format (*note csr class::).
 
3515
The class implements a matrix factorization:  LU factorization for an
 
3516
unsymmetric matrix and  Choleski fatorisation for a symmetric one.
 
3517
 
 
3518
Let A be a square invertible matrix in  `csr' format (*note csr
 
3519
class::).
4041
3520
             csr<Float> a;
4042
3521
 We get the factorization by:
4043
 
             ssk<Float> m = ldlt(a);
 
3522
             solver<Float> sa (a);
4044
3523
 Each call to the direct solver for a*x = b writes either:
4045
 
             vec<Float> x = m.solve(b);
4046
 
 or
4047
 
             m.solve(b,x);
4048
 
 
4049
 
Data structure
4050
 
--------------
4051
 
 
4052
 
The storage is either skyline, multi-file or  chevron.   This
4053
 
alternative depends upon the configuration  (*note Installing::).   The
4054
 
chevron data structure is related to the multifrontal  algorithm and is
4055
 
implemented by using the spooles library.   The multi-file data
4056
 
structure refers to the out-of-core  algorithm and is implemented by
4057
 
using the taucs library.   If such a library is not available, the
4058
 
`ssk' class  implements a skyline storage scheme and the profil storage
4059
 
of the  `ssk' matrix is optimized by optimizing the renumbering,  by
4060
 
using the Gibbs, Pooles and Stockmeyer algorithm available  via the
4061
 
`permutation' class  (*note permutation class::).
4062
 
 
4063
 
         Algorithm 582, collected Algorithms from ACM.      Algorithm
4064
 
     appeared in ACM-Trans. Math. Software, vol.8, no. 2,     Jun.,
4065
 
     1982, p. 190.
4066
 
 When implementing the skyline data structure,  we can go back to the
4067
 
`csr' format, for the  pupose of pretty-printing:
4068
 
             cout << ps << color << logscale << csr<Float>(m);
4069
 
 
4070
 
Implementation
4071
 
--------------
4072
 
 
4073
 
     template<class T>
4074
 
     class ssk : smart_pointer<spooles_rep<T> > {
4075
 
     public:
4076
 
     // typedefs:
4077
 
 
4078
 
             typedef          T                          element_type;
4079
 
             typedef typename spooles_rep<T>::size_type  size_type;
4080
 
 
4081
 
     // allocators/deallocators:
4082
 
 
4083
 
             ssk ();
4084
 
             explicit ssk<T> (const csr<T>&);
4085
 
 
4086
 
     // accessors:
4087
 
 
4088
 
             size_type nrow () const;
4089
 
             size_type ncol () const;
4090
 
             size_type nnz  () const;
4091
 
 
4092
 
     // factorisation and solver:
4093
 
 
4094
 
             void solve(const vec<T>& b, vec<T>& x) const;
4095
 
             vec<T> solve(const vec<T>& b) const;
4096
 
             void factorize_ldlt();
4097
 
     protected:
4098
 
             const spooles_rep<T>& data() const {
4099
 
                     return smart_pointer<spooles_rep<T> >::data();
4100
 
             }
4101
 
             spooles_rep<T>& data() {
4102
 
                     return smart_pointer<spooles_rep<T> >::data();
4103
 
             }
4104
 
     };
4105
 
     template <class T>
4106
 
     ssk<T> ldlt (const csr<T>& m);
4107
 
 
4108
 
Implementation
4109
 
--------------
4110
 
 
4111
 
     template<class T>
4112
 
     class ssk : smart_pointer<umfpack_rep<T> > {
4113
 
     public:
4114
 
     // typedefs:
4115
 
 
4116
 
             typedef          T                          element_type;
4117
 
             typedef typename umfpack_rep<T>::size_type  size_type;
4118
 
 
4119
 
     // allocators/deallocators:
4120
 
 
4121
 
             ssk ();
4122
 
             explicit ssk<T> (const csr<T>&);
4123
 
 
4124
 
     // accessors:
4125
 
 
4126
 
             size_type nrow () const;
4127
 
             size_type ncol () const;
4128
 
             size_type nnz  () const;
4129
 
 
4130
 
     // factorisation and solver:
4131
 
 
4132
 
             void solve(const vec<T>& b, vec<T>& x) const;
4133
 
             vec<T> solve(const vec<T>& b) const;
4134
 
             void factorize_ldlt();
4135
 
             void factorize_lu();
4136
 
     protected:
4137
 
             const umfpack_rep<T>& data() const {
4138
 
                     return smart_pointer<umfpack_rep<T> >::data();
4139
 
             }
4140
 
             umfpack_rep<T>& data() {
4141
 
                     return smart_pointer<umfpack_rep<T> >::data();
4142
 
             }
4143
 
     };
4144
 
     template <class T>
4145
 
     ssk<T> ldlt (const csr<T>& m);
 
3524
             vec<Float> x = sa.solve(b);
 
3525
 When the matrix is modified in a computation loop but  conserves its
 
3526
sparsity pattern, an efficient re-factorization  writes:
 
3527
             sa.update_values (new_a);
 
3528
             x = sa.solve(b);
 
3529
 This approach skip the long step of the symbolic factization step.
 
3530
 
 
3531
Iterative solver
 
3532
----------------
 
3533
 
 
3534
The factorization can also be incomplete, i.e. a pseudo-inverse,
 
3535
suitable for preconditionning iterative methods.   In that case, the
 
3536
sa.solve(b) call runs a conjugate gradient  when the matrix is
 
3537
symmetric, or a generalized minimum residual  algorithm when the matrix
 
3538
is unsymmetric.
 
3539
 
 
3540
Automatic choice and customization
 
3541
----------------------------------
 
3542
 
 
3543
The symmetry of the matrix is tested via the a.is_symmetric() property
 
3544
(*note csr class::) while the choice between direct or iterative solver
 
3545
is switched from the a.pattern_dimension() value. When the pattern  is
 
3546
3D, an iterative method is faster and less memory consuming.
 
3547
Otherwhise, for 1D or 2D problems, the direct method is prefered.
 
3548
 
 
3549
These default choices can be supersetted by using explicit options:
 
3550
             solver_option_type opt;
 
3551
             opt.incomplete = true;
 
3552
             solver<Float> sa (a, opt);
 
3553
 See the solver.h header for the complete list of available options.
 
3554
 
 
3555
Implementation note
 
3556
-------------------
 
3557
 
 
3558
The implementation bases on the pastix library.
 
3559
 
 
3560
Implementation
 
3561
--------------
 
3562
 
 
3563
     template <class T, class M = rheo_default_memory_model>
 
3564
     class solver_basic : public smart_pointer<solver_rep<T,M> > {
 
3565
     public:
 
3566
     // allocator:
 
3567
 
 
3568
       explicit solver_basic       (const csr<T,M>& a, const solver_option_type& opt = solver_option_type());
 
3569
       void update_values (const csr<T,M>& a);
 
3570
 
 
3571
     // accessors:
 
3572
 
 
3573
       vec<T,M> trans_solve (const vec<T,M>& b) /* TODO const */;
 
3574
       vec<T,M> solve       (const vec<T,M>& b) /* TODO const */;
 
3575
 
 
3576
     // typedefs:
 
3577
 
 
3578
       typedef solver_rep<T,M>       rep;
 
3579
       typedef smart_pointer<rep> base;
 
3580
     };
 
3581
     typedef solver_basic<Float> solver;
 
3582
 
 
3583
 
 
3584
File: rheolef.info,  Node: array class,  Up: Classes
 
3585
 
 
3586
5.27 array - container in distributed environment
 
3587
=================================================
 
3588
 
 
3589
(Source file: `skit/plib2/array.h')
 
3590
 
 
3591
Synopsys
 
3592
--------
 
3593
 
 
3594
STL-like vector container for a distributed memory machine model.
 
3595
 
 
3596
Example
 
3597
-------
 
3598
 
 
3599
A sample usage of the class is:
 
3600
          int main(int argc, char**argv) {
 
3601
             environment distributed(argc, argv);
 
3602
             array<double> x(distributor(100), 3.14);
 
3603
             dout << x << endl;
 
3604
          }
 
3605
   The array<T> interface is similar to those of the std::vector<T>
 
3606
with the    addition of some communication features in the distributed
 
3607
case:    write accesses with entry/assembly and read access with dis_at.
 
3608
 
 
3609
Distributed write access
 
3610
------------------------
 
3611
 
 
3612
Loop on any `dis_i' that is not managed by the current processor:
 
3613
             x.dis_entry (dis_i) = value;
 
3614
   and then, after loop, perform all communication:
 
3615
             x.dis_entry_assembly();
 
3616
   After this command, each value is stored in the array, available the
 
3617
processor    associated to `dis_i'.
 
3618
 
 
3619
Distributed read access
 
3620
-----------------------
 
3621
 
 
3622
First, define the set of indexes:
 
3623
             std::set<size_t> ext_idx_set;
 
3624
   Then, loop on `dis_i' indexes that are not managed by the current
 
3625
processor:
 
3626
             ext_idx_set.insert (dis_i);
 
3627
   After the loop, performs the communications:
 
3628
             x.set_dis_indexes (ext_idx_set);
 
3629
   After this command, each values associated to the `dis_i' index,
 
3630
and that belongs to the index set, is now available also on the
 
3631
current processor as:
 
3632
             value = x.dis_at (dis_i);
 
3633
   For convenience, if `dis_i' is managed by the current processor, this
 
3634
  function returns also the value.
 
3635
 
 
3636
Note
 
3637
----
 
3638
 
 
3639
The class takes two template parameters: one for the type T and the
 
3640
second   for the memory model M, that could be either M=distributed or
 
3641
M=sequential.    The two cases are associated to two diferent
 
3642
implementations, but proposes   exactly the same interface. The
 
3643
sequential interface propose also a supplementary   constructor:
 
3644
             array<double,sequential> x(local_size, init_val);
 
3645
   This constructor is a STL-like one but could be consufused in the
 
3646
distributed case,    since there are two sizes: a local one and a
 
3647
global one. In that case, the use    of the distributor, as a
 
3648
generalization of the size concept, clarify the situation    (*note
 
3649
distributor class::).
 
3650
 
 
3651
Implementation note
 
3652
-------------------
 
3653
 
 
3654
"scatter" via "get_dis_entry".
 
3655
 
 
3656
"gather" via "dis_entry(dis_i) = value"   or "dis_entry(dis_i) +=
 
3657
value". Note that += applies when T=idx_set where   idx_set is a
 
3658
wrapper class of std::set<size_t> ; the += operator represents the
 
3659
union of a set. The operator= is used when T=double or others simple T
 
3660
types   without algebra. If there is a conflict, i.e. several processes
 
3661
set the dis_i   index, then the result of operator+= depends upon the
 
3662
order of the process at   each run and is not deterministic. Such
 
3663
ambiguous behavior is not detected   yet at run time.
 
3664
 
 
3665
Implementation
 
3666
--------------
 
3667
 
 
3668
     template <class T, class A>
 
3669
     class array<T,sequential,A> : public smart_pointer<array_seq_rep<T,A> > {
 
3670
     public:
 
3671
 
 
3672
     // typedefs:
 
3673
 
 
3674
         typedef array_seq_rep<T,A>            rep;
 
3675
         typedef smart_pointer<rep>            base;
 
3676
 
 
3677
         typedef sequential                    memory_type;
 
3678
         typedef typename rep::size_type       size_type;
 
3679
         typedef typename rep::value_type      value_type;
 
3680
         typedef typename rep::reference       reference;
 
3681
         typedef typename rep::dis_reference   dis_reference;
 
3682
         typedef typename rep::iterator        iterator;
 
3683
         typedef typename rep::const_reference const_reference;
 
3684
         typedef typename rep::const_iterator  const_iterator;
 
3685
 
 
3686
     // allocators:
 
3687
 
 
3688
 
 
3689
         array       (size_type loc_size = 0,       const T& init_val = T(), const A& alloc = A());
 
3690
         void resize (size_type loc_size = 0,       const T& init_val = T());
 
3691
         array       (const distributor& ownership, const T& init_val = T(), const A& alloc = A());
 
3692
         void resize (const distributor& ownership, const T& init_val = T());
 
3693
 
 
3694
     // local accessors & modifiers:
 
3695
 
 
3696
         A get_allocator() const              { return base::data().get_allocator(); }
 
3697
         size_type     size () const          { return base::data().size(); }
 
3698
         size_type dis_size () const          { return base::data().dis_size(); }
 
3699
         const distributor& ownership() const { return base::data().ownership(); }
 
3700
         const communicator& comm() const     { return ownership().comm(); }
 
3701
 
 
3702
         reference       operator[] (size_type i)       { return base::data().operator[] (i); }
 
3703
         const_reference operator[] (size_type i) const { return base::data().operator[] (i); }
 
3704
 
 
3705
               iterator begin()       { return base::data().begin(); }
 
3706
         const_iterator begin() const { return base::data().begin(); }
 
3707
               iterator end()         { return base::data().end(); }
 
3708
         const_iterator end() const   { return base::data().end(); }
 
3709
 
 
3710
     // global modifiers (for compatibility with distributed interface):
 
3711
 
 
3712
         dis_reference dis_entry (size_type dis_i) { return base::data().dis_entry(dis_i); }
 
3713
         void dis_entry_assembly()                 {}
 
3714
         template<class SetOp>
 
3715
         void dis_entry_assembly(SetOp my_set_op)        {}
 
3716
         template<class SetOp>
 
3717
         void dis_entry_assembly_begin (SetOp my_set_op) {}
 
3718
         template<class SetOp>
 
3719
         void dis_entry_assembly_end (SetOp my_set_op)   {}
 
3720
 
 
3721
     // apply a partition:
 
3722
 
 
3723
         template<class RepSize>
 
3724
         void repartition (                               // old_numbering for *this
 
3725
             const RepSize&         partition,            // old_ownership
 
3726
             array<T,sequential,A>& new_array,            // new_ownership (created)
 
3727
             RepSize&               old_numbering,        // new_ownership
 
3728
             RepSize&               new_numbering) const  // old_ownership
 
3729
             { return base::data().repartition (partition, new_array, old_numbering, new_numbering); }
 
3730
 
 
3731
         template<class RepSize>
 
3732
         void permutation_apply (                       // old_numbering for *this
 
3733
             const RepSize&          new_numbering,     // old_ownership
 
3734
             array<T,sequential,A>&  new_array) const   // new_ownership (already allocated)
 
3735
             { return base::data().permutation_apply (new_numbering, new_array); }
 
3736
 
 
3737
     // i/o:
 
3738
 
 
3739
         odiststream& put_values (odiststream& ops) const { return base::data().put_values(ops); }
 
3740
         idiststream& get_values (idiststream& ips)       { return base::data().get_values(ips); }
 
3741
         template <class GetFunction>
 
3742
         idiststream& get_values (idiststream& ips, GetFunction get_element)       { return base::data().get_values(ips, get_element); }
 
3743
         template <class PutFunction>
 
3744
         odiststream& put_values (odiststream& ops, PutFunction put_element) const { return base::data().put_values(ops, put_element); }
 
3745
         void dump (std::string name) const { return base::data().dump(name); }
 
3746
     };
 
3747
 
 
3748
Implementation
 
3749
--------------
 
3750
 
 
3751
     template <class T, class A>
 
3752
     class array<T,distributed,A> : public smart_pointer<array_mpi_rep<T,A> > {
 
3753
     public:
 
3754
 
 
3755
     // typedefs:
 
3756
 
 
3757
         typedef array_mpi_rep<T,A>            rep;
 
3758
         typedef smart_pointer<rep>            base;
 
3759
 
 
3760
         typedef distributed                   memory_type;
 
3761
         typedef typename rep::size_type       size_type;
 
3762
         typedef typename rep::value_type      value_type;
 
3763
         typedef typename rep::reference       reference;
 
3764
         typedef typename rep::dis_reference   dis_reference;
 
3765
         typedef typename rep::iterator        iterator;
 
3766
         typedef typename rep::const_reference const_reference;
 
3767
         typedef typename rep::const_iterator  const_iterator;
 
3768
         typedef typename rep::scatter_map_type scatter_map_type;
 
3769
 
 
3770
     // allocators:
 
3771
 
 
3772
         array       (const distributor& ownership = distributor(), const T& init_val = T(), const A& alloc = A());
 
3773
         void resize (const distributor& ownership = distributor(), const T& init_val = T());
 
3774
 
 
3775
     // local accessors & modifiers:
 
3776
 
 
3777
         A get_allocator() const              { return base::data().get_allocator(); }
 
3778
         size_type     size () const          { return base::data().size(); }
 
3779
         size_type dis_size () const          { return base::data().dis_size(); }
 
3780
         const distributor& ownership() const { return base::data().ownership(); }
 
3781
         const communicator& comm() const     { return base::data().comm(); }
 
3782
 
 
3783
         reference       operator[] (size_type i)       { return base::data().operator[] (i); }
 
3784
         const_reference operator[] (size_type i) const { return base::data().operator[] (i); }
 
3785
 
 
3786
               iterator begin()       { return base::data().begin(); }
 
3787
         const_iterator begin() const { return base::data().begin(); }
 
3788
               iterator end()         { return base::data().end(); }
 
3789
         const_iterator end() const   { return base::data().end(); }
 
3790
 
 
3791
     // global accessor:
 
3792
 
 
3793
         template<class Set, class Map>
 
3794
         void append_dis_entry (const Set& ext_idx_set, Map& ext_idx_map) const { base::data().append_dis_entry (ext_idx_set, ext_idx_map); }
 
3795
 
 
3796
         template<class Set, class Map>
 
3797
         void get_dis_entry    (const Set& ext_idx_set, Map& ext_idx_map) const { base::data().get_dis_entry (ext_idx_set, ext_idx_map); }
 
3798
 
 
3799
         template<class Set>
 
3800
         void append_dis_indexes (const Set& ext_idx_set)  { base::data().append_dis_indexes (ext_idx_set); }
 
3801
 
 
3802
         template<class Set>
 
3803
         void set_dis_indexes    (const Set& ext_idx_set)  { base::data().set_dis_indexes (ext_idx_set); }
 
3804
 
 
3805
         const T& dis_at (size_type dis_i) const { return base::data().dis_at (dis_i); }
 
3806
 
 
3807
         // get all external pairs (dis_i, values):
 
3808
         const scatter_map_type& get_dis_map_entries() const { return base::data().get_dis_map_entries(); }
 
3809
 
 
3810
     // global modifiers (for compatibility with distributed interface):
 
3811
 
 
3812
         dis_reference dis_entry (size_type dis_i)       { return base::data().dis_entry(dis_i); }
 
3813
 
 
3814
         void dis_entry_assembly()                       { return base::data().dis_entry_assembly(); }
 
3815
 
 
3816
         template<class SetOp>
 
3817
         void dis_entry_assembly       (SetOp my_set_op) { return base::data().dis_entry_assembly       (my_set_op); }
 
3818
         template<class SetOp>
 
3819
         void dis_entry_assembly_begin (SetOp my_set_op) { return base::data().dis_entry_assembly_begin (my_set_op); }
 
3820
         template<class SetOp>
 
3821
         void dis_entry_assembly_end   (SetOp my_set_op) { return base::data().dis_entry_assembly_end   (my_set_op); }
 
3822
 
 
3823
     // apply a partition:
 
3824
 
 
3825
         template<class RepSize>
 
3826
         void repartition (                              // old_numbering for *this
 
3827
             const RepSize&        partition,            // old_ownership
 
3828
             array<T,distributed>& new_array,            // new_ownership (created)
 
3829
             RepSize&              old_numbering,        // new_ownership
 
3830
             RepSize&              new_numbering) const  // old_ownership
 
3831
             { return base::data().repartition (partition.data(), new_array.data(), old_numbering.data(), new_numbering.data()); }
 
3832
 
 
3833
         template<class RepSize>
 
3834
         void permutation_apply (                       // old_numbering for *this
 
3835
             const RepSize&          new_numbering,     // old_ownership
 
3836
             array<T,distributed,A>& new_array) const   // new_ownership (already allocated)
 
3837
             { base::data().permutation_apply (new_numbering.data(), new_array.data()); }
 
3838
 
 
3839
         void reverse_permutation (                                 // old_ownership for *this=iold2dis_inew
 
3840
             array<size_type,distributed,A>& inew2dis_iold) const   // new_ownership
 
3841
             { base::data().reverse_permutation (inew2dis_iold.data()); }
 
3842
 
 
3843
     // i/o:
 
3844
 
 
3845
         odiststream& put_values (odiststream& ops) const { return base::data().put_values(ops); }
 
3846
         idiststream& get_values (idiststream& ips)       { return base::data().get_values(ips); }
 
3847
         void dump (std::string name) const      { return base::data().dump(name); }
 
3848
 
 
3849
         template <class GetFunction>
 
3850
         idiststream& get_values (idiststream& ips, GetFunction get_element)       { return base::data().get_values(ips, get_element); }
 
3851
         template <class PutFunction>
 
3852
         odiststream& put_values (odiststream& ops, PutFunction put_element) const { return base::data().put_values(ops, put_element); }
 
3853
         template <class PutFunction, class A2> odiststream& permuted_put_values (
 
3854
                     odiststream& ops, const array<size_type,distributed,A2>& perm, PutFunction put_element) const
 
3855
                                                                          { return base::data().permuted_put_values (ops, perm.data(), put_element); }
 
3856
     };
 
3857
 
 
3858
 
 
3859
File: rheolef.info,  Node: vec class,  Up: Classes
 
3860
 
 
3861
5.28 vec - vector in distributed environment
 
3862
============================================
 
3863
 
 
3864
(Source file: `skit/plib2/vec.h')
 
3865
 
 
3866
Synopsys
 
3867
--------
 
3868
 
 
3869
STL-like vector container for a sequential or  distributed memory
 
3870
machine model.   Additional operation fom classical algebra.
 
3871
 
 
3872
Example
 
3873
-------
 
3874
 
 
3875
A sample usage of the class is:
 
3876
          int main(int argc, char**argv) {
 
3877
             environment distributed(argc, argv);
 
3878
             vec<double> x(100, 3.14);
 
3879
             dout << x << endl;
 
3880
          }
 
3881
 
 
3882
Implementation note
 
3883
-------------------
 
3884
 
 
3885
Implementation use array<T,M>.
 
3886
 
 
3887
Implementation
 
3888
--------------
 
3889
 
 
3890
     template <class T, class M = rheo_default_memory_model>
 
3891
     class vec : public array<T, M> {
 
3892
     public:
 
3893
 
 
3894
     // typedef:
 
3895
 
 
3896
         typedef array<T, M> base;
 
3897
         typedef typename base::size_type       size_type;
 
3898
         typedef typename base::iterator        iterator;
 
3899
         typedef typename base::const_iterator  const_iterator;
 
3900
 
 
3901
     // allocator/deallocator:
 
3902
 
 
3903
         vec (const distributor& ownership,
 
3904
             const T&  init_val = std::numeric_limits<T>::max());
 
3905
 
 
3906
         vec(size_type dis_size = 0,
 
3907
             const T&  init_val = std::numeric_limits<T>::max());
 
3908
 
 
3909
         void resize (
 
3910
             const distributor& ownership,
 
3911
             const T&  init_val = std::numeric_limits<T>::max());
 
3912
 
 
3913
         void resize (
 
3914
             size_type size = 0,
 
3915
             const T&  init_val = std::numeric_limits<T>::max());
 
3916
 
 
3917
     // expression template:
 
3918
 
 
3919
         template<typename Expr>
 
3920
         vec (const Expr& expr);
 
3921
 
 
3922
         template<typename Expr>
 
3923
         vec<T,M>& operator= (const Expr& expr);
 
3924
 
 
3925
         template<typename Expr>
 
3926
         vec<T,M>& operator+= (const Expr& expr);
 
3927
 
 
3928
         template<typename Expr>
 
3929
         vec<T,M>& operator-= (const Expr& expr);
 
3930
     };
 
3931
 
 
3932
 
 
3933
File: rheolef.info,  Node: msg_local_optimize class,  Up: Classes
 
3934
 
 
3935
5.29 msg_local_optimize - local scatter optimize
 
3936
================================================
 
3937
 
 
3938
(Source file: `skit/plib2/msg_local_optimize.h')
 
3939
 
 
3940
Description
 
3941
-----------
 
3942
 
 
3943
Optimize local exchanges during gatter/scatter.
 
3944
 
 
3945
Algorithm
 
3946
---------
 
3947
 
 
3948
msg_local_optimize
 
3949
 
 
3950
"input": the send and receive local contexts (to, from)   |
 
3951
to_loc_idx(0:n_local-1), from_loc_idy(0:n_local-1)   "output": the
 
3952
boolean, true when optimization is possible   |   has_opt   begin   |
 
3953
 if n_local = 0 then   |       has_opt := false   |     else   |
 
3954
to_start   := to_loc_idx(0)   |       from_start := from_loc_idy(0)   |
 
3955
     has_opt := true   |       i := 1   |       while i < n_local and
 
3956
has_opt do   |         to_start   := to_start + 1   |
 
3957
from_start := from_start + 1   |         if to_loc_idx(i)   <> to_start
 
3958
 |         or from_loc_idy(i) <> from_start then   |           has_opt
 
3959
:= false   |         endif   |         i := i + 1   |       endwhile
 
3960
|     endif   end
 
3961
 
 
3962
Complexity
 
3963
----------
 
3964
 
 
3965
Memory and time complexity is O(receive_total_size).
 
3966
 
 
3967
Implementation
 
3968
--------------
 
3969
 
 
3970
     template <
 
3971
         class InputIterator1,
 
3972
         class InputIterator2>
 
3973
     bool
 
3974
     msg_local_optimize (
 
3975
         InputIterator1              to_loc_idx,     // n_local
 
3976
         InputIterator1              last_to_loc_idx,
 
3977
         InputIterator2              from_loc_idy)   // n_local
 
3978
     {
 
3979
         typedef typename std::iterator_traits<InputIterator1>::value_type Size;
 
3980
         if (to_loc_idx == last_to_loc_idx) {
 
3981
             return false;
 
3982
         }
 
3983
         Size to_start   = *to_loc_idx++;
 
3984
         Size from_start = *from_loc_idy++;
 
3985
         bool has_opt = true;
 
3986
         while (to_loc_idx != last_to_loc_idx && has_opt) {
 
3987
             to_start++;
 
3988
             from_start++;
 
3989
             if ((*to_loc_idx++)   != to_start ||
 
3990
                 (*from_loc_idy++) != from_start) {
 
3991
                 has_opt = false;
 
3992
             }
 
3993
         }
 
3994
         return has_opt;
 
3995
     }
 
3996
 
 
3997
 
 
3998
File: rheolef.info,  Node: msg_to_context class,  Up: Classes
 
3999
 
 
4000
5.30 msg_to_context - receive pattern
 
4001
=====================================
 
4002
 
 
4003
(Source file: `skit/plib2/msg_to_context.h')
 
4004
 
 
4005
Description
 
4006
-----------
 
4007
 
 
4008
Computes the receive compresed message pattern for gather   and scatter.
 
4009
 The local message part is computed by a separate algorithm   (see
 
4010
"msg_to_local_context"(5)).
 
4011
 
 
4012
Algorithm
 
4013
---------
 
4014
 
 
4015
msg_to_context
 
4016
 
 
4017
"input": the receive pattern and the permutation   |
 
4018
perm(0:receive_nproc-1)   |   r_iproc(0:receive_nproc-1),
 
4019
r_size(0:receive_nproc-1),   |
 
4020
r_idx(0:receive_nproc*receive_max_size-1)   "output": the receive
 
4021
context (to)   |   to_proc(0:receive_nproc-1), to_ptr(0:receive_nproc),
 
4022
 |   to_idx(0:receive_total_size-1)   begin   |     to_ptr(0) := 0   |
 
4023
  for j := 0 to receive_nproc-1 do   |       j1 := perm(j)   |
 
4024
to_proc(j) := r_iproc(j1)   |       to_ptr(j+1) := r_ptr(j) + rsize(j1)
 
4025
 |       for q := to_ptr(j) to to_tr(j+1)-1 do   |         to_idx(q) :=
 
4026
r_idx(j1, q-to_ptr(j)) - istart   |       endfor   |     endfor   end
 
4027
 
 
4028
Complexity
 
4029
----------
 
4030
 
 
4031
Memory and time complexity is O(receive_total_size).
 
4032
 
 
4033
Implementation
 
4034
--------------
 
4035
 
 
4036
     template <
 
4037
         class InputIterator1,
 
4038
         class InputRandomIterator2,
 
4039
         class InputRandomIterator3,
 
4040
         class InputRandomIterator4,
 
4041
         class Size,
 
4042
         class OutputIterator1,
 
4043
         class OutputIterator2,
 
4044
         class OutputIterator3>
 
4045
     void
 
4046
     msg_to_context (
 
4047
         InputIterator1              perm,           // receive_nproc
 
4048
         InputIterator1              last_perm,
 
4049
         InputRandomIterator2        r_iproc,        // receive_nproc
 
4050
         InputRandomIterator3        r_size,         // receive_nproc
 
4051
         InputRandomIterator4        r_idx,          // receive_nproc*receive_max_size
 
4052
         Size                        receive_max_size,
 
4053
         Size                        istart,
 
4054
         OutputIterator1             to_proc,        // receive_nproc
 
4055
         OutputIterator2             to_ptr,         // receive_nproc+1
 
4056
         OutputIterator3             to_idx)         // receive_total_size
 
4057
     {
 
4058
         OutputIterator2 prec_ptr = to_ptr;
 
4059
         (*to_ptr++) = 0;
 
4060
         while (perm != last_perm) {
 
4061
             Size j1 = (*perm++);
 
4062
             (*to_proc++) = r_iproc[j1];
 
4063
             Size size = r_size[j1];
 
4064
             (*to_ptr++) = (*prec_ptr++) + size;
 
4065
             InputRandomIterator4 iter_idx = r_idx + j1*receive_max_size;
 
4066
             InputRandomIterator4 last_idx = iter_idx + size;
 
4067
             while (iter_idx != last_idx)
 
4068
                 (*to_idx++) = (*iter_idx++) - istart;
 
4069
         }
 
4070
     }
 
4071
 
 
4072
 
 
4073
File: rheolef.info,  Node: asr class,  Up: Classes
 
4074
 
 
4075
5.31 asr - associative sparse matrix
 
4076
====================================
 
4077
 
 
4078
(Source file: `skit/plib2/asr.h')
 
4079
 
 
4080
Synopsys
 
4081
--------
 
4082
 
 
4083
Associative sparse matrix container stored row by row  using the STL
 
4084
map class.
 
4085
 
 
4086
Implementation note
 
4087
-------------------
 
4088
 
 
4089
Implementation use MPI-1.1    and is inspired from Mat_MPI in
 
4090
PETSc-2.0.22.
 
4091
 
 
4092
To do
 
4093
-----
 
4094
 
 
4095
For efficiency purpose, the assembly phase may    access directly to
 
4096
the asr representation, without    crossing the reference counting and
 
4097
pointer handler.     Something like the iterator for dense vectors.
 
4098
 
 
4099
Implementation
 
4100
--------------
 
4101
 
 
4102
     template<class R>
 
4103
     class basic_asr : public smart_pointer<R> {
 
4104
     public:
 
4105
 
 
4106
     // typedefs:
 
4107
 
 
4108
         typedef typename R::size_type          size_type;
 
4109
         typedef typename R::element_type       element_type;
 
4110
         typedef typename R::memory_type        memory_type;
 
4111
         typedef distributor::communicator_type communicator_type;
 
4112
 
 
4113
     // allocators/deallocators:
 
4114
 
 
4115
         basic_asr (size_type dis_nrow = 0, size_type dis_ncol = 0);
 
4116
         basic_asr (const distributor& row_ownership, const distributor& col_ownership);
 
4117
         explicit basic_asr (const csr<element_type,memory_type>&);
 
4118
 
 
4119
     // accessors:
 
4120
 
 
4121
         const communicator_type& comm() const;
 
4122
 
 
4123
         // local sizes
 
4124
         size_type nrow () const;
 
4125
         size_type ncol () const;
 
4126
         size_type nnz () const;
 
4127
 
 
4128
         // global sizes
 
4129
         size_type dis_nrow () const;
 
4130
         size_type dis_ncol () const;
 
4131
         size_type dis_nnz () const;
 
4132
         const distributor& row_ownership() const;
 
4133
         const distributor& col_ownership() const;
 
4134
 
 
4135
         // range on local memory
 
4136
         size_type row_first_index () const;
 
4137
         size_type row_last_index () const;
 
4138
         size_type col_first_index () const;
 
4139
         size_type col_last_index () const;
 
4140
 
 
4141
     // global modifiers:
 
4142
 
 
4143
         element_type& dis_entry (size_type dis_i, size_type dis_j);
 
4144
         void dis_entry_assembly();
 
4145
         void dis_entry_assembly_begin ();
 
4146
         void dis_entry_assembly_end ();
 
4147
         void resize (size_type dis_nrow = 0, size_type dis_ncol = 0);
 
4148
 
 
4149
     // output:
 
4150
 
 
4151
         void dump (const std::string& name) const;
 
4152
     };
 
4153
     template <class T, class M = rheo_default_memory_model>
 
4154
     class asr
 
4155
     {
 
4156
         typedef M memory_type;
 
4157
     };
 
4158
     template <class T>
 
4159
     class asr<T,sequential> : public basic_asr<asr_seq_rep<T> > {
 
4160
     public:
 
4161
         typedef typename basic_asr<asr_seq_rep<T> >::size_type size_type;
 
4162
         typedef sequential memory_type;
 
4163
         asr (size_type dis_nrow = 0, size_type dis_ncol = 0);
 
4164
         asr (const distributor& row_ownership, const distributor& col_ownertship);
 
4165
         explicit asr(const csr<T,memory_type>&);
 
4166
     };
 
4167
     #ifdef _RHEOLEF_HAVE_MPI
 
4168
     template <class T>
 
4169
     class asr<T,distributed> : public basic_asr<asr_mpi_rep<T> > {
 
4170
     public:
 
4171
         typedef distributed memory_type;
 
4172
         typedef typename basic_asr<asr_mpi_rep<T> >::size_type size_type;
 
4173
         asr (size_type dis_nrow = 0, size_type dis_ncol = 0);
 
4174
         asr (const distributor& row_ownership, const distributor& col_ownertship);
 
4175
         explicit asr(const csr<T,memory_type>&);
 
4176
     };
 
4177
     #endif // _RHEOLEF_HAVE_MPI
 
4178
 
 
4179
     // inputs/outputs:
 
4180
     template <class T, class M>
 
4181
     idiststream& operator >> (idiststream& s, asr<T,M>& x);
 
4182
 
 
4183
     template <class T, class M>
 
4184
     odiststream& operator << (odiststream& s, const asr<T,M>& x);
4146
4185
 
4147
4186
 
4148
4187
File: rheolef.info,  Node: csr class,  Up: Classes
4149
4188
 
4150
 
5.18 `csr' - compressed sparse row matrix format
4151
 
================================================
4152
 
 
4153
 
(Source file: `skit/lib/csr.h') 
4154
 
 
4155
 
Description
4156
 
-----------
4157
 
 
4158
 
The class implements a matrix in compressed sparse row format.   A
4159
 
declaration whithout any parametrers correspond to a matrix with null
4160
 
size:
4161
 
             csr<double> a;
4162
 
 Notes that the constructor can be invocated with an initializer:
4163
 
             csr<double> a = b;
4164
 
 
4165
 
Input and output, as usual  (*note iorheo class::):
4166
 
             cin  >> a;
4167
 
             cout << a;
4168
 
 
4169
 
Default is the Harwell-Boeing format.   Various others formated options
4170
 
are available:  matlab and postscript plots.
4171
 
 
4172
 
Affectation from a scalar
4173
 
             a = 3.14;
4174
 
 
4175
 
The matrix/vector multiply:
4176
 
             a*x
4177
 
 and the transposed matrix/ vector multiply:
4178
 
             a.trans_mult(x);
4179
 
 
4180
 
The binary operators are:
4181
 
             a*b, a+b, a-b, lambda*a, a*lambda, a/lambda
4182
 
 The unary operators are sign inversion and transposition:
4183
 
             -a, trans(a);
4184
 
  The combination with a diagonal matrix  is not yet completely
4185
 
available.   The interface would be something like:
4186
 
             basic_diag<double> d;
4187
 
             a+d, d+a, a-d, d-a
4188
 
             a*d, d*a,
4189
 
             a/d             // aij/djj
4190
 
             left_div(a,d)   // aij/dii
4191
 
  When applied to the matrix directly:  this feature is not yet
4192
 
completely available.   The interface would be something like:
4193
 
             a += d;         // a := a+d
4194
 
             a -= d;         // a := a-d
4195
 
             a *= d;         // a := a*d
4196
 
             a.left_mult(d); // a := d*a
4197
 
             a /= d;         // aij := aij/djj
4198
 
             a.left_div(d);  // aij := aij/dii
4199
 
  The combination with a constant-identity matrix:  this feature is not
4200
 
yet completely available.   The interface would be something like:
4201
 
             double k;
4202
 
             a + k*EYE, k*EYE + a, a - k*EYE, k*EYE - a,
4203
 
 
4204
 
             a += e;
4205
 
             a -= e;
4206
 
 Get the lower triangular part:
4207
 
             csr<double> l = tril(a);
4208
 
 Conversely, `triu' get the upper triangular part.
4209
 
 
4210
 
For optimizing the profile storage, I could be convenient to  use a
4211
 
renumbering algorithm  (see also *note ssk class:: and *note
4212
 
permutation class::).
4213
 
             permutation p = gibbs(a);
4214
 
             csr<double> b = perm(a, p, q); // B := P*A*trans(Q)
4215
 
 Horizontal matrix concatenation:
4216
 
             a = hcat(a11,a12);
4217
 
 Vertical matrix concatenation:
4218
 
             a = vcat(a11,a21);
4219
 
 Explicit conversion from an associative `asr e' matrix writes:
4220
 
             a = csr<double>(e);
4221
 
 from a dense `dns m' matrix writes:
4222
 
             a = csr<double>(m);
4223
 
 
4224
 
 
4225
 
Note
4226
 
----
4227
 
 
4228
 
The `csr' class is currently under reconstruction   for the distributed
4229
 
memory support by using a MPI-based   implementation.
4230
 
 
4231
 
 
4232
 
File: rheolef.info,  Node: diag class,  Up: Classes
4233
 
 
4234
 
5.19 `basic_diag' - diagonal matrix
4235
 
===================================
4236
 
 
4237
 
(Source file: `skit/lib/diag.h') 
4238
 
 
4239
 
Description
4240
 
-----------
4241
 
 
4242
 
The class implements a diagonal matrix.   A declaration whithout any
4243
 
parametrers correspond to a null size matrix:
4244
 
             basic_diag<Float> d;
4245
 
 The constructor can be invocated whith a size parameter:
4246
 
             basic_diag<Float> d(n);
4247
 
 or an initialiser, either a vector (*note vec class::):
4248
 
             basic_diag<Float> d = basic_diag(v);
4249
 
 or a csr matrix *note csr class:::
4250
 
             basic_diag<Float> d = basic_diag(a);
4251
 
 The conversion from `basic_diag' to  `vec' or `csr' is explicit.
4252
 
 
4253
 
When a diagonal matrix is constructed from a `csr' matrix,  the
4254
 
definition of the diagonal of matrix is _always_ a vector of size  NROW
4255
 
which contains the elements in rows 1 to NROW of  the matrix that are
4256
 
contained in the diagonal.   If the diagonal element falls outside the
4257
 
matrix,  i.e. NCOL < NROW then it is  defined as a zero entry.
4258
 
 
4259
 
Note
4260
 
----
4261
 
 
4262
 
Since the `basic_diag' class derives from the  `vec',  the `basic_diag'
4263
 
class  present also a STL-like interface.
4264
 
 
4265
 
Implementation
4266
 
--------------
4267
 
 
4268
 
     template<class T>
4269
 
     class basic_diag : public vec<T> {
4270
 
     public:
4271
 
 
4272
 
     // typedefs:
4273
 
 
4274
 
         typedef typename vec<T>::element_type element_type;
4275
 
         typedef typename vec<T>::size_type    size_type;
4276
 
         typedef typename vec<T>::iterator     iterator;
4277
 
 
4278
 
     // allocators/deallocators:
4279
 
 
4280
 
         explicit basic_diag (size_type sz = 0);
4281
 
         explicit basic_diag (const vec<T>& u);
4282
 
         explicit basic_diag (const csr<T>& a);
4283
 
 
4284
 
     // assignment:
4285
 
 
4286
 
         basic_diag<T> operator = (const T& lambda);
4287
 
 
4288
 
     // accessors:
4289
 
 
4290
 
         size_type nrow () const { return vec<T>::size(); }
4291
 
         size_type ncol () const { return vec<T>::size(); }
4292
 
 
4293
 
     // basic_diag as a preconditionner: solves D.x=b
4294
 
 
4295
 
         vec<T> solve (const vec<T>& b) const;
4296
 
         vec<T> trans_solve (const vec<T>& b) const;
4297
 
     };
4298
 
     template <class T>
4299
 
     basic_diag<T> dcat (const basic_diag<T>& a1, const basic_diag<T>& a2);
4300
 
 
4301
 
     template <class T>
4302
 
     basic_diag<T> operator / (const T& lambda, const basic_diag<T>& d);
4303
 
 
4304
 
     template <class T>
4305
 
     vec<T>
4306
 
     operator * (const basic_diag<T>& d, const vec<T>& x);
4307
 
 
4308
 
     template<class T>
4309
 
     vec<T> left_div (const vec<T>& x, const basic_diag<T>& d);
 
4189
5.32 csr - compressed sparse row matrix
 
4190
=======================================
 
4191
 
 
4192
(Source file: `skit/plib2/csr.h')
 
4193
 
 
4194
Synopsys
 
4195
--------
 
4196
 
 
4197
Distributed compressed sparse matrix container stored row by row.
 
4198
 
 
4199
To do
 
4200
-----
 
4201
 
 
4202
For efficiency purpose, the assembly phase may    access directly to
 
4203
the csr representation, without    crossing the reference counting and
 
4204
pointer handler.     Something like the iterator for dense vectors.
 
4205
 
 
4206
Implementation
 
4207
--------------
 
4208
 
 
4209
     template<class T>
 
4210
     class csr<T,sequential> : public smart_pointer<csr_seq_rep<T> > {
 
4211
     public:
 
4212
 
 
4213
     // typedefs:
 
4214
 
 
4215
         typedef csr_seq_rep<T>                    rep;
 
4216
         typedef smart_pointer<rep>                base;
 
4217
         typedef typename rep::memory_type         memory_type;
 
4218
         typedef typename rep::size_type           size_type;
 
4219
         typedef typename rep::element_type        element_type;
 
4220
         typedef typename rep::iterator            iterator;
 
4221
         typedef typename rep::const_iterator      const_iterator;
 
4222
         typedef typename rep::const_data_iterator const_data_iterator;
 
4223
 
 
4224
     // allocators/deallocators:
 
4225
 
 
4226
         csr() : base(new_macro(rep())) {}
 
4227
         explicit csr(const asr<T,sequential>& a) : base(new_macro(rep(a.data()))) {}
 
4228
 
 
4229
     // accessors:
 
4230
 
 
4231
         // global sizes
 
4232
         const distributor& row_ownership() const { return base::data().row_ownership(); }
 
4233
         const distributor& col_ownership() const { return base::data().col_ownership(); }
 
4234
         size_type dis_nrow () const              { return row_ownership().dis_size(); }
 
4235
         size_type dis_ncol () const              { return col_ownership().dis_size(); }
 
4236
         size_type dis_nnz () const               { return base::data().nnz(); }
 
4237
         bool is_symmetric() const                { return base::data().is_symmetric(); }
 
4238
         void set_symmetry (bool is_symm)         { base::data().set_symmetry(is_symm); }
 
4239
         size_type pattern_dimension() const      { return base::data().pattern_dimension(); }
 
4240
         void set_pattern_dimension(size_type dim){ base::data().set_pattern_dimension(dim); }
 
4241
 
 
4242
         // local sizes
 
4243
         size_type nrow () const                  { return base::data().nrow(); }
 
4244
         size_type ncol () const                  { return base::data().ncol(); }
 
4245
         size_type nnz () const                   { return base::data().nnz(); }
 
4246
 
 
4247
         // range on local memory
 
4248
         size_type row_first_index () const       { return base::data().row_first_index(); }
 
4249
         size_type row_last_index () const        { return base::data().row_last_index(); }
 
4250
         size_type col_first_index () const       { return base::data().col_first_index(); }
 
4251
         size_type col_last_index () const        { return base::data().col_last_index(); }
 
4252
 
 
4253
         const_iterator begin() const             { return base::data().begin(); }
 
4254
         const_iterator end()   const             { return base::data().end(); }
 
4255
 
 
4256
     #ifdef TO_CLEAN
 
4257
         // accessors, only for distributed
 
4258
         size_type ext_nnz() const                { return base::data().ext_nnz(); }
 
4259
         const_iterator ext_begin() const         { return base::data().ext_begin(); }
 
4260
         const_iterator ext_end()   const         { return base::data().ext_end(); }
 
4261
         size_type jext2dis_j (size_type jext) const { return base::data().jext2dis_j(); }
 
4262
     #endif // TO_CLEAN
 
4263
 
 
4264
     // algebra:
 
4265
 
 
4266
         csr<T,sequential> operator+ (const csr<T,sequential>& b) const;
 
4267
         csr<T,sequential> operator- (const csr<T,sequential>& b) const;
 
4268
 
 
4269
         void mult (const vec<element_type,sequential>& x, vec<element_type,sequential>& y) const
 
4270
             { base::data().mult (x,y); }
 
4271
         vec<element_type,sequential> operator* (const vec<element_type,sequential>& x) const {
 
4272
               vec<element_type,sequential> y (row_ownership(), element_type());
 
4273
               mult (x, y);
 
4274
               return y;
 
4275
         }
 
4276
 
 
4277
     // output:
 
4278
 
 
4279
         void dump (const std::string& name) const { base::data().dump(name); }
 
4280
     };
 
4281
 
 
4282
Implementation
 
4283
--------------
 
4284
 
 
4285
     template<class T>
 
4286
     class csr<T,distributed> : public smart_pointer<csr_mpi_rep<T> > {
 
4287
     public:
 
4288
 
 
4289
     // typedefs:
 
4290
 
 
4291
         typedef csr_mpi_rep<T>                    rep;
 
4292
         typedef smart_pointer<rep>                base;
 
4293
         typedef typename rep::memory_type         memory_type;
 
4294
         typedef typename rep::size_type           size_type;
 
4295
         typedef typename rep::element_type        element_type;
 
4296
         typedef typename rep::iterator            iterator;
 
4297
         typedef typename rep::const_iterator      const_iterator;
 
4298
         typedef typename rep::const_data_iterator const_data_iterator;
 
4299
 
 
4300
     // allocators/deallocators:
 
4301
 
 
4302
         csr() : base(new_macro(rep())) {}
 
4303
         explicit csr(const asr<T,memory_type>& a) : base(new_macro(rep(a.data()))) {}
 
4304
 
 
4305
     // accessors:
 
4306
 
 
4307
         // global sizes
 
4308
         const distributor& row_ownership() const { return base::data().row_ownership(); }
 
4309
         const distributor& col_ownership() const { return base::data().col_ownership(); }
 
4310
         size_type dis_nrow () const              { return row_ownership().dis_size(); }
 
4311
         size_type dis_ncol () const              { return col_ownership().dis_size(); }
 
4312
         size_type dis_nnz () const               { return base::data().dis_nnz(); }
 
4313
         bool is_symmetric() const                { return base::data().is_symmetric(); }
 
4314
         void set_symmetry (bool is_symm)         { base::data().set_symmetry(is_symm); }
 
4315
         size_type pattern_dimension() const      { return base::data().pattern_dimension(); }
 
4316
         void set_pattern_dimension(size_type dim){ base::data().set_pattern_dimension(dim); }
 
4317
 
 
4318
         // local sizes
 
4319
         size_type nrow () const                  { return base::data().nrow(); }
 
4320
         size_type ncol () const                  { return base::data().ncol(); }
 
4321
         size_type nnz () const                   { return base::data().nnz(); }
 
4322
 
 
4323
         // range on local memory
 
4324
         size_type row_first_index () const       { return base::data().row_first_index(); }
 
4325
         size_type row_last_index () const        { return base::data().row_last_index(); }
 
4326
         size_type col_first_index () const       { return base::data().col_first_index(); }
 
4327
         size_type col_last_index () const        { return base::data().col_last_index(); }
 
4328
 
 
4329
         const_iterator begin() const             { return base::data().begin(); }
 
4330
         const_iterator end()   const             { return base::data().end(); }
 
4331
 
 
4332
         // accessors, only for distributed
 
4333
         size_type ext_nnz() const                { return base::data().ext_nnz(); }
 
4334
         const_iterator ext_begin() const         { return base::data().ext_begin(); }
 
4335
         const_iterator ext_end()   const         { return base::data().ext_end(); }
 
4336
         size_type jext2dis_j (size_type jext) const { return base::data().jext2dis_j(jext); }
 
4337
 
 
4338
     // algebra:
 
4339
 
 
4340
         csr<T,distributed> operator+ (const csr<T,distributed>& b) const;
 
4341
         csr<T,distributed> operator- (const csr<T,distributed>& b) const;
 
4342
 
 
4343
         void mult (const vec<element_type,distributed>& x, vec<element_type,distributed>& y) const
 
4344
             { base::data().mult (x,y); }
 
4345
         vec<element_type,distributed> operator* (const vec<element_type,distributed>& x) const {
 
4346
               vec<element_type,distributed> y (row_ownership(), element_type());
 
4347
               mult (x, y);
 
4348
               return y;
 
4349
         }
 
4350
 
 
4351
     // output:
 
4352
 
 
4353
         void dump (const std::string& name) const { base::data().dump(name); }
 
4354
     };
 
4355
 
 
4356
 
 
4357
File: rheolef.info,  Node: msg_from_context_pattern class,  Up: Classes
 
4358
 
 
4359
5.33 msg_from_context - gather
 
4360
==============================
 
4361
 
 
4362
(Source file: `skit/plib2/msg_from_context_pattern.h')
 
4363
 
 
4364
Description
 
4365
-----------
 
4366
 
 
4367
Computes the receive compressed message pattern for gather   and
 
4368
scatter.
 
4369
 
 
4370
Algorithm
 
4371
---------
 
4372
 
 
4373
msg_from_context_pattern
 
4374
 
 
4375
"input": the ownership distribution and the indexes arrays   |
 
4376
msg_size(0:nproc)   "output": the receive context (from) and an
 
4377
auxilliary array proc2from_proc   |   from_proc(0:send_nproc-1),
 
4378
from_ptr(0:send_nproc),   |   proc2from_proc(0:nproc-1)   begin   |
 
4379
i := 0   |     from_ptr(0) := 0   |     for iproc := 0 to nproc-1 do
 
4380
|       if msg_size(iproc) <> 0 then   |         from_proc(i) := iproc
 
4381
|         from_ptr(i+1) := from_ptr(i) + msg_size(i)   |
 
4382
proc2from_proc(iproc) := i   |         i := i+1   |       endif   |
 
4383
endfor   end
 
4384
 
 
4385
Note
 
4386
----
 
4387
 
 
4388
At the end of the algorithm, we have i = send_nproc.
 
4389
 
 
4390
Complexity
 
4391
----------
 
4392
 
 
4393
Complexity is O(nproc).
 
4394
 
 
4395
Implementation
 
4396
--------------
 
4397
 
 
4398
     template <
 
4399
         class InputIterator1,
 
4400
         class OutputIterator1,
 
4401
         class OutputIterator2,
 
4402
         class OutputIterator3>
 
4403
     void
 
4404
     msg_from_context_pattern (
 
4405
         InputIterator1              msg_size,               // nproc
 
4406
         InputIterator1              last_msg_size,
 
4407
         OutputIterator1             from_proc,              // send_nproc
 
4408
         OutputIterator2             from_ptr,               // send_nproc+1
 
4409
         OutputIterator3             proc2from_proc)         // nproc
 
4410
     {
 
4411
         typedef typename std::iterator_traits<InputIterator1>::value_type Size;
 
4412
         Size iproc = 0;
 
4413
         Size i = 0;
 
4414
         Size ptr_val = 0;
 
4415
         (*from_ptr++) = ptr_val;
 
4416
         while (msg_size != last_msg_size) {
 
4417
             Size sz = (*msg_size++);
 
4418
             if (sz != 0) {
 
4419
                 (*from_proc++) = iproc;
 
4420
                 ptr_val += sz;
 
4421
                 (*from_ptr++) = ptr_val;
 
4422
                 (*proc2from_proc) = i;
 
4423
                 i++;
 
4424
             }
 
4425
             proc2from_proc++;
 
4426
             iproc++;
 
4427
         }
 
4428
     }
 
4429
 
 
4430
 
 
4431
File: rheolef.info,  Node: msg_local_context class,  Up: Classes
 
4432
 
 
4433
5.34 msg_local_context - receive pattern
 
4434
========================================
 
4435
 
 
4436
(Source file: `skit/plib2/msg_local_context.h')
 
4437
 
 
4438
Description
 
4439
-----------
 
4440
 
 
4441
Computes the receive compresed message local pattern,   i.e. the only
 
4442
part that does not requires communication.    (see "msg_to_context"(5)).
 
4443
 
 
4444
Algorithm
 
4445
---------
 
4446
 
 
4447
msg_local_context
 
4448
 
 
4449
"input": the index sets and the local processor index range   |
 
4450
idx(0:nidx-1), idy(0:nidx-1), istart, ilast   "output": the send and
 
4451
receive local contexts (to, from)   |   to_loc_idx(0:n_local-1),
 
4452
from_loc_idy(0:n_local-1)   begin   |     if n_local <> 0 then   |
 
4453
iloc := 0   |       for k := 0 to nidx-1 do   |         if idy(k) in
 
4454
(istart, ilast( then   |           to_loc_idx(iloc)   := idy(k) - istart
 
4455
 |           from_loc_idy(iloc) := idy(k)   |           iloc := iloc + 1
 
4456
 |         endif   |       endfor   |     endif   end
 
4457
 
 
4458
Complexity
 
4459
----------
 
4460
 
 
4461
Memory and time complexity is O(receive_total_size).
 
4462
 
 
4463
Implementation
 
4464
--------------
 
4465
 
 
4466
     template <
 
4467
         class InputIterator1,
 
4468
         class InputIterator2,
 
4469
         class Size,
 
4470
         class OutputIterator1,
 
4471
         class OutputIterator2>
 
4472
     void
 
4473
     msg_local_context (
 
4474
         InputIterator1              idx,            // nidx
 
4475
         InputIterator1              last_idx,
 
4476
         InputIterator2              idy,            // nidx
 
4477
         Size                        idy_maxval,
 
4478
         Size                        istart,
 
4479
         Size                        ilast,
 
4480
         OutputIterator1             to_loc_idx,             // n_local
 
4481
         OutputIterator1             last_to_loc_idx,
 
4482
         OutputIterator2             from_loc_idy)           // n_local
 
4483
     {
 
4484
         if (to_loc_idx == last_to_loc_idx) {
 
4485
             return;
 
4486
         }
 
4487
         while (idx != last_idx) {
 
4488
             Size idx_i = *idx;
 
4489
             if (idx_i >= istart && idx_i < ilast) {
 
4490
                 Size idy_i = *idy;
 
4491
                 assert_macro (idy_i < idy_maxval, "Scattering past end of TO vector");
 
4492
                 (*to_loc_idx++)   = idx_i - istart;
 
4493
                 (*from_loc_idy++) = idy_i;
 
4494
             }
 
4495
             ++idx;
 
4496
             ++idy;
 
4497
         }
 
4498
     }
 
4499
 
 
4500
 
 
4501
File: rheolef.info,  Node: mpi_scatter_init class,  Up: Classes
 
4502
 
 
4503
5.35 mpi_scatter_init - gather/scatter initialize
 
4504
=================================================
 
4505
 
 
4506
(Source file: `skit/plib2/mpi_scatter_init.h')
 
4507
 
 
4508
Description
 
4509
-----------
 
4510
 
 
4511
Initialize communication   for distributed to sequential scatter
 
4512
context.
 
4513
 
 
4514
Complexity
 
4515
----------
 
4516
 
 
4517
Time and memory complexity is O(nidx+nproc).    For finite-element
 
4518
problems in d dimenion
 
4519
 
 
4520
|   nidx ~ N^((d-1)/d)
 
4521
 
 
4522
where N is the number of degrees of freedom.
 
4523
 
 
4524
IMPLEMENTATION   Inspirated from petsc-2.0/vpscat.c:
 
4525
VecScatterCreate_PtoS()
 
4526
 
 
4527
Implementation
 
4528
--------------
 
4529
 
 
4530
     template <class Message, class Size, class SizeRandomIterator1, class SizeRandomIterator2, class Tag>
 
4531
     void
 
4532
     mpi_scatter_init (
 
4533
     // input:
 
4534
         Size                nidx,
 
4535
         SizeRandomIterator1 idx,
 
4536
         Size                nidy,
 
4537
         SizeRandomIterator1 idy,
 
4538
         Size                idy_maxval,
 
4539
         SizeRandomIterator2 ownership,
 
4540
         Tag                 tag,
 
4541
         const distributor::communicator_type& comm,
 
4542
     // output:
 
4543
         Message&    from,
 
4544
         Message&    to)
 
4545
     {
 
4546
         typedef Size size_type;
 
4547
         size_type  my_proc = comm.rank();
 
4548
         size_type  nproc   = comm.size();
 
4549
 
 
4550
         // -------------------------------------------------------
 
4551
         // 1) first count number of contributors to each processor
 
4552
         // -------------------------------------------------------
 
4553
         std::vector<size_type> msg_size(nproc, 0);
 
4554
         std::vector<size_type> msg_mark(nproc, 0);
 
4555
         std::vector<size_type> owner   (nidx);
 
4556
         size_type send_nproc = 0;
 
4557
         {
 
4558
           size_type iproc = 0;
 
4559
           for (size_type i = 0; i < nidx; i++) {
 
4560
             for (; iproc < nproc; iproc++) {
 
4561
               if (idx[i] >= ownership[iproc] && idx[i] < ownership[iproc+1]) {
 
4562
                 owner[i] = iproc;
 
4563
                 msg_size [iproc]++;
 
4564
                 if (!msg_mark[iproc]) {
 
4565
                    msg_mark[iproc] = 1;
 
4566
                    send_nproc++;
 
4567
                 }
 
4568
                 break;
 
4569
               }
 
4570
             }
 
4571
             check_macro (iproc != nproc, "bad stash data: idx["<<i<<"]="<<idx[i]<<" out of range [0:"<<ownership[nproc]<<"[");
 
4572
           }
 
4573
         } // end block
 
4574
         // -------------------------------------------------------
 
4575
         // 2) avoid to send message to my-proc in counting
 
4576
         // -------------------------------------------------------
 
4577
         size_type n_local  = msg_size[my_proc];
 
4578
         if (n_local != 0) {
 
4579
             msg_size [my_proc] = 0;
 
4580
             msg_mark [my_proc] = 0;
 
4581
             send_nproc--;
 
4582
         }
 
4583
         // ----------------------------------------------------------------
 
4584
         // 3) compute number of messages to be send to my_proc
 
4585
         // ----------------------------------------------------------------
 
4586
         std::vector<size_type> work(nproc);
 
4587
         mpi::all_reduce (
 
4588
             comm,
 
4589
             msg_mark.begin().operator->(),
 
4590
             nproc,
 
4591
             work.begin().operator->(),
 
4592
             std::plus<size_type>());
 
4593
         size_type receive_nproc = work [my_proc];
 
4594
         // ----------------------------------------------------------------
 
4595
         // 4) compute messages max size to be send to my_proc
 
4596
         // ----------------------------------------------------------------
 
4597
         mpi::all_reduce (
 
4598
             comm,
 
4599
             msg_size.begin().operator->(),
 
4600
             nproc,
 
4601
             work.begin().operator->(),
 
4602
             mpi::maximum<size_type>());
 
4603
         size_type receive_max_size = work [my_proc];
 
4604
         // ----------------------------------------------------------------
 
4605
         // 5) post receive: exchange the buffer adresses between processes
 
4606
         // ----------------------------------------------------------------
 
4607
         std::list<std::pair<size_type,mpi::request> >   receive_waits;
 
4608
         std::vector<size_type>                          receive_data (receive_nproc*receive_max_size);
 
4609
         for (size_type i_receive = 0; i_receive < receive_nproc; i_receive++) {
 
4610
           mpi::request i_req = comm.irecv (
 
4611
               mpi::any_source,
 
4612
               tag,
 
4613
               receive_data.begin().operator->() + i_receive*receive_max_size,
 
4614
               receive_max_size);
 
4615
           receive_waits.push_back (std::make_pair(i_receive, i_req));
 
4616
         }
 
4617
         // ---------------------------------------------------------------------------
 
4618
         // 6) compute the send indexes
 
4619
         // ---------------------------------------------------------------------------
 
4620
         // comme idx est trie, on peut faire une copie de idx dans send_data
 
4621
         // et du coup owner et send_data_ownership sont inutiles
 
4622
         std::vector<size_type> send_data (nidx);
 
4623
         std::copy (idx, idx+nidx, send_data.begin());
 
4624
         // ---------------------------------------------------------------------------
 
4625
         // 7) do send
 
4626
         // ---------------------------------------------------------------------------
 
4627
         std::list<std::pair<size_type,mpi::request> > send_waits;
 
4628
         {
 
4629
           size_type i_send = 0;
 
4630
           size_type i_start = 0;
 
4631
           for (size_type iproc = 0; iproc < nproc; iproc++) {
 
4632
             size_type i_msg_size = msg_size[iproc];
 
4633
             if (i_msg_size == 0) continue;
 
4634
             mpi::request i_req = comm.isend (
 
4635
                 iproc,
 
4636
                 tag,
 
4637
                 send_data.begin().operator->() + i_start,
 
4638
                 i_msg_size);
 
4639
             send_waits.push_back(std::make_pair(i_send,i_req));
 
4640
             i_send++;
 
4641
             i_start += i_msg_size;
 
4642
           }
 
4643
         } // end block
 
4644
         // ---------------------------------------------------------------------------
 
4645
         // 8) wait on receives
 
4646
         // ---------------------------------------------------------------------------
 
4647
         // note: for wait_all, build an iterator adapter that scan the pair.second in [index,request]
 
4648
         // and then get an iterator in the pair using iter.base(): retrive the corresponding index
 
4649
         // for computing the position in the receive.data buffer
 
4650
         typedef boost::transform_iterator<select2nd<size_t,mpi::request>, std::list<std::pair<size_t,mpi::request> >::iterator>
 
4651
                 request_iterator;
 
4652
         std::vector<size_type> receive_size (receive_nproc);
 
4653
         std::vector<size_type> receive_proc (receive_nproc);
 
4654
         size_type receive_total_size = 0;
 
4655
         while (receive_waits.size() != 0) {
 
4656
             typedef size_type data_type; // exchanged data is of "size_type"
 
4657
             request_iterator iter_r_waits (receive_waits.begin(), select2nd<size_t,mpi::request>()),
 
4658
                              last_r_waits (receive_waits.end(),   select2nd<size_t,mpi::request>());
 
4659
             // waits on any receive...
 
4660
             std::pair<mpi::status,request_iterator> pair_status = mpi::wait_any (iter_r_waits, last_r_waits);
 
4661
             // check status
 
4662
             boost::optional<int> i_msg_size_opt = pair_status.first.count<data_type>();
 
4663
             check_macro (i_msg_size_opt, "receive wait failed");
 
4664
             int iproc = pair_status.first.source();
 
4665
             check_macro (iproc >= 0, "receive: source iproc = "<<iproc<<" < 0 !");
 
4666
             // get size of receive and number in data
 
4667
             size_type i_msg_size = (size_t)i_msg_size_opt.get();
 
4668
             std::list<std::pair<size_t,mpi::request> >::iterator i_pair_ptr = pair_status.second.base();
 
4669
             size_type i_receive = (*i_pair_ptr).first;
 
4670
             receive_proc [i_receive] = iproc;
 
4671
             receive_size [i_receive] = i_msg_size;
 
4672
             receive_total_size += i_msg_size;
 
4673
             receive_waits.erase (i_pair_ptr);
 
4674
         }
 
4675
         // ---------------------------------------------------------------------------
 
4676
         // 9) allocate the entire send(to) scatter context
 
4677
         // ---------------------------------------------------------------------------
 
4678
         to.resize (receive_total_size, receive_nproc);
 
4679
 
 
4680
         // ---------------------------------------------------------------------------
 
4681
         // 10) compute the permutation of values that gives the sorted source[] sequence
 
4682
         // ---------------------------------------------------------------------------
 
4683
         // init: perm[i] = i
 
4684
         std::vector<size_type> perm(receive_nproc);
 
4685
         copy(index_iterator<size_type>(), index_iterator<size_type>(receive_nproc), perm.begin());
 
4686
         sort_with_permutation (
 
4687
             receive_nproc,
 
4688
             receive_proc.begin().operator->(),
 
4689
             perm.begin().operator->());
 
4690
         // ---------------------------------------------------------------------------
 
4691
         // 11) Computes the receive compresed message pattern for send(to)
 
4692
         // ---------------------------------------------------------------------------
 
4693
         size_type istart = ownership[my_proc]; // = ownership.first_index()
 
4694
         msg_to_context (
 
4695
             perm.begin(),
 
4696
             perm.end(),
 
4697
             receive_proc.begin(),
 
4698
             receive_size.begin(),
 
4699
             receive_data.begin(),
 
4700
             receive_max_size,
 
4701
             istart,
 
4702
             to.procs().begin(),
 
4703
             to.starts().begin(),
 
4704
             to.indices().begin());
 
4705
         // ---------------------------------------------------------------------------
 
4706
         // 12) allocate the entire receive(from) scatter context
 
4707
         // ---------------------------------------------------------------------------
 
4708
         from.resize(nidy, send_nproc);
 
4709
         // ---------------------------------------------------------------------------
 
4710
         // 13) Computes the receive compresed message pattern for receive(from)
 
4711
         // ---------------------------------------------------------------------------
 
4712
         std::vector<size_type> proc2from_proc(nproc);
 
4713
         msg_from_context_pattern (
 
4714
             msg_size.begin(),
 
4715
             msg_size.end(),
 
4716
             from.procs().begin(),
 
4717
             from.starts().begin(),
 
4718
             proc2from_proc.begin());
 
4719
         // ---------------------------------------------------------------------------
 
4720
         // 14) Computes the receive compresed message indices for receive(from)
 
4721
         // ---------------------------------------------------------------------------
 
4722
         // assume that indices are sorted by increasing order
 
4723
         std::vector<size_type> start(send_nproc+1);
 
4724
         copy (from.starts().begin(), from.starts().end(), start.begin());
 
4725
         msg_from_context_indices (
 
4726
             owner.begin(),
 
4727
             owner.end(),
 
4728
             idy,
 
4729
             proc2from_proc.begin(),
 
4730
             my_proc,
 
4731
             idy_maxval,
 
4732
             start.begin(),
 
4733
             from.indices().begin());
 
4734
         // ---------------------------------------------------------------------------
 
4735
         // 15) wait on sends
 
4736
         // ---------------------------------------------------------------------------
 
4737
         request_iterator iter_s_waits (send_waits.begin(), select2nd<size_type,mpi::request>()),
 
4738
                          last_s_waits (send_waits.end(),   select2nd<size_type,mpi::request>());
 
4739
         mpi::wait_all (iter_s_waits, last_s_waits);
 
4740
         // ---------------------------------------------------------------------------
 
4741
         // 16) Computes the receive compresed message local pattern,
 
4742
         // i.e. the only part that does not requires communication.
 
4743
         // ---------------------------------------------------------------------------
 
4744
         from.local_slots.resize(n_local);
 
4745
         to.local_slots.resize(n_local);
 
4746
         size_type ilast = ownership[my_proc+1]; // = ownership.last_index()
 
4747
         msg_local_context (
 
4748
             idx,
 
4749
             idx+nidx,
 
4750
             idy,
 
4751
             idy_maxval,
 
4752
             istart,
 
4753
             ilast,
 
4754
             to.local_slots.begin(),
 
4755
             to.local_slots.end(),
 
4756
             from.local_slots.begin());
 
4757
         // ---------------------------------------------------------------------------
 
4758
         // 17) Optimize local exchanges during gatter/scatter
 
4759
         // ---------------------------------------------------------------------------
 
4760
         bool has_opt = msg_local_optimize (
 
4761
             to.local_slots.begin(),
 
4762
             to.local_slots.end(),
 
4763
             from.local_slots.begin());
 
4764
 
 
4765
         if (has_opt && n_local != 0) {
 
4766
             to.local_is_copy       = true;
 
4767
             to.local_copy_start    = to.local_slots[0];
 
4768
             to.local_copy_length   = n_local;
 
4769
             from.local_is_copy     = true;
 
4770
             from.local_copy_start  = from.local_slots[0];
 
4771
             from.local_copy_length = n_local;
 
4772
         }
 
4773
     }
 
4774
 
 
4775
 
 
4776
File: rheolef.info,  Node: eye class,  Up: Classes
 
4777
 
 
4778
5.36 `eye' - identity matrix
 
4779
============================
 
4780
 
 
4781
(Source file: `skit/plib2/eye.h')
 
4782
 
 
4783
Description
 
4784
-----------
 
4785
 
 
4786
Following matlab, the name EYE is used in place of I to denote identity
 
4787
matrices  because I is often used as a subscript or as sqrt(-1). The
 
4788
dimensions of EYE are  determined by context.  For example,
 
4789
                 b = a + 3*EYE
 
4790
 adds 3 to the diagonal elements of A.   Small caps 'eye' is the class
 
4791
name, and upper case 'EYE' is the const variable  "eye<double>()", i.e.
 
4792
the identity matrix.
 
4793
 
 
4794
The preconditioner interface is usefull when calling algorithms without
 
4795
any  preconditioners, e.g.
 
4796
                 int status = cg (a, x, b, EYE, 100, 1e-7);
 
4797
 
 
4798
Implementation
 
4799
--------------
 
4800
 
 
4801
     template<class T>
 
4802
     class eye {
 
4803
       public:
 
4804
         eye () {}
 
4805
         const vec<T>& operator * (const vec<T>& x) const { return x; }
 
4806
         const vec<T>& solve (const vec<T>& x) const { return x; }
 
4807
         const vec<T>& trans_solve (const vec<T>& x) const { x; }
 
4808
     };
 
4809
     #define EYE eye<Float>()
 
4810
 
 
4811
 
 
4812
File: rheolef.info,  Node: mpi_scatter_begin class,  Up: Classes
 
4813
 
 
4814
5.37 mpi_scatter_begin - gather/scatter initialize
 
4815
==================================================
 
4816
 
 
4817
(Source file: `skit/plib2/mpi_scatter_begin.h')
 
4818
 
 
4819
Description
 
4820
-----------
 
4821
 
 
4822
Begin communication   for distributed to sequential scatter context.
 
4823
 
 
4824
Complexity
 
4825
----------
 
4826
 
 
4827
Implementation
 
4828
--------------
 
4829
 
 
4830
Even though the next routines are written with distributed   vectors,
 
4831
either x or y (but not both) may be sequential   vectors, one for each
 
4832
processor.
 
4833
 
 
4834
from indices indicate where arriving stuff is stashed      to   indices
 
4835
indicate where departing stuff came from.       the naming can be a
 
4836
little confusing.
 
4837
 
 
4838
Reverse scatter is obtained by swapping (to,from)  in calls to
 
4839
scatter_begin and scatter_end.   Reverse scatter is usefull for
 
4840
transpose matrix-vector multiply.
 
4841
 
 
4842
Scatter general operation is handled by a template "SetOp" type.   The
 
4843
special case "SetOp=set_op" of an affectation is treated  separatly,
 
4844
tacking care of local scatter affectation.   Thus, the
 
4845
"mpi_scatter_begin" routine is splitted into
 
4846
"msg_scatter_begin_global" and "msg_scatter_begin_local"  parts.
 
4847
 
 
4848
Implementation
 
4849
--------------
 
4850
 
 
4851
     template <
 
4852
         class InputIterator,
 
4853
         class Message,
 
4854
         class Tag,
 
4855
         class Comm>
 
4856
     void
 
4857
     mpi_scatter_begin_global (
 
4858
         InputIterator                       x,
 
4859
         Message&                            from,
 
4860
         Message&                            to,
 
4861
         Tag                                 tag,
 
4862
         Comm                                comm)
 
4863
     {
 
4864
         typedef typename Message::size_type        size_type;
 
4865
         // ----------------------------------------------------------
 
4866
         // 1) post receives
 
4867
         // ----------------------------------------------------------
 
4868
         from.requests.clear();
 
4869
         {
 
4870
           size_type n_receive = from.starts().size() - 1;
 
4871
           size_type i_start = 0;
 
4872
           for (size_type i = 0; i < n_receive; i++) {
 
4873
             size_type i_size = from.starts() [i+1] - from.starts() [i];
 
4874
             mpi::request i_req = comm.irecv(
 
4875
                 from.procs() [i],
 
4876
                 tag,
 
4877
                 from.values().begin().operator->() + i_start,
 
4878
                 i_size);
 
4879
             i_start += i_size;
 
4880
             from.requests.push_back (std::make_pair(i, i_req));
 
4881
           }
 
4882
         } // end block
 
4883
         // ----------------------------------------------------------
 
4884
         // 2) apply right permutation
 
4885
         // ----------------------------------------------------------
 
4886
         to.load_values (x);
 
4887
 
 
4888
         // ----------------------------------------------------------
 
4889
         // 3) do sends
 
4890
         // ----------------------------------------------------------
 
4891
         to.requests.clear();
 
4892
         {
 
4893
           size_type n_send = to.starts().size() - 1;
 
4894
           size_type i_start = 0;
 
4895
           for (size_type i = 0; i < n_send; i++) {
 
4896
             size_type i_size = to.starts() [i+1] - to.starts() [i];
 
4897
             mpi::request i_req = comm.isend(
 
4898
                 to.procs() [i],
 
4899
                 tag,
 
4900
                 to.values().begin().operator->() + i_start,
 
4901
                 i_size);
 
4902
             i_start += i_size;
 
4903
             to.requests.push_back (std::make_pair(i, i_req));
 
4904
           }
 
4905
         } // end block
 
4906
     }
 
4907
     template <
 
4908
         class InputIterator,
 
4909
         class OutputIterator,
 
4910
         class SetOp,
 
4911
         class Message>
 
4912
     void
 
4913
     mpi_scatter_begin_local (
 
4914
         InputIterator                       x,
 
4915
         OutputIterator                      y,
 
4916
         Message&                            from,
 
4917
         Message&                            to,
 
4918
         SetOp                               op)
 
4919
     {
 
4920
     #ifdef TO_CLEAN
 
4921
         msg_both_permutation_apply (
 
4922
             to.local_slots.begin(),
 
4923
             to.local_slots.end(),
 
4924
             x,
 
4925
             op,
 
4926
             from.local_slots.begin(),
 
4927
             y);
 
4928
     #endif // TO_CLEAN
 
4929
     }
 
4930
     // take care of local insert: template specialisation
 
4931
     template <
 
4932
         class InputIterator,
 
4933
         class OutputIterator,
 
4934
         class Message>
 
4935
     void
 
4936
     mpi_scatter_begin_local (
 
4937
         InputIterator                       x,
 
4938
         OutputIterator                      y,
 
4939
         Message&                            from,
 
4940
         Message&                            to,
 
4941
         set_op<typename Message::value_type, typename Message::value_type> op)
 
4942
     {
 
4943
     #ifdef TO_CLEAN
 
4944
         // used when x & y have distinct pointer types (multi-valued)
 
4945
         if (y == x && ! to.local_nonmatching_computed) {
 
4946
             // scatter_local_optimize(to,from);
 
4947
             fatal_macro ("y == x: adress matches in scatter: not yet -- sorry");
 
4948
         }
 
4949
         if (to.local_is_copy) {
 
4950
 
 
4951
             std::copy(x + to.local_copy_start,
 
4952
                       x + to.local_copy_start + to.local_copy_length,
 
4953
                       y + from.local_copy_start);
 
4954
 
 
4955
         } else if (y != x || ! to.local_nonmatching_computed) {
 
4956
 
 
4957
             msg_both_permutation_apply (
 
4958
                 to.local_slots.begin(),
 
4959
                 to.local_slots.end(),
 
4960
                 x,
 
4961
                 op,
 
4962
                 from.local_slots.begin(),
 
4963
                 y);
 
4964
 
 
4965
         } else { // !to.local_is_copy && y == x && to.local_nonmatching_computed
 
4966
 
 
4967
             msg_both_permutation_apply (
 
4968
                 to.local_slots_nonmatching.begin(),
 
4969
                 to.local_slots_nonmatching.end(),
 
4970
                 x,
 
4971
                 op,
 
4972
                 from.local_slots_nonmatching.begin(),
 
4973
                 y);
 
4974
         }
 
4975
     #endif // TO_CLEAN
 
4976
     }
 
4977
     template <
 
4978
         class InputIterator,
 
4979
         class OutputIterator,
 
4980
         class Message,
 
4981
         class SetOp,
 
4982
         class Tag,
 
4983
         class Comm>
 
4984
     inline
 
4985
     void
 
4986
     mpi_scatter_begin(
 
4987
         InputIterator                       x,
 
4988
         OutputIterator                      y,
 
4989
         Message&                            from,
 
4990
         Message&                            to,
 
4991
         SetOp                               op,
 
4992
         Tag                                 tag,
 
4993
         Comm                                comm)
 
4994
     {
 
4995
         mpi_scatter_begin_global (x, from, to, tag, comm);
 
4996
         if (to.n_local() == 0) {
 
4997
             return;
 
4998
         }
 
4999
         error_macro ("local messages: no more supported");
 
5000
         mpi_scatter_begin_local  (x, y, from, to, op);
 
5001
     }
 
5002
 
 
5003
 
 
5004
File: rheolef.info,  Node: mpi_scatter_end class,  Up: Classes
 
5005
 
 
5006
5.38 mpi_scatter_end - gather/scatter finalize
 
5007
==============================================
 
5008
 
 
5009
(Source file: `skit/plib2/mpi_scatter_end.h')
 
5010
 
 
5011
Description
 
5012
-----------
 
5013
 
 
5014
Finishes communication   for distributed to sequential scatter context.
 
5015
 
 
5016
Implementation
 
5017
--------------
 
5018
 
 
5019
     template <
 
5020
         class InputIterator,
 
5021
         class OutputIterator,
 
5022
         class Message,
 
5023
         class SetOp,
 
5024
         class Tag,
 
5025
         class Comm>
 
5026
     void
 
5027
     mpi_scatter_end(
 
5028
         InputIterator                       x,
 
5029
         OutputIterator                      y,
 
5030
         Message&                            from,
 
5031
         Message&                            to,
 
5032
         SetOp                               op,
 
5033
         Tag                                 tag,
 
5034
         Comm                                comm)
 
5035
     {
 
5036
         typedef typename Message::base_value_type data_type; // the data type to be received by mpi
 
5037
         typedef boost::transform_iterator<select2nd<size_t,mpi::request>, std::list<std::pair<size_t,mpi::request> >::iterator>
 
5038
                 request_iterator;
 
5039
 
 
5040
         // -----------------------------------------------------------
 
5041
         // 1) wait on receives and unpack receives into local space
 
5042
         // -----------------------------------------------------------
 
5043
         while (from.requests.size() != 0) {
 
5044
             request_iterator iter_r_waits (from.requests.begin(), select2nd<size_t,mpi::request>()),
 
5045
                              last_r_waits (from.requests.end(),   select2nd<size_t,mpi::request>());
 
5046
             // waits on any receive...
 
5047
             std::pair<mpi::status,request_iterator> pair_status = mpi::wait_any (iter_r_waits, last_r_waits);
 
5048
             // check status
 
5049
             boost::optional<int> i_msg_size_opt = pair_status.first.count<data_type>();
 
5050
             check_macro (i_msg_size_opt, "receive wait failed");
 
5051
             int iproc = pair_status.first.source();
 
5052
             check_macro (iproc >= 0, "receive: source iproc = "<<iproc<<" < 0 !");
 
5053
             // get size of receive and number in data
 
5054
             size_t i_msg_size = (size_t)i_msg_size_opt.get();
 
5055
             std::list<std::pair<size_t,mpi::request> >::iterator i_pair_ptr = pair_status.second.base();
 
5056
             size_t i_receive = (*i_pair_ptr).first;
 
5057
             check_macro (i_msg_size == from.starts()[i_receive+1] - from.starts()[i_receive], "unexpected size");
 
5058
 
 
5059
             // unpack receives into our local space
 
5060
             from.store_values (y, i_receive, op);
 
5061
             from.requests.erase (i_pair_ptr);
 
5062
         }
 
5063
         // -----------------------------------------------------------
 
5064
         // 2) wait on sends
 
5065
         // -----------------------------------------------------------
 
5066
         request_iterator iter_s_waits (to.requests.begin(), select2nd<size_t,mpi::request>()),
 
5067
                          last_s_waits (to.requests.end(),   select2nd<size_t,mpi::request>());
 
5068
         mpi::wait_all (iter_s_waits, last_s_waits);
 
5069
     }
4310
5070
 
4311
5071
 
4312
5072
File: rheolef.info,  Node: iorheo class,  Up: Classes
4313
5073
 
4314
 
5.20 `iorheo' - input and output functions and manipulation
 
5074
5.39 `iorheo' - input and output functions and manipulation
4315
5075
===========================================================
4316
5076
 
4317
5077
(Source file: `util/lib/iorheo.h') 
4536
5296
`n_isovalue_negative INT'
4537
5297
`vectorscale FLOAT'
4538
5298
`subdivide FLOAT'
 
5299
`image_format STRING'
 
5300
     The argument is any valid image format, such as `png', `jpg' or
 
5301
     `pdf',         that could be handled by the corresponding graphic
 
5302
     render.
4539
5303
 
4540
5304
 
4541
5305
File: rheolef.info,  Node: Vector class,  Up: Classes
4542
5306
 
4543
 
5.21 `Vector' - STL `vector<T>' with reference counting
 
5307
5.40 `Vector' - STL `vector<T>' with reference counting
4544
5308
=======================================================
4545
5309
 
4546
5310
(Source file: `util/lib/Vector.h') 
4641
5405
 
4642
5406
File: rheolef.info,  Node: catchmark class,  Up: Classes
4643
5407
 
4644
 
5.22 `catchmark' - iostream manipulator
 
5408
5.41 `catchmark' - iostream manipulator
4645
5409
=======================================
4646
5410
 
4647
5411
(Source file: `util/lib/catchmark.h') 
4673
5437
 
4674
5438
File: rheolef.info,  Node: rheostream class,  Up: Classes
4675
5439
 
4676
 
5.23 `irheostream', `orheostream' - large data streams
 
5440
5.42 `irheostream', `orheostream' - large data streams
4677
5441
======================================================
4678
5442
 
4679
5443
(Source file: `util/lib/rheostream.h') 
4795
5559
     bool is_float (const std::string&);
4796
5560
     Float to_float (const std::string&);
4797
5561
 
 
5562
     // in TMPDIR environment variable or "/tmp" by default
 
5563
     std::string get_tmpdir();
 
5564
 
4798
5565
 
4799
5566
File: rheolef.info,  Node: Algorithms,  Up: Top
4800
5567
 
4803
5570
 
4804
5571
* Menu:
4805
5572
 
4806
 
* newton algorithm::
4807
 
* damped-newton algorithm::
4808
 
* riesz_representer algorithm::
4809
 
* mixed_solver algorithm::
4810
 
* pminres algorithm::
4811
 
* qmr algorithm::
4812
 
* pcg algorithm::
4813
 
* bicgstab algorithm::
4814
 
* puzawa algorithm::
4815
 
* gmres algorithm::
4816
 
 
4817
 
 
4818
 
File: rheolef.info,  Node: newton algorithm,  Up: Algorithms
4819
 
 
4820
 
6.1 `newton' - Newton nonlinear algorithm
4821
 
=========================================
4822
 
 
4823
 
(Source file: `nfem/lib/newton.h') 
4824
 
 
4825
 
Description
4826
 
-----------
4827
 
 
4828
 
Nonlinear Newton algorithm for the resolution of the following problem:
4829
 
            F(u) = 0
4830
 
  A simple call to the algorithm writes:
4831
 
         my_problem P;
4832
 
         field uh (Vh);
4833
 
         newton (P, uh, tol, max_iter);
4834
 
  The `my_problem' class may contains methods for the evaluation   of F
4835
 
(aka residue) and its derivative:
4836
 
         class my_problem {
4837
 
         public:
4838
 
           my_problem();
4839
 
           field residue (const field& uh) const;
4840
 
           void update_derivative (const field& uh) const;
4841
 
           field derivative_solve (const field& mrh) const;
4842
 
           Float norm (const field& uh) const;
4843
 
           Float dual_norm (const field& Muh) const;
4844
 
         };
4845
 
  See the example `p-laplacian.h' in the user's documentation   for
4846
 
more.
4847
 
 
4848
 
Implementation
4849
 
--------------
4850
 
 
4851
 
     template <class Problem, class Field>
4852
 
     int newton (Problem P, Field& uh, Float& tol, size_t& max_iter, std::ostream *p_cerr = 0) {
4853
 
         if (p_cerr) *p_cerr << "# Newton: n r" << std::endl;
4854
 
         for (size_t n = 0; true; n++) {
4855
 
           Field rh = P.residue(uh);
4856
 
           Float r = P.dual_norm(rh);
4857
 
           if (p_cerr) *p_cerr << n << " " << r << std::endl;
4858
 
           if (r <= tol) { tol = r; max_iter = n; return 0; }
4859
 
           if (n == max_iter) { tol = r; return 1; }
4860
 
           P.update_derivative (uh);
4861
 
           Field delta_uh = P.derivative_solve (-rh);
4862
 
           uh += delta_uh;
4863
 
         }
4864
 
     }
4865
 
 
4866
 
 
4867
 
File: rheolef.info,  Node: damped-newton algorithm,  Up: Algorithms
4868
 
 
4869
 
6.2 `damped_newton' - damped Newton nonlinear algorithm
4870
 
=======================================================
4871
 
 
4872
 
(Source file: `nfem/lib/damped-newton.h') 
4873
 
 
4874
 
Description
4875
 
-----------
4876
 
 
4877
 
Nonlinear damped Newton algorithm for the resolution of the following
4878
 
problem:
4879
 
            F(u) = 0
4880
 
  A simple call to the algorithm writes:
4881
 
         my_problem P;
4882
 
         field uh (Vh);
4883
 
         damped_newton (P, uh, tol, max_iter);
4884
 
  The `my_problem' class may contains methods for the evaluation   of F
4885
 
(aka residue) and its derivative:
4886
 
         class my_problem {
4887
 
         public:
4888
 
           my_problem();
4889
 
           field residue (const field& uh) const;
4890
 
           void update_derivative (const field& uh) const;
4891
 
           field derivative_trans_mult (const field& mrh) const;
4892
 
           field derivative_solve (const field& mrh) const;
4893
 
           Float norm (const field& uh) const;
4894
 
           Float dual_norm (const field& Muh) const;
4895
 
         };
4896
 
  See the example `p-laplacian.h' in the user's documentation   for
4897
 
more.
4898
 
 
4899
 
Implementation
4900
 
--------------
4901
 
 
4902
 
     template <class Problem, class Field, class Real, class Size>
4903
 
     int damped_newton (Problem P, Field& u, Real& tol, Size& max_iter, std::ostream* p_cerr=0) {
4904
 
       return damped_newton(P, newton_identity_preconditioner(), u, tol, max_iter, p_cerr);
4905
 
     }
4906
 
 
4907
 
 
4908
 
File: rheolef.info,  Node: riesz_representer algorithm,  Up: Algorithms
4909
 
 
4910
 
6.3 `riesz_representer' - integrate a function by using quadrature formulae
4911
 
===========================================================================
4912
 
 
4913
 
(Source file: `nfem/lib/riesz_representer.h') 
4914
 
 
4915
 
Description
4916
 
-----------
4917
 
 
4918
 
The function `riesz_representer' implements the  approximation of an
4919
 
integral by using quadrature formulae.   This is an expreimental
4920
 
implementation: please do not use  yet for practical usage.
4921
 
 
4922
 
Synopsys
4923
 
--------
4924
 
 
4925
 
template <class Function>  field riesz_representer (const space& Vh,
4926
 
const Function& f);
4927
 
 
4928
 
template <class Function>  field riesz_representer (const space& Vh,
4929
 
const Function& f,         quadrature_option_type qopt);
4930
 
 
4931
 
Example
4932
 
-------
4933
 
 
4934
 
The following code compute the Riesz representant, denoted  by `mfh' of
4935
 
f(x), and the integral of f over the domain omega:
4936
 
       Float f(const point& x);
4937
 
       ...
4938
 
       space Vh (omega_h, "P1");
4939
 
       field mfh = riesz_representer(Vh, f);
4940
 
       Float int_f = dot(mfh, field(Vh,1.0));
4941
 
 The Riesz representer is the `mfh' vector of values:
4942
 
             mfh(i) = integrate f(x) phi_i(x) dx
4943
 
 where phi_i is the i-th basis function in Vh  and the integral is
4944
 
evaluated by using a quadrature formulae.   By default the quadrature
4945
 
formule is the Gauss one with  the order equal to the polynomial order
4946
 
of Vh.   Alternative quadrature formulae and order is available  by
4947
 
passing an optional variable to riesz_representer.
4948
 
 
4949
 
Implementation
4950
 
--------------
4951
 
 
4952
 
     template <class Function>
4953
 
     field
4954
 
     riesz_representer (
4955
 
         const space& Vh,
4956
 
         const Function& f,
4957
 
         quadrature_option_type qopt
4958
 
            = quadrature_option_type(quadrature_option_type::max_family,0))
4959
 
 
4960
 
 
4961
 
File: rheolef.info,  Node: mixed_solver algorithm,  Up: Algorithms
4962
 
 
4963
 
6.4 `pcg_abtb', `pcg_abtbc', `pminres_abtb', `pminres_abtbc' - solvers for mixed linear problems
4964
 
================================================================================================
4965
 
 
4966
 
(Source file: `skit/lib/mixed_solver.h') 
4967
 
 
4968
 
Synopsis
4969
 
--------
4970
 
 
4971
 
         template <class Matrix, class Vector, class Solver, class Preconditioner, class Size, class Real>
4972
 
         int pcg_abtb (const Matrix& A, const Matrix& B, Vector& u, Vector& p,
4973
 
           const Vector& Mf, const Vector& Mg, const Preconditioner& S1,
4974
 
           const Solver& inner_solver_A, Size& max_iter, Real& tol,
4975
 
           std::ostream *p_cerr = 0, std::string label = "pcg_abtb");
4976
 
 
4977
 
         template <class Matrix, class Vector, class Solver, class Preconditioner, class Size, class Real>
4978
 
         int pcg_abtbc (const Matrix& A, const Matrix& B, const Matrix& C, Vector& u, Vector& p,
4979
 
           const Vector& Mf, const Vector& Mg, const Preconditioner& S1,
4980
 
           const Solver& inner_solver_A, Size& max_iter, Real& tol,
4981
 
           std::ostream *p_cerr = 0, std::string label = "pcg_abtbc");
4982
 
  The synopsis is the same with the pminres algorithm.
4983
 
 
4984
 
Examples
4985
 
--------
4986
 
 
4987
 
See the user's manual for practical examples for the nearly
4988
 
incompressible   elasticity, the Stokes and the Navier-Stokes problems.
4989
 
 
4990
 
Description
4991
 
-----------
4992
 
 
4993
 
Preconditioned conjugate gradient algorithm on the pressure p applied to
4994
 
 the stabilized stokes problem:
4995
 
            [ A  B^T ] [ u ]    [ Mf ]
4996
 
            [        ] [   ]  = [    ]
4997
 
            [ B  -C  ] [ p ]    [ Mg ]
4998
 
  where A is symmetric positive definite and C is symmetric positive
4999
 
and semi-definite.    Such mixed linear problems appears for instance
5000
 
with the discretization   of Stokes problems with stabilized P1-P1
5001
 
element, or with nearly   incompressible elasticity.    Formaly u =
5002
 
inv(A)*(Mf - B^T*p) and the reduced system writes for   all
5003
 
non-singular matrix S1:
5004
 
          inv(S1)*(B*inv(A)*B^T)*p = inv(S1)*(B*inv(A)*Mf - Mg)
5005
 
  Uzawa or conjugate gradient algorithms are considered on the
5006
 
reduced problem.    Here, S1 is some preconditioner for the Schur
5007
 
complement S=B*inv(A)*B^T.    Both direct or iterative solvers for S1*q
5008
 
= t are supported.    Application of inv(A) is performed via a call to
5009
 
a solver   for systems such as A*v = b.    This last system may be
5010
 
solved either by direct or iterative algorithms,   thus, a general
5011
 
matrix solver class is submitted to the algorithm.    For most
5012
 
applications, such as the Stokes problem,   the mass matrix for the p
5013
 
variable is a good S1 preconditioner   for the Schur complement.    The
5014
 
stoping criteria is expressed using the S1 matrix, i.e. in L2 norm
5015
 
when this choice is considered.    It is scaled by the L2 norm of the
5016
 
right-hand side of the reduced system,   also in S1 norm.
5017
 
 
5018
 
 
5019
 
File: rheolef.info,  Node: pminres algorithm,  Up: Algorithms
5020
 
 
5021
 
6.5 `pminres' - conjugate gradient algorithm.
 
5573
* msg_local_context algorithm::
 
5574
* msg_left_permutation_apply algorithm::
 
5575
* msg_local_optimize algorithm::
 
5576
* mpi_polymorphic_assembly_end algorithm::
 
5577
* mpi_polymorphic_assembly_begin algorithm::
 
5578
* msg_right_permutation_apply algorithm::
 
5579
* mpi_assembly_end algorithm::
 
5580
* mpi_scatter_begin algorithm::
 
5581
* msg_from_context_pattern algorithm::
 
5582
* mpi_scatter_init algorithm::
 
5583
* msg_both_permutation_apply algorithm::
 
5584
* mpi_assembly_begin algorithm::
 
5585
* msg_to_context algorithm::
 
5586
* msg_from_context_indices algorithm::
 
5587
* mpi_scatter_end algorithm::
 
5588
 
 
5589
 
 
5590
File: rheolef.info,  Node: msg_local_context algorithm,  Up: Algorithms
 
5591
 
 
5592
6.1 msg_local_context - receive pattern
 
5593
=======================================
 
5594
 
 
5595
(Source file: `skit/plib2/msg_local_context.h')
 
5596
 
 
5597
Description
 
5598
-----------
 
5599
 
 
5600
Computes the receive compresed message local pattern,   i.e. the only
 
5601
part that does not requires communication.    (see "msg_to_context"(5)).
 
5602
 
 
5603
Algorithm
 
5604
---------
 
5605
 
 
5606
msg_local_context
 
5607
 
 
5608
"input": the index sets and the local processor index range   |
 
5609
idx(0:nidx-1), idy(0:nidx-1), istart, ilast   "output": the send and
 
5610
receive local contexts (to, from)   |   to_loc_idx(0:n_local-1),
 
5611
from_loc_idy(0:n_local-1)   begin   |     if n_local <> 0 then   |
 
5612
iloc := 0   |       for k := 0 to nidx-1 do   |         if idy(k) in
 
5613
(istart, ilast( then   |           to_loc_idx(iloc)   := idy(k) - istart
 
5614
 |           from_loc_idy(iloc) := idy(k)   |           iloc := iloc + 1
 
5615
 |         endif   |       endfor   |     endif   end
 
5616
 
 
5617
Complexity
 
5618
----------
 
5619
 
 
5620
Memory and time complexity is O(receive_total_size).
 
5621
 
 
5622
Implementation
 
5623
--------------
 
5624
 
 
5625
     template <
 
5626
         class InputIterator1,
 
5627
         class InputIterator2,
 
5628
         class Size,
 
5629
         class OutputIterator1,
 
5630
         class OutputIterator2>
 
5631
     void
 
5632
     msg_local_context (
 
5633
         InputIterator1              idx,            // nidx
 
5634
         InputIterator1              last_idx,
 
5635
         InputIterator2              idy,            // nidx
 
5636
         Size                        idy_maxval,
 
5637
         Size                        istart,
 
5638
         Size                        ilast,
 
5639
         OutputIterator1             to_loc_idx,             // n_local
 
5640
         OutputIterator1             last_to_loc_idx,
 
5641
         OutputIterator2             from_loc_idy)           // n_local
 
5642
     {
 
5643
         if (to_loc_idx == last_to_loc_idx) {
 
5644
             return;
 
5645
         }
 
5646
         while (idx != last_idx) {
 
5647
             Size idx_i = *idx;
 
5648
             if (idx_i >= istart && idx_i < ilast) {
 
5649
                 Size idy_i = *idy;
 
5650
                 assert_macro (idy_i < idy_maxval, "Scattering past end of TO vector");
 
5651
                 (*to_loc_idx++)   = idx_i - istart;
 
5652
                 (*from_loc_idy++) = idy_i;
 
5653
             }
 
5654
             ++idx;
 
5655
             ++idy;
 
5656
         }
 
5657
     }
 
5658
 
 
5659
 
 
5660
File: rheolef.info,  Node: msg_left_permutation_apply algorithm,  Up: Algorithms
 
5661
 
 
5662
6.2 msg_left_permutation_apply - sequentail apply
 
5663
=================================================
 
5664
 
 
5665
(Source file: `skit/plib2/msg_left_permutation_apply.h')
 
5666
 
 
5667
Description
 
5668
-----------
 
5669
 
 
5670
Applies a left permutation to an array.
 
5671
 
 
5672
Algorithm
 
5673
---------
 
5674
 
 
5675
msg_left_permutation_apply
 
5676
 
 
5677
"input": the length array   |   x(0:nx-1), py(0:n-1)   "output": the
 
5678
pointer array and the total size   |   y(0:n)   begin   |   for i := 0
 
5679
to n-1 do   |     y(py(i)) := x(i)   |   endfor   end
 
5680
 
 
5681
Complexity
 
5682
----------
 
5683
 
 
5684
Time and memory complexity is O(n).
 
5685
 
 
5686
Implementation
 
5687
--------------
 
5688
 
 
5689
     template <
 
5690
         class InputIterator1,
 
5691
         class InputIterator2,
 
5692
         class SetOp,
 
5693
         class OutputRandomIterator>
 
5694
     void
 
5695
     msg_left_permutation_apply (
 
5696
         InputIterator1              x,
 
5697
         SetOp                       op,
 
5698
         InputIterator2              py,
 
5699
         InputIterator2              last_py,
 
5700
         OutputRandomIterator        y)
 
5701
     {
 
5702
         while (py != last_py)
 
5703
             op(y[*py++], *x++);
 
5704
     }
 
5705
 
 
5706
 
 
5707
File: rheolef.info,  Node: msg_local_optimize algorithm,  Up: Algorithms
 
5708
 
 
5709
6.3 msg_local_optimize - local scatter optimize
 
5710
===============================================
 
5711
 
 
5712
(Source file: `skit/plib2/msg_local_optimize.h')
 
5713
 
 
5714
Description
 
5715
-----------
 
5716
 
 
5717
Optimize local exchanges during gatter/scatter.
 
5718
 
 
5719
Algorithm
 
5720
---------
 
5721
 
 
5722
msg_local_optimize
 
5723
 
 
5724
"input": the send and receive local contexts (to, from)   |
 
5725
to_loc_idx(0:n_local-1), from_loc_idy(0:n_local-1)   "output": the
 
5726
boolean, true when optimization is possible   |   has_opt   begin   |
 
5727
 if n_local = 0 then   |       has_opt := false   |     else   |
 
5728
to_start   := to_loc_idx(0)   |       from_start := from_loc_idy(0)   |
 
5729
     has_opt := true   |       i := 1   |       while i < n_local and
 
5730
has_opt do   |         to_start   := to_start + 1   |
 
5731
from_start := from_start + 1   |         if to_loc_idx(i)   <> to_start
 
5732
 |         or from_loc_idy(i) <> from_start then   |           has_opt
 
5733
:= false   |         endif   |         i := i + 1   |       endwhile
 
5734
|     endif   end
 
5735
 
 
5736
Complexity
 
5737
----------
 
5738
 
 
5739
Memory and time complexity is O(receive_total_size).
 
5740
 
 
5741
Implementation
 
5742
--------------
 
5743
 
 
5744
     template <
 
5745
         class InputIterator1,
 
5746
         class InputIterator2>
 
5747
     bool
 
5748
     msg_local_optimize (
 
5749
         InputIterator1              to_loc_idx,     // n_local
 
5750
         InputIterator1              last_to_loc_idx,
 
5751
         InputIterator2              from_loc_idy)   // n_local
 
5752
     {
 
5753
         typedef typename std::iterator_traits<InputIterator1>::value_type Size;
 
5754
         if (to_loc_idx == last_to_loc_idx) {
 
5755
             return false;
 
5756
         }
 
5757
         Size to_start   = *to_loc_idx++;
 
5758
         Size from_start = *from_loc_idy++;
 
5759
         bool has_opt = true;
 
5760
         while (to_loc_idx != last_to_loc_idx && has_opt) {
 
5761
             to_start++;
 
5762
             from_start++;
 
5763
             if ((*to_loc_idx++)   != to_start ||
 
5764
                 (*from_loc_idy++) != from_start) {
 
5765
                 has_opt = false;
 
5766
             }
 
5767
         }
 
5768
         return has_opt;
 
5769
     }
 
5770
 
 
5771
 
 
5772
File: rheolef.info,  Node: mpi_polymorphic_assembly_end algorithm,  Up: Algorithms
 
5773
 
 
5774
6.4 mpi_polymorphic_assembly_end - polymorphic array assembly
 
5775
=============================================================
 
5776
 
 
5777
(Source file: `skit/plib2/mpi_polymorphic_assembly_end.h')
 
5778
 
 
5779
Description
 
5780
-----------
 
5781
 
 
5782
Finish a dense polymorphic array assembly.
 
5783
 
 
5784
Complexity
 
5785
----------
 
5786
 
 
5787
**TO DO**
 
5788
 
 
5789
Implementation
 
5790
--------------
 
5791
 
 
5792
     template <class Container, class Message>
 
5793
     struct mpi_polymorphic_assembly_end_t<Container,Message,N> {
 
5794
       void operator() (
 
5795
         // input:
 
5796
             const distributor&                             ownership,
 
5797
             Message&                                       receive, // buffer
 
5798
             Message&                                       send,    // buffer
 
5799
             boost::array<typename Container::size_type,N>& receive_max_size,
 
5800
         // output:
 
5801
             Container&                                     x) const;
 
5802
     };
 
5803
 
 
5804
 
 
5805
     template <class Container, class Message>
 
5806
     void
 
5807
     mpi_polymorphic_assembly_end_t<Container,Message,N>::operator() (
 
5808
         // input:
 
5809
             const distributor&                             ownership,
 
5810
             Message&                                       receive, // buffer
 
5811
             Message&                                       send,    // buffer
 
5812
             boost::array<typename Container::size_type,N>& receive_max_size,
 
5813
         // output:
 
5814
             Container&                                     x) const
 
5815
     {
 
5816
         typedef typename Container::size_type size_type;
 
5817
         const size_type  _n_variant = Container::_n_variant; // should be = N
 
5818
         // -----------------------------------------------------------------
 
5819
         // 1) receive data and store it in container
 
5820
         // -----------------------------------------------------------------
 
5821
         // note: for wait_any, build an iterator adapter that scan the pair.second in [index,request]
 
5822
         // and then get an iterator in the pair using iter.base(): retrive the corresponding index
 
5823
         // for computing the position in the receive.data buffer
 
5824
         typedef boost::transform_iterator<
 
5825
                     select2nd<size_type,mpi::request>,
 
5826
                     typename std::list<std::pair<size_type,mpi::request> >::iterator>
 
5827
                 request_iterator;
 
5828
 
 
5829
     #define _RHEOLEF_receive_data(z,k,unused)                                                                       \
 
5830
         while (receive.waits[k].size() != 0) {                                                                      \
 
5831
             typedef typename Container::T##k             T##k;                                                      \
 
5832
             typedef typename std::pair<size_type,T##k>   data##k##_type;                                            \
 
5833
             request_iterator iter_r_waits (receive.waits[k].begin(), select2nd<size_type,mpi::request>()),          \
 
5834
                              last_r_waits (receive.waits[k].end(),   select2nd<size_type,mpi::request>());          \
 
5835
             /* waits on any receive... */                                                                           \
 
5836
             std::pair<mpi::status,request_iterator> pair_status = mpi::wait_any (iter_r_waits, last_r_waits);       \
 
5837
             /* check status */                                                                                      \
 
5838
             boost::optional<int> i_msg_size_opt = pair_status.first.template count<data##k##_type>();               \
 
5839
             check_macro (i_msg_size_opt, "receive wait failed");                                                    \
 
5840
             int iproc = pair_status.first.source();                                                                 \
 
5841
             check_macro (iproc >= 0, "receive: source iproc = "<<iproc<<" < 0 !");                                  \
 
5842
             /* get size of receive and number in data */                                                            \
 
5843
             size_type i_msg_size = (size_type)i_msg_size_opt.get();                                                 \
 
5844
             typename std::list<std::pair<size_type,mpi::request> >::iterator i_pair_ptr                             \
 
5845
                  = pair_status.second.base();                                                                       \
 
5846
             size_type i_receive = (*i_pair_ptr).first;                                                              \
 
5847
             size_type i_start = i_receive*receive_max_size[k];                                                      \
 
5848
             for (size_type j = i_start; j < i_start + i_msg_size; j++) {                                            \
 
5849
                 size_type first_index = ownership.first_index();                                                    \
 
5850
                 size_type index       = receive.data._stack_##k[j].first;                                           \
 
5851
                 T##k      value       = receive.data._stack_##k[j].second;                                          \
 
5852
                 x.assign (index - first_index, value);                                                              \
 
5853
             }                                                                                                       \
 
5854
             receive.waits[k].erase (i_pair_ptr);                                                                    \
 
5855
         }
 
5856
         BOOST_PP_REPEAT(N, _RHEOLEF_receive_data, ~)
 
5857
     #undef _RHEOLEF_receive_data
 
5858
 
 
5859
     #ifdef TODO
 
5860
       size_type  start = ownership().first_index();                                 \
 
5861
       size_type  last  = ownership().last_index();                                  \
 
5862
       if (i_global >= start && i_global < last)                                     \
 
5863
         polymorphic_array_seq_rep<T,V,N>::assign (i_global - start, val);           \
 
5864
 
 
5865
     #endif // TODO
 
5866
         // -----------------------------------------------------------------
 
5867
         // 2) wait on sends
 
5868
         // -----------------------------------------------------------------
 
5869
         for (size_type k = 0; k < _n_variant; k++) {
 
5870
             request_iterator iter_s_waits (send.waits[k].begin(), select2nd<size_type,mpi::request>()),
 
5871
                              last_s_waits (send.waits[k].end(),   select2nd<size_type,mpi::request>());
 
5872
             size_type send_nproc = send.waits[k].size();
 
5873
             std::vector<mpi::status> send_status (send_nproc);
 
5874
             mpi::wait_all (iter_s_waits, last_s_waits, send_status.begin());
 
5875
         }
 
5876
         // -----------------------------------------------------------------
 
5877
         // 3) clear send & receive messages [waits,data]
 
5878
         // -----------------------------------------------------------------
 
5879
     #ifdef TODO
 
5880
         send.waits.clear();
 
5881
         send.data.clear();
 
5882
         receive.waits.clear();
 
5883
         receive.data.clear();
 
5884
     #endif // TODO
 
5885
     }
 
5886
 
 
5887
 
 
5888
File: rheolef.info,  Node: mpi_polymorphic_assembly_begin algorithm,  Up: Algorithms
 
5889
 
 
5890
6.5 mpi_polymorph_assembly_begin - for polymorph_array
 
5891
======================================================
 
5892
 
 
5893
(Source file: `skit/plib2/mpi_polymorphic_assembly_begin.h')
 
5894
 
 
5895
Description
 
5896
-----------
 
5897
 
 
5898
Start a dense polymorph array matrix assembly.
 
5899
 
 
5900
Complexity
 
5901
----------
 
5902
 
 
5903
Assume that stash has indexes in increasing order.    cpu complexity :
 
5904
O(stash.size + nproc)   memory complexity : O(stash.size + nproc)   msg
 
5905
size complexity : O(stash.size + nproc)
 
5906
 
 
5907
When assembling a finite element matrix, the stash.size is at boundaries
 
5908
 of the mesh partition, and stash.size = O(nrow^alpha), where
 
5909
alpha=(d-1)/d   and d=2,3. Using nproc <= O(nrow^alpha) is performant.
 
5910
 
 
5911
Note
 
5912
----
 
5913
 
 
5914
The stash may be sorted by increasing nows and column.
 
5915
 
 
5916
Inspirated from Petsc (petsc/src/vec/vec/impls/mpi/pdvec.c), here with
 
5917
a pre-sorted stash, thanks to the stl::map data structure.
 
5918
 
 
5919
 
 
5920
File: rheolef.info,  Node: msg_right_permutation_apply algorithm,  Up: Algorithms
 
5921
 
 
5922
6.6 msg_right_permutation_apply - sequentail apply
 
5923
==================================================
 
5924
 
 
5925
(Source file: `skit/plib2/msg_right_permutation_apply.h')
 
5926
 
 
5927
Description
 
5928
-----------
 
5929
 
 
5930
Applies a permutation to an array.
 
5931
 
 
5932
Algorithm
 
5933
---------
 
5934
 
 
5935
msg_right_permutation_apply
 
5936
 
 
5937
"input": the length array   |   perm(0:n-1), x(0:nx-1)   "output": the
 
5938
pointer array and the total size   |   y(0:n)   begin   |   for i := 0
 
5939
to n-1 do   |     y(i) := x(perm(i))   |   endfor   end
 
5940
 
 
5941
Complexity
 
5942
----------
 
5943
 
 
5944
Time and memory complexity is O(n).
 
5945
 
 
5946
Implementation
 
5947
--------------
 
5948
 
 
5949
     template <
 
5950
         class InputIterator,
 
5951
         class InputRandomIterator,
 
5952
         class OutputIterator,
 
5953
         class SetOp>
 
5954
     OutputIterator
 
5955
     msg_right_permutation_apply (
 
5956
         InputIterator               perm,
 
5957
         InputIterator               last_perm,
 
5958
         const InputRandomIterator&  x,
 
5959
         OutputIterator              y,
 
5960
         SetOp                       set_op)
 
5961
     {
 
5962
         for (; perm != last_perm; y++, perm++) {
 
5963
             // something like: (*y++) = x[(*perm++)];
 
5964
             set_op (y, x, *perm);
 
5965
         }
 
5966
         return y;
 
5967
     }
 
5968
 
 
5969
 
 
5970
File: rheolef.info,  Node: mpi_assembly_end algorithm,  Up: Algorithms
 
5971
 
 
5972
6.7 msgé_assembly_end - array or matrix assembly
 
5973
=================================================
 
5974
 
 
5975
(Source file: `skit/plib2/mpi_assembly_end.h')
 
5976
 
 
5977
Description
 
5978
-----------
 
5979
 
 
5980
Finish a dense array or sparse matrix assembly.
 
5981
 
 
5982
Complexity
 
5983
----------
 
5984
 
 
5985
**TO DO**
 
5986
 
 
5987
Implementation
 
5988
--------------
 
5989
 
 
5990
     template <
 
5991
         class Container,
 
5992
         class Message,
 
5993
         class Size>
 
5994
     Size
 
5995
     mpi_assembly_end (
 
5996
     // input:
 
5997
         Message&            receive,
 
5998
         Message&            send,
 
5999
         Size                receive_max_size,
 
6000
     // output:
 
6001
         Container           x)
 
6002
     {
 
6003
         typedef Size                          size_type;
 
6004
         typedef typename Container::data_type data_type;
 
6005
         // -----------------------------------------------------------------
 
6006
         // 1) receive data and store it in container
 
6007
         // -----------------------------------------------------------------
 
6008
 
 
6009
         // note: for wait_any, build an iterator adapter that scan the pair.second in [index,request]
 
6010
         // and then get an iterator in the pair using iter.base(): retrive the corresponding index
 
6011
         // for computing the position in the receive.data buffer
 
6012
         typedef boost::transform_iterator<select2nd<size_type,mpi::request>,
 
6013
                     typename std::list<std::pair<size_type,mpi::request> >::iterator>
 
6014
                 request_iterator;
 
6015
 
 
6016
     #define _RHEOLEF_BUG_FOR_NON_MPI_DATA_TYPE
 
6017
     #ifdef _RHEOLEF_BUG_FOR_NON_MPI_DATA_TYPE
 
6018
         while (receive.waits.size() != 0) {
 
6019
             request_iterator iter_r_waits (receive.waits.begin(), select2nd<size_type,mpi::request>()),
 
6020
                              last_r_waits (receive.waits.end(),   select2nd<size_type,mpi::request>());
 
6021
             // waits on any receive...
 
6022
             std::pair<mpi::status,request_iterator> pair_status = mpi::wait_any (iter_r_waits, last_r_waits);
 
6023
             // check status
 
6024
             boost::optional<int> i_msg_size_opt = pair_status.first.template count<data_type>();
 
6025
             check_macro (i_msg_size_opt, "receive wait failed");
 
6026
             int iproc = pair_status.first.source();
 
6027
             check_macro (iproc >= 0, "receive: source iproc = "<<iproc<<" < 0 !");
 
6028
             // get size of receive and number in data
 
6029
             size_type i_msg_size = (size_type)i_msg_size_opt.get();
 
6030
             typename std::list<std::pair<size_type,mpi::request> >::iterator i_pair_ptr = pair_status.second.base();
 
6031
             size_type i_receive = (*i_pair_ptr).first;
 
6032
             size_type i_start = i_receive*receive_max_size;
 
6033
             for (size_type j = i_start; j < i_start + i_msg_size; j++) {
 
6034
                 x (receive.data[j]);
 
6035
             }
 
6036
             receive.waits.erase (i_pair_ptr);
 
6037
         }
 
6038
     #else // _RHEOLEF_BUG_FOR_NON_MPI_DATA_TYPE
 
6039
         // wait_all works better when using an array of non mpi_data_type, as an array of set<size_t>
 
6040
         request_iterator iter_r_waits (receive.waits.begin(), select2nd<size_type,mpi::request>()),
 
6041
                          last_r_waits (receive.waits.end(),   select2nd<size_type,mpi::request>());
 
6042
         std::vector<mpi::status> recv_status (receive.waits.size());
 
6043
         mpi::wait_all (iter_r_waits, last_r_waits, recv_status.begin());
 
6044
         for (size_type i_recv = 0, n_recv = recv_status.size(); i_recv < n_recv; i_recv++) {
 
6045
             boost::optional<int> i_msg_size_opt = recv_status[i_recv].template count<data_type>();
 
6046
             check_macro (i_msg_size_opt, "receive wait failed");
 
6047
             int iproc = recv_status[i_recv].source();
 
6048
             check_macro (iproc >= 0, "receive: source iproc = "<<iproc<<" < 0 !");
 
6049
             // get size of receive and number in data
 
6050
             size_type i_msg_size = (size_type)i_msg_size_opt.get();
 
6051
             size_type i_start = i_recv*receive_max_size;
 
6052
             for (size_type j = i_start; j < i_start + i_msg_size; j++) {
 
6053
                 x (receive.data[j]);
 
6054
             }
 
6055
         }
 
6056
     #endif // _RHEOLEF_BUG_FOR_NON_MPI_DATA_TYPE
 
6057
         // -----------------------------------------------------------------
 
6058
         // 2) wait on sends
 
6059
         // -----------------------------------------------------------------
 
6060
         request_iterator iter_s_waits (send.waits.begin(), select2nd<size_type,mpi::request>()),
 
6061
                          last_s_waits (send.waits.end(),   select2nd<size_type,mpi::request>());
 
6062
         Size send_nproc = send.waits.size();
 
6063
         std::vector<mpi::status> send_status(send_nproc);
 
6064
         mpi::wait_all (iter_s_waits, last_s_waits, send_status.begin());
 
6065
         // -----------------------------------------------------------------
 
6066
         // 3) clear send & receive messages [waits,data]
 
6067
         // -----------------------------------------------------------------
 
6068
         send.waits.clear();
 
6069
         send.data.clear();
 
6070
         receive.waits.clear();
 
6071
         receive.data.clear();
 
6072
         return x.n_new_entry();
 
6073
     }
 
6074
 
 
6075
 
 
6076
File: rheolef.info,  Node: mpi_scatter_begin algorithm,  Up: Algorithms
 
6077
 
 
6078
6.8 mpi_scatter_begin - gather/scatter initialize
 
6079
=================================================
 
6080
 
 
6081
(Source file: `skit/plib2/mpi_scatter_begin.h')
 
6082
 
 
6083
Description
 
6084
-----------
 
6085
 
 
6086
Begin communication   for distributed to sequential scatter context.
 
6087
 
 
6088
Complexity
 
6089
----------
 
6090
 
 
6091
Implementation
 
6092
--------------
 
6093
 
 
6094
Even though the next routines are written with distributed   vectors,
 
6095
either x or y (but not both) may be sequential   vectors, one for each
 
6096
processor.
 
6097
 
 
6098
from indices indicate where arriving stuff is stashed      to   indices
 
6099
indicate where departing stuff came from.       the naming can be a
 
6100
little confusing.
 
6101
 
 
6102
Reverse scatter is obtained by swapping (to,from)  in calls to
 
6103
scatter_begin and scatter_end.   Reverse scatter is usefull for
 
6104
transpose matrix-vector multiply.
 
6105
 
 
6106
Scatter general operation is handled by a template "SetOp" type.   The
 
6107
special case "SetOp=set_op" of an affectation is treated  separatly,
 
6108
tacking care of local scatter affectation.   Thus, the
 
6109
"mpi_scatter_begin" routine is splitted into
 
6110
"msg_scatter_begin_global" and "msg_scatter_begin_local"  parts.
 
6111
 
 
6112
Implementation
 
6113
--------------
 
6114
 
 
6115
     template <
 
6116
         class InputIterator,
 
6117
         class Message,
 
6118
         class Tag,
 
6119
         class Comm>
 
6120
     void
 
6121
     mpi_scatter_begin_global (
 
6122
         InputIterator                       x,
 
6123
         Message&                            from,
 
6124
         Message&                            to,
 
6125
         Tag                                 tag,
 
6126
         Comm                                comm)
 
6127
     {
 
6128
         typedef typename Message::size_type        size_type;
 
6129
         // ----------------------------------------------------------
 
6130
         // 1) post receives
 
6131
         // ----------------------------------------------------------
 
6132
         from.requests.clear();
 
6133
         {
 
6134
           size_type n_receive = from.starts().size() - 1;
 
6135
           size_type i_start = 0;
 
6136
           for (size_type i = 0; i < n_receive; i++) {
 
6137
             size_type i_size = from.starts() [i+1] - from.starts() [i];
 
6138
             mpi::request i_req = comm.irecv(
 
6139
                 from.procs() [i],
 
6140
                 tag,
 
6141
                 from.values().begin().operator->() + i_start,
 
6142
                 i_size);
 
6143
             i_start += i_size;
 
6144
             from.requests.push_back (std::make_pair(i, i_req));
 
6145
           }
 
6146
         } // end block
 
6147
         // ----------------------------------------------------------
 
6148
         // 2) apply right permutation
 
6149
         // ----------------------------------------------------------
 
6150
         to.load_values (x);
 
6151
 
 
6152
         // ----------------------------------------------------------
 
6153
         // 3) do sends
 
6154
         // ----------------------------------------------------------
 
6155
         to.requests.clear();
 
6156
         {
 
6157
           size_type n_send = to.starts().size() - 1;
 
6158
           size_type i_start = 0;
 
6159
           for (size_type i = 0; i < n_send; i++) {
 
6160
             size_type i_size = to.starts() [i+1] - to.starts() [i];
 
6161
             mpi::request i_req = comm.isend(
 
6162
                 to.procs() [i],
 
6163
                 tag,
 
6164
                 to.values().begin().operator->() + i_start,
 
6165
                 i_size);
 
6166
             i_start += i_size;
 
6167
             to.requests.push_back (std::make_pair(i, i_req));
 
6168
           }
 
6169
         } // end block
 
6170
     }
 
6171
     template <
 
6172
         class InputIterator,
 
6173
         class OutputIterator,
 
6174
         class SetOp,
 
6175
         class Message>
 
6176
     void
 
6177
     mpi_scatter_begin_local (
 
6178
         InputIterator                       x,
 
6179
         OutputIterator                      y,
 
6180
         Message&                            from,
 
6181
         Message&                            to,
 
6182
         SetOp                               op)
 
6183
     {
 
6184
     #ifdef TO_CLEAN
 
6185
         msg_both_permutation_apply (
 
6186
             to.local_slots.begin(),
 
6187
             to.local_slots.end(),
 
6188
             x,
 
6189
             op,
 
6190
             from.local_slots.begin(),
 
6191
             y);
 
6192
     #endif // TO_CLEAN
 
6193
     }
 
6194
     // take care of local insert: template specialisation
 
6195
     template <
 
6196
         class InputIterator,
 
6197
         class OutputIterator,
 
6198
         class Message>
 
6199
     void
 
6200
     mpi_scatter_begin_local (
 
6201
         InputIterator                       x,
 
6202
         OutputIterator                      y,
 
6203
         Message&                            from,
 
6204
         Message&                            to,
 
6205
         set_op<typename Message::value_type, typename Message::value_type> op)
 
6206
     {
 
6207
     #ifdef TO_CLEAN
 
6208
         // used when x & y have distinct pointer types (multi-valued)
 
6209
         if (y == x && ! to.local_nonmatching_computed) {
 
6210
             // scatter_local_optimize(to,from);
 
6211
             fatal_macro ("y == x: adress matches in scatter: not yet -- sorry");
 
6212
         }
 
6213
         if (to.local_is_copy) {
 
6214
 
 
6215
             std::copy(x + to.local_copy_start,
 
6216
                       x + to.local_copy_start + to.local_copy_length,
 
6217
                       y + from.local_copy_start);
 
6218
 
 
6219
         } else if (y != x || ! to.local_nonmatching_computed) {
 
6220
 
 
6221
             msg_both_permutation_apply (
 
6222
                 to.local_slots.begin(),
 
6223
                 to.local_slots.end(),
 
6224
                 x,
 
6225
                 op,
 
6226
                 from.local_slots.begin(),
 
6227
                 y);
 
6228
 
 
6229
         } else { // !to.local_is_copy && y == x && to.local_nonmatching_computed
 
6230
 
 
6231
             msg_both_permutation_apply (
 
6232
                 to.local_slots_nonmatching.begin(),
 
6233
                 to.local_slots_nonmatching.end(),
 
6234
                 x,
 
6235
                 op,
 
6236
                 from.local_slots_nonmatching.begin(),
 
6237
                 y);
 
6238
         }
 
6239
     #endif // TO_CLEAN
 
6240
     }
 
6241
     template <
 
6242
         class InputIterator,
 
6243
         class OutputIterator,
 
6244
         class Message,
 
6245
         class SetOp,
 
6246
         class Tag,
 
6247
         class Comm>
 
6248
     inline
 
6249
     void
 
6250
     mpi_scatter_begin(
 
6251
         InputIterator                       x,
 
6252
         OutputIterator                      y,
 
6253
         Message&                            from,
 
6254
         Message&                            to,
 
6255
         SetOp                               op,
 
6256
         Tag                                 tag,
 
6257
         Comm                                comm)
 
6258
     {
 
6259
         mpi_scatter_begin_global (x, from, to, tag, comm);
 
6260
         if (to.n_local() == 0) {
 
6261
             return;
 
6262
         }
 
6263
         error_macro ("local messages: no more supported");
 
6264
         mpi_scatter_begin_local  (x, y, from, to, op);
 
6265
     }
 
6266
 
 
6267
 
 
6268
File: rheolef.info,  Node: msg_from_context_pattern algorithm,  Up: Algorithms
 
6269
 
 
6270
6.9 msg_from_context - gather
 
6271
=============================
 
6272
 
 
6273
(Source file: `skit/plib2/msg_from_context_pattern.h')
 
6274
 
 
6275
Description
 
6276
-----------
 
6277
 
 
6278
Computes the receive compressed message pattern for gather   and
 
6279
scatter.
 
6280
 
 
6281
Algorithm
 
6282
---------
 
6283
 
 
6284
msg_from_context_pattern
 
6285
 
 
6286
"input": the ownership distribution and the indexes arrays   |
 
6287
msg_size(0:nproc)   "output": the receive context (from) and an
 
6288
auxilliary array proc2from_proc   |   from_proc(0:send_nproc-1),
 
6289
from_ptr(0:send_nproc),   |   proc2from_proc(0:nproc-1)   begin   |
 
6290
i := 0   |     from_ptr(0) := 0   |     for iproc := 0 to nproc-1 do
 
6291
|       if msg_size(iproc) <> 0 then   |         from_proc(i) := iproc
 
6292
|         from_ptr(i+1) := from_ptr(i) + msg_size(i)   |
 
6293
proc2from_proc(iproc) := i   |         i := i+1   |       endif   |
 
6294
endfor   end
 
6295
 
 
6296
Note
 
6297
----
 
6298
 
 
6299
At the end of the algorithm, we have i = send_nproc.
 
6300
 
 
6301
Complexity
 
6302
----------
 
6303
 
 
6304
Complexity is O(nproc).
 
6305
 
 
6306
Implementation
 
6307
--------------
 
6308
 
 
6309
     template <
 
6310
         class InputIterator1,
 
6311
         class OutputIterator1,
 
6312
         class OutputIterator2,
 
6313
         class OutputIterator3>
 
6314
     void
 
6315
     msg_from_context_pattern (
 
6316
         InputIterator1              msg_size,               // nproc
 
6317
         InputIterator1              last_msg_size,
 
6318
         OutputIterator1             from_proc,              // send_nproc
 
6319
         OutputIterator2             from_ptr,               // send_nproc+1
 
6320
         OutputIterator3             proc2from_proc)         // nproc
 
6321
     {
 
6322
         typedef typename std::iterator_traits<InputIterator1>::value_type Size;
 
6323
         Size iproc = 0;
 
6324
         Size i = 0;
 
6325
         Size ptr_val = 0;
 
6326
         (*from_ptr++) = ptr_val;
 
6327
         while (msg_size != last_msg_size) {
 
6328
             Size sz = (*msg_size++);
 
6329
             if (sz != 0) {
 
6330
                 (*from_proc++) = iproc;
 
6331
                 ptr_val += sz;
 
6332
                 (*from_ptr++) = ptr_val;
 
6333
                 (*proc2from_proc) = i;
 
6334
                 i++;
 
6335
             }
 
6336
             proc2from_proc++;
 
6337
             iproc++;
 
6338
         }
 
6339
     }
 
6340
 
 
6341
 
 
6342
File: rheolef.info,  Node: mpi_scatter_init algorithm,  Up: Algorithms
 
6343
 
 
6344
6.10 mpi_scatter_init - gather/scatter initialize
 
6345
=================================================
 
6346
 
 
6347
(Source file: `skit/plib2/mpi_scatter_init.h')
 
6348
 
 
6349
Description
 
6350
-----------
 
6351
 
 
6352
Initialize communication   for distributed to sequential scatter
 
6353
context.
 
6354
 
 
6355
Complexity
 
6356
----------
 
6357
 
 
6358
Time and memory complexity is O(nidx+nproc).    For finite-element
 
6359
problems in d dimenion
 
6360
 
 
6361
|   nidx ~ N^((d-1)/d)
 
6362
 
 
6363
where N is the number of degrees of freedom.
 
6364
 
 
6365
IMPLEMENTATION   Inspirated from petsc-2.0/vpscat.c:
 
6366
VecScatterCreate_PtoS()
 
6367
 
 
6368
Implementation
 
6369
--------------
 
6370
 
 
6371
     template <class Message, class Size, class SizeRandomIterator1, class SizeRandomIterator2, class Tag>
 
6372
     void
 
6373
     mpi_scatter_init (
 
6374
     // input:
 
6375
         Size                nidx,
 
6376
         SizeRandomIterator1 idx,
 
6377
         Size                nidy,
 
6378
         SizeRandomIterator1 idy,
 
6379
         Size                idy_maxval,
 
6380
         SizeRandomIterator2 ownership,
 
6381
         Tag                 tag,
 
6382
         const distributor::communicator_type& comm,
 
6383
     // output:
 
6384
         Message&    from,
 
6385
         Message&    to)
 
6386
     {
 
6387
         typedef Size size_type;
 
6388
         size_type  my_proc = comm.rank();
 
6389
         size_type  nproc   = comm.size();
 
6390
 
 
6391
         // -------------------------------------------------------
 
6392
         // 1) first count number of contributors to each processor
 
6393
         // -------------------------------------------------------
 
6394
         std::vector<size_type> msg_size(nproc, 0);
 
6395
         std::vector<size_type> msg_mark(nproc, 0);
 
6396
         std::vector<size_type> owner   (nidx);
 
6397
         size_type send_nproc = 0;
 
6398
         {
 
6399
           size_type iproc = 0;
 
6400
           for (size_type i = 0; i < nidx; i++) {
 
6401
             for (; iproc < nproc; iproc++) {
 
6402
               if (idx[i] >= ownership[iproc] && idx[i] < ownership[iproc+1]) {
 
6403
                 owner[i] = iproc;
 
6404
                 msg_size [iproc]++;
 
6405
                 if (!msg_mark[iproc]) {
 
6406
                    msg_mark[iproc] = 1;
 
6407
                    send_nproc++;
 
6408
                 }
 
6409
                 break;
 
6410
               }
 
6411
             }
 
6412
             check_macro (iproc != nproc, "bad stash data: idx["<<i<<"]="<<idx[i]<<" out of range [0:"<<ownership[nproc]<<"[");
 
6413
           }
 
6414
         } // end block
 
6415
         // -------------------------------------------------------
 
6416
         // 2) avoid to send message to my-proc in counting
 
6417
         // -------------------------------------------------------
 
6418
         size_type n_local  = msg_size[my_proc];
 
6419
         if (n_local != 0) {
 
6420
             msg_size [my_proc] = 0;
 
6421
             msg_mark [my_proc] = 0;
 
6422
             send_nproc--;
 
6423
         }
 
6424
         // ----------------------------------------------------------------
 
6425
         // 3) compute number of messages to be send to my_proc
 
6426
         // ----------------------------------------------------------------
 
6427
         std::vector<size_type> work(nproc);
 
6428
         mpi::all_reduce (
 
6429
             comm,
 
6430
             msg_mark.begin().operator->(),
 
6431
             nproc,
 
6432
             work.begin().operator->(),
 
6433
             std::plus<size_type>());
 
6434
         size_type receive_nproc = work [my_proc];
 
6435
         // ----------------------------------------------------------------
 
6436
         // 4) compute messages max size to be send to my_proc
 
6437
         // ----------------------------------------------------------------
 
6438
         mpi::all_reduce (
 
6439
             comm,
 
6440
             msg_size.begin().operator->(),
 
6441
             nproc,
 
6442
             work.begin().operator->(),
 
6443
             mpi::maximum<size_type>());
 
6444
         size_type receive_max_size = work [my_proc];
 
6445
         // ----------------------------------------------------------------
 
6446
         // 5) post receive: exchange the buffer adresses between processes
 
6447
         // ----------------------------------------------------------------
 
6448
         std::list<std::pair<size_type,mpi::request> >   receive_waits;
 
6449
         std::vector<size_type>                          receive_data (receive_nproc*receive_max_size);
 
6450
         for (size_type i_receive = 0; i_receive < receive_nproc; i_receive++) {
 
6451
           mpi::request i_req = comm.irecv (
 
6452
               mpi::any_source,
 
6453
               tag,
 
6454
               receive_data.begin().operator->() + i_receive*receive_max_size,
 
6455
               receive_max_size);
 
6456
           receive_waits.push_back (std::make_pair(i_receive, i_req));
 
6457
         }
 
6458
         // ---------------------------------------------------------------------------
 
6459
         // 6) compute the send indexes
 
6460
         // ---------------------------------------------------------------------------
 
6461
         // comme idx est trie, on peut faire une copie de idx dans send_data
 
6462
         // et du coup owner et send_data_ownership sont inutiles
 
6463
         std::vector<size_type> send_data (nidx);
 
6464
         std::copy (idx, idx+nidx, send_data.begin());
 
6465
         // ---------------------------------------------------------------------------
 
6466
         // 7) do send
 
6467
         // ---------------------------------------------------------------------------
 
6468
         std::list<std::pair<size_type,mpi::request> > send_waits;
 
6469
         {
 
6470
           size_type i_send = 0;
 
6471
           size_type i_start = 0;
 
6472
           for (size_type iproc = 0; iproc < nproc; iproc++) {
 
6473
             size_type i_msg_size = msg_size[iproc];
 
6474
             if (i_msg_size == 0) continue;
 
6475
             mpi::request i_req = comm.isend (
 
6476
                 iproc,
 
6477
                 tag,
 
6478
                 send_data.begin().operator->() + i_start,
 
6479
                 i_msg_size);
 
6480
             send_waits.push_back(std::make_pair(i_send,i_req));
 
6481
             i_send++;
 
6482
             i_start += i_msg_size;
 
6483
           }
 
6484
         } // end block
 
6485
         // ---------------------------------------------------------------------------
 
6486
         // 8) wait on receives
 
6487
         // ---------------------------------------------------------------------------
 
6488
         // note: for wait_all, build an iterator adapter that scan the pair.second in [index,request]
 
6489
         // and then get an iterator in the pair using iter.base(): retrive the corresponding index
 
6490
         // for computing the position in the receive.data buffer
 
6491
         typedef boost::transform_iterator<select2nd<size_t,mpi::request>, std::list<std::pair<size_t,mpi::request> >::iterator>
 
6492
                 request_iterator;
 
6493
         std::vector<size_type> receive_size (receive_nproc);
 
6494
         std::vector<size_type> receive_proc (receive_nproc);
 
6495
         size_type receive_total_size = 0;
 
6496
         while (receive_waits.size() != 0) {
 
6497
             typedef size_type data_type; // exchanged data is of "size_type"
 
6498
             request_iterator iter_r_waits (receive_waits.begin(), select2nd<size_t,mpi::request>()),
 
6499
                              last_r_waits (receive_waits.end(),   select2nd<size_t,mpi::request>());
 
6500
             // waits on any receive...
 
6501
             std::pair<mpi::status,request_iterator> pair_status = mpi::wait_any (iter_r_waits, last_r_waits);
 
6502
             // check status
 
6503
             boost::optional<int> i_msg_size_opt = pair_status.first.count<data_type>();
 
6504
             check_macro (i_msg_size_opt, "receive wait failed");
 
6505
             int iproc = pair_status.first.source();
 
6506
             check_macro (iproc >= 0, "receive: source iproc = "<<iproc<<" < 0 !");
 
6507
             // get size of receive and number in data
 
6508
             size_type i_msg_size = (size_t)i_msg_size_opt.get();
 
6509
             std::list<std::pair<size_t,mpi::request> >::iterator i_pair_ptr = pair_status.second.base();
 
6510
             size_type i_receive = (*i_pair_ptr).first;
 
6511
             receive_proc [i_receive] = iproc;
 
6512
             receive_size [i_receive] = i_msg_size;
 
6513
             receive_total_size += i_msg_size;
 
6514
             receive_waits.erase (i_pair_ptr);
 
6515
         }
 
6516
         // ---------------------------------------------------------------------------
 
6517
         // 9) allocate the entire send(to) scatter context
 
6518
         // ---------------------------------------------------------------------------
 
6519
         to.resize (receive_total_size, receive_nproc);
 
6520
 
 
6521
         // ---------------------------------------------------------------------------
 
6522
         // 10) compute the permutation of values that gives the sorted source[] sequence
 
6523
         // ---------------------------------------------------------------------------
 
6524
         // init: perm[i] = i
 
6525
         std::vector<size_type> perm(receive_nproc);
 
6526
         copy(index_iterator<size_type>(), index_iterator<size_type>(receive_nproc), perm.begin());
 
6527
         sort_with_permutation (
 
6528
             receive_nproc,
 
6529
             receive_proc.begin().operator->(),
 
6530
             perm.begin().operator->());
 
6531
         // ---------------------------------------------------------------------------
 
6532
         // 11) Computes the receive compresed message pattern for send(to)
 
6533
         // ---------------------------------------------------------------------------
 
6534
         size_type istart = ownership[my_proc]; // = ownership.first_index()
 
6535
         msg_to_context (
 
6536
             perm.begin(),
 
6537
             perm.end(),
 
6538
             receive_proc.begin(),
 
6539
             receive_size.begin(),
 
6540
             receive_data.begin(),
 
6541
             receive_max_size,
 
6542
             istart,
 
6543
             to.procs().begin(),
 
6544
             to.starts().begin(),
 
6545
             to.indices().begin());
 
6546
         // ---------------------------------------------------------------------------
 
6547
         // 12) allocate the entire receive(from) scatter context
 
6548
         // ---------------------------------------------------------------------------
 
6549
         from.resize(nidy, send_nproc);
 
6550
         // ---------------------------------------------------------------------------
 
6551
         // 13) Computes the receive compresed message pattern for receive(from)
 
6552
         // ---------------------------------------------------------------------------
 
6553
         std::vector<size_type> proc2from_proc(nproc);
 
6554
         msg_from_context_pattern (
 
6555
             msg_size.begin(),
 
6556
             msg_size.end(),
 
6557
             from.procs().begin(),
 
6558
             from.starts().begin(),
 
6559
             proc2from_proc.begin());
 
6560
         // ---------------------------------------------------------------------------
 
6561
         // 14) Computes the receive compresed message indices for receive(from)
 
6562
         // ---------------------------------------------------------------------------
 
6563
         // assume that indices are sorted by increasing order
 
6564
         std::vector<size_type> start(send_nproc+1);
 
6565
         copy (from.starts().begin(), from.starts().end(), start.begin());
 
6566
         msg_from_context_indices (
 
6567
             owner.begin(),
 
6568
             owner.end(),
 
6569
             idy,
 
6570
             proc2from_proc.begin(),
 
6571
             my_proc,
 
6572
             idy_maxval,
 
6573
             start.begin(),
 
6574
             from.indices().begin());
 
6575
         // ---------------------------------------------------------------------------
 
6576
         // 15) wait on sends
 
6577
         // ---------------------------------------------------------------------------
 
6578
         request_iterator iter_s_waits (send_waits.begin(), select2nd<size_type,mpi::request>()),
 
6579
                          last_s_waits (send_waits.end(),   select2nd<size_type,mpi::request>());
 
6580
         mpi::wait_all (iter_s_waits, last_s_waits);
 
6581
         // ---------------------------------------------------------------------------
 
6582
         // 16) Computes the receive compresed message local pattern,
 
6583
         // i.e. the only part that does not requires communication.
 
6584
         // ---------------------------------------------------------------------------
 
6585
         from.local_slots.resize(n_local);
 
6586
         to.local_slots.resize(n_local);
 
6587
         size_type ilast = ownership[my_proc+1]; // = ownership.last_index()
 
6588
         msg_local_context (
 
6589
             idx,
 
6590
             idx+nidx,
 
6591
             idy,
 
6592
             idy_maxval,
 
6593
             istart,
 
6594
             ilast,
 
6595
             to.local_slots.begin(),
 
6596
             to.local_slots.end(),
 
6597
             from.local_slots.begin());
 
6598
         // ---------------------------------------------------------------------------
 
6599
         // 17) Optimize local exchanges during gatter/scatter
 
6600
         // ---------------------------------------------------------------------------
 
6601
         bool has_opt = msg_local_optimize (
 
6602
             to.local_slots.begin(),
 
6603
             to.local_slots.end(),
 
6604
             from.local_slots.begin());
 
6605
 
 
6606
         if (has_opt && n_local != 0) {
 
6607
             to.local_is_copy       = true;
 
6608
             to.local_copy_start    = to.local_slots[0];
 
6609
             to.local_copy_length   = n_local;
 
6610
             from.local_is_copy     = true;
 
6611
             from.local_copy_start  = from.local_slots[0];
 
6612
             from.local_copy_length = n_local;
 
6613
         }
 
6614
     }
 
6615
 
 
6616
 
 
6617
File: rheolef.info,  Node: msg_both_permutation_apply algorithm,  Up: Algorithms
 
6618
 
 
6619
6.11 msg_both_permutation_apply - sequentail apply
 
6620
==================================================
 
6621
 
 
6622
(Source file: `skit/plib2/msg_both_permutation_apply.h')
 
6623
 
 
6624
Description
 
6625
-----------
 
6626
 
 
6627
Applies permutations when copying an array.
 
6628
 
 
6629
Algorithm
 
6630
---------
 
6631
 
 
6632
msg_both_permutation_apply
 
6633
 
 
6634
"input": the length array   |   px(0:n-1), x(0:nx-1), py(0:n-1)
 
6635
"output": the pointer array and the total size   |   y(0:ny)   begin
 
6636
|   for i := 0 to n-1 do   |     y(py(i)) := x(px(i))   |   endfor   end
 
6637
 
 
6638
Complexity
 
6639
----------
 
6640
 
 
6641
Time and memory complexity is O(n).
 
6642
 
 
6643
Implementation
 
6644
--------------
 
6645
 
 
6646
     template <
 
6647
         class InputIterator1,
 
6648
         class InputIterator2,
 
6649
         class InputRandomIterator,
 
6650
         class SetOp,
 
6651
         class OutputRandomIterator>
 
6652
     void
 
6653
     msg_both_permutation_apply (
 
6654
         InputIterator1              px,
 
6655
         InputIterator1              last_px,
 
6656
         InputRandomIterator         x,
 
6657
         SetOp                       set_op,
 
6658
         InputIterator2              py,
 
6659
         OutputRandomIterator        y)
 
6660
     {
 
6661
         while (px != last_px)
 
6662
             set_op(y[*py++], x[*px++]);
 
6663
     }
 
6664
     } // namespace rheolef
 
6665
 
 
6666
 
 
6667
File: rheolef.info,  Node: mpi_assembly_begin algorithm,  Up: Algorithms
 
6668
 
 
6669
6.12 mpi_assembly_begin - for array or matrix
5022
6670
=============================================
5023
6671
 
5024
 
(Source file: `skit/lib/pminres.h') 
5025
 
 
5026
 
Synopsis
5027
 
--------
5028
 
 
5029
 
         template <class Matrix, class Vector, class Preconditioner, class Real>
5030
 
         int pminres (const Matrix &A, Vector &x, const Vector &b, const Preconditioner &M,
5031
 
           int &max_iter, Real &tol, std::ostream *p_cerr=0);
5032
 
 
5033
 
Example
5034
 
-------
5035
 
 
5036
 
The simplest call to 'pminres' has the folling form:
5037
 
         size_t max_iter = 100;
5038
 
         double tol = 1e-7;
5039
 
         int status = pminres(a, x, b, EYE, max_iter, tol, &cerr);
5040
 
 
5041
 
Description
5042
 
-----------
5043
 
 
5044
 
`pminres' solves the symmetric positive definite linear   system Ax=b
5045
 
using the Conjugate Gradient method.
5046
 
 
5047
 
The return value indicates convergence within max_iter (input)
5048
 
iterations (0), or no convergence within max_iter iterations (1).
5049
 
Upon successful return, output arguments have the following values:
5050
 
`x'
5051
 
     approximate solution to Ax = b
5052
 
 
5053
 
`max_iter'
5054
 
     the number of iterations performed before the tolerance was reached
5055
 
 
5056
 
`tol'
5057
 
     the residual after the final iteration
5058
 
 
5059
 
Note
5060
 
----
5061
 
 
5062
 
`pminres' follows the algorithm described in   "Solution of sparse
5063
 
indefinite systems of linear equations", C. C. Paige   and M. A.
5064
 
Saunders, SIAM J. Numer. Anal., 12(4), 1975.    For more, see
5065
 
http://www.stanford.edu/group/SOL/software.html and also the   PhD
5066
 
"Iterative methods for singular linear equations and least-squares
5067
 
problems",   S.-C. T. Choi, Stanford University, 2006,
5068
 
http://www.stanford.edu/group/SOL/dissertations/sou-cheng-choi-thesis.pdf
5069
 
at page 60.    The present implementation style is inspired from `IML++
5070
 
1.2' iterative method library,   `http://math.nist.gov/iml++'.
5071
 
 
5072
 
Implementation
5073
 
--------------
5074
 
 
5075
 
     template <class Matrix, class Vector, class Preconditioner, class Real, class Size>
5076
 
     int pminres(const Matrix &A, Vector &x, const Vector &Mb, const Preconditioner &M,
5077
 
       Size &max_iter, Real &tol, std::ostream *p_cerr = 0, std::string label = "minres")
5078
 
     {
5079
 
       Vector b = M.solve(Mb);
5080
 
       Real norm_b = sqrt(fabs(dot(Mb,b)));
5081
 
       if (norm_b == Real(0.)) norm_b = 1;
5082
 
 
5083
 
       Vector Mr = Mb - A*x;
5084
 
       Vector z = M.solve(Mr);
5085
 
       Real beta2 = dot(Mr, z);
5086
 
       Real norm_r = sqrt(fabs(beta2));
5087
 
       if (p_cerr) (*p_cerr) << "[" << label << "] #iteration residue" << std::endl;
5088
 
       if (p_cerr) (*p_cerr) << "[" << label << "] 0 " << norm_r/norm_b << std::endl;
5089
 
       if (beta2 < 0 || norm_r <= tol*norm_b) {
5090
 
         tol = norm_r/norm_b;
5091
 
         max_iter = 0;
5092
 
         warning_macro ("beta2 = " << beta2 << " < 0: stop");
5093
 
         return 0;
5094
 
       }
5095
 
       Real beta = sqrt(beta2);
5096
 
       Real eta = beta;
5097
 
       Vector Mv = Mr/beta;
5098
 
       Vector  u =  z/beta;
5099
 
       Real c_old = 1.;
5100
 
       Real s_old = 0.;
5101
 
       Real c = 1.;
5102
 
       Real s = 0.;
5103
 
       Vector u_old  (x.size(), 0.);
5104
 
       Vector Mv_old (x.size(), 0.);
5105
 
       Vector w      (x.size(), 0.);
5106
 
       Vector w_old  (x.size(), 0.);
5107
 
       Vector w_old2 (x.size(), 0.);
5108
 
       for (Size n = 1; n <= max_iter; n++) {
5109
 
         // Lanczos
5110
 
         Mr = A*u;
5111
 
         z = M.solve(Mr);
5112
 
         Real alpha = dot(Mr, u);
5113
 
         Mr = Mr - alpha*Mv - beta*Mv_old;
5114
 
         z  =  z - alpha*u  - beta*u_old;
5115
 
         beta2 = dot(Mr, z);
5116
 
         if (beta2 < 0) {
5117
 
             warning_macro ("pminres: machine precision problem");
5118
 
             tol = norm_r/norm_b;
5119
 
             max_iter = n;
5120
 
             return 2;
5121
 
         }
5122
 
         Real beta_old = beta;
5123
 
         beta = sqrt(beta2);
5124
 
         // QR factorisation
5125
 
         Real c_old2 = c_old;
5126
 
         Real s_old2 = s_old;
5127
 
         c_old = c;
5128
 
         s_old = s;
5129
 
         Real rho0 = c_old*alpha - c_old2*s_old*beta_old;
5130
 
         Real rho2 = s_old*alpha + c_old2*c_old*beta_old;
5131
 
         Real rho1 = sqrt(sqr(rho0) + sqr(beta));
5132
 
         Real rho3 = s_old2 * beta_old;
5133
 
         // Givens rotation
5134
 
         c = rho0 / rho1;
5135
 
         s = beta / rho1;
5136
 
         // update
5137
 
         w_old2 = w_old;
5138
 
         w_old  = w;
5139
 
         w = (u - rho2*w_old - rho3*w_old2)/rho1;
5140
 
         x += c*eta*w;
5141
 
         eta = -s*eta;
5142
 
         Mv_old = Mv;
5143
 
          u_old = u;
5144
 
         Mv = Mr/beta;
5145
 
          u =  z/beta;
5146
 
         // check residue
5147
 
         norm_r *= s;
5148
 
         if (p_cerr) (*p_cerr) << "[" << label << "] " << n << " " << norm_r/norm_b << std::endl;
5149
 
         if (norm_r <= tol*norm_b) {
5150
 
           tol = norm_r/norm_b;
5151
 
           max_iter = n;
5152
 
           return 0;
5153
 
         }
5154
 
       }
5155
 
       tol = norm_r/norm_b;
5156
 
       return 1;
5157
 
     }
5158
 
 
5159
 
 
5160
 
File: rheolef.info,  Node: qmr algorithm,  Up: Algorithms
5161
 
 
5162
 
6.6 `qmr' - quasi-minimal residual algoritm
5163
 
===========================================
5164
 
 
5165
 
(Source file: `skit/lib/qmr.h') 
5166
 
 
5167
 
Synopsis
5168
 
--------
5169
 
 
5170
 
             template <class Matrix, class Vector, class Preconditioner1,
5171
 
                 class Preconditioner2, class Real>
5172
 
             int qmr (const Matrix &A, Vector &x, const Vector &b,
5173
 
                 const Preconditioner1 &M1, const Preconditioner2 &M2,
5174
 
                 int &max_iter, Real &tol);
5175
 
 
5176
 
Example
5177
 
-------
5178
 
 
5179
 
The simplest call to 'qmr' has the folling form:
5180
 
             int status = qmr(a, x, b, EYE, EYE, 100, 1e-7);
5181
 
 
5182
 
Description
5183
 
-----------
5184
 
 
5185
 
`qmr' solves the unsymmetric linear system Ax = b   using the the
5186
 
quasi-minimal residual method.
5187
 
 
5188
 
The return value indicates convergence within max_iter (input)
5189
 
iterations (0), or no convergence within max_iter iterations (1).
5190
 
Upon successful return, output arguments have the following values:
5191
 
`x'
5192
 
     approximate solution to Ax = b
5193
 
 
5194
 
`max_iter'
5195
 
     the number of iterations performed before the tolerance was reached
5196
 
 
5197
 
`tol'
5198
 
     the residual after the final iteration
5199
 
 
5200
 
A return value of 1 indicates that the method did not reach the
5201
 
specified convergence tolerance in the maximum numbefr of iterations.
5202
 
A return value of 2 indicates that a breackdown associated with `rho'
5203
 
occurred.    A return value of 3 indicates that a breackdown associated
5204
 
with `beta' occurred.    A return value of 4 indicates that a
5205
 
breackdown associated with `gamma' occurred.    A return value of 5
5206
 
indicates that a breackdown associated with `delta' occurred.    A
5207
 
return value of 6 indicates that a breackdown associated with `epsilon'
5208
 
occurred.    A return value of 7 indicates that a breackdown associated
5209
 
with `xi' occurred.
5210
 
 
5211
 
Note
5212
 
----
5213
 
 
5214
 
`qmr' is an iterative template routine.
5215
 
 
5216
 
`qmr' follows the algorithm described on p. 24 in
5217
 
 
5218
 
             Templates for the Solution of Linear Systems: Building
5219
 
     Blocks for Iterative Methods,         2nd Edition,         R.
5220
 
     Barrett, M. Berry, T. F. Chan, J. Demmel, J. Donato, J. Dongarra,
5221
 
     V. Eijkhout,         R. Pozo, C. Romine, H. Van der Vorst,
5222
 
     SIAM, 1994,         `ftp.netlib.org/templates/templates.ps'.
5223
 
 
5224
 
The present implementation is inspired from `IML++ 1.2' iterative
5225
 
method library,   `http://math.nist.gov/iml++'.
5226
 
 
5227
 
 
5228
 
File: rheolef.info,  Node: pcg algorithm,  Up: Algorithms
5229
 
 
5230
 
6.7 `pcg' - conjugate gradient algorithm.
5231
 
=========================================
5232
 
 
5233
 
(Source file: `skit/lib/pcg.h') 
5234
 
 
5235
 
Synopsis
5236
 
--------
5237
 
 
5238
 
         template <class Matrix, class Vector, class Preconditioner, class Real>
5239
 
         int pcg (const Matrix &A, Vector &x, const Vector &b,
5240
 
           const Preconditioner &M, int &max_iter, Real &tol, std::ostream *p_cerr=0);
5241
 
 
5242
 
Example
5243
 
-------
5244
 
 
5245
 
The simplest call to 'pcg' has the folling form:
5246
 
         size_t max_iter = 100;
5247
 
         double tol = 1e-7;
5248
 
         int status = pcg(a, x, b, EYE, max_iter, tol, &cerr);
5249
 
 
5250
 
Description
5251
 
-----------
5252
 
 
5253
 
`pcg' solves the symmetric positive definite linear   system Ax=b using
5254
 
the Conjugate Gradient method.
5255
 
 
5256
 
The return value indicates convergence within max_iter (input)
5257
 
iterations (0), or no convergence within max_iter iterations (1).
5258
 
Upon successful return, output arguments have the following values:
5259
 
`x'
5260
 
     approximate solution to Ax = b
5261
 
 
5262
 
`max_iter'
5263
 
     the number of iterations performed before the tolerance was reached
5264
 
 
5265
 
`tol'
5266
 
     the residual after the final iteration
5267
 
 
5268
 
Note
5269
 
----
5270
 
 
5271
 
`pcg' is an iterative template routine.
5272
 
 
5273
 
`pcg' follows the algorithm described on p. 15 in
5274
 
 
5275
 
             Templates for the Solution of Linear Systems: Building
5276
 
     Blocks for Iterative Methods,         2nd Edition,         R.
5277
 
     Barrett, M. Berry, T. F. Chan, J. Demmel, J. Donato, J. Dongarra,
5278
 
     V. Eijkhout,         R. Pozo, C. Romine, H. Van der Vorst,
5279
 
     SIAM, 1994,         `ftp.netlib.org/templates/templates.ps'.
5280
 
 
5281
 
The present implementation is inspired from   `IML++ 1.2' iterative
5282
 
method library,   `http://math.nist.gov/iml++'.
5283
 
 
5284
 
Implementation
5285
 
--------------
5286
 
 
5287
 
     template < class Matrix, class Vector, class Preconditioner, class Real, class Size>
5288
 
     int pcg(const Matrix &A, Vector &x, const Vector &Mb, const Preconditioner &M,
5289
 
             Size &max_iter, Real &tol, std::ostream *p_cerr = 0, std::string label = "cg")
5290
 
     {
5291
 
         Vector b = M.solve(Mb);
5292
 
         Real norm2_b = dot(Mb,b);
5293
 
         if (norm2_b == Real(0)) norm2_b = 1;
5294
 
         Vector Mr = Mb - A*x;
5295
 
         Real  norm2_r = 0;
5296
 
         if (p_cerr) (*p_cerr) << "[" << label << "] #iteration residue" << std::endl;
5297
 
         Vector p;
5298
 
         for (Size n = 0; n <= max_iter; n++) {
5299
 
             Vector r = M.solve(Mr);
5300
 
             Real prev_norm2_r = norm2_r;
5301
 
             norm2_r = dot(Mr, r);
5302
 
             if (p_cerr) (*p_cerr) << "[" << label << "] " << n << " " << ::sqrt(norm2_r/norm2_b) << std::endl;
5303
 
             if (norm2_r <= sqr(tol)*norm2_b) {
5304
 
               tol = ::sqrt(norm2_r/norm2_b);
5305
 
               max_iter = n;
5306
 
               return 0;
5307
 
             }
5308
 
             if (n == 0) {
5309
 
               p = r;
5310
 
             } else {
5311
 
               Real beta = norm2_r/prev_norm2_r;
5312
 
               p = r + beta*p;
5313
 
             }
5314
 
             Vector Mq = A*p;
5315
 
             Real alpha = norm2_r/dot(Mq, p);
5316
 
             x  += alpha*p;
5317
 
             Mr -= alpha*Mq;
5318
 
         }
5319
 
         tol = ::sqrt(norm2_r/norm2_b);
5320
 
         return 1;
5321
 
     }
5322
 
 
5323
 
 
5324
 
File: rheolef.info,  Node: bicgstab algorithm,  Up: Algorithms
5325
 
 
5326
 
6.8 `bicgstab' - bi-conjugate gradient stabilized method
5327
 
========================================================
5328
 
 
5329
 
(Source file: `skit/lib/bicgstab.h') 
5330
 
 
5331
 
Synopsis
5332
 
--------
5333
 
 
5334
 
         int bicgstab (const Matrix &A, Vector &x, const Vector &b,
5335
 
                        const Preconditioner &M, int &max_iter, Real &tol);
5336
 
 
5337
 
Example
5338
 
-------
5339
 
 
5340
 
The simplest call to 'bicgstab' has the folling form:
5341
 
         int status = bicgstab(a, x, b, EYE, 100, 1e-7);
5342
 
 
5343
 
Description
5344
 
-----------
5345
 
 
5346
 
`bicgstab' solves the unsymmetric linear system Ax = b  using the
5347
 
preconditioned bi-conjugate gradient stabilized method
5348
 
 
5349
 
The return value indicates convergence within max_iter (input)
5350
 
iterations (0), or no convergence within max_iter iterations (1).
5351
 
Upon successful return, output arguments have the following values:
5352
 
`x'
5353
 
     approximate solution to Ax = b
5354
 
 
5355
 
`max_iter'
5356
 
     the number of iterations performed before the tolerance was reached
5357
 
 
5358
 
`tol'
5359
 
     the residual after the final iteration
5360
 
 
5361
 
Note
5362
 
----
5363
 
 
5364
 
`bicgstab' is an iterative template routine.
5365
 
 
5366
 
`bicgstab' follows the algorithm described on p. 24 in
5367
 
 
5368
 
             Templates for the Solution of Linear Systems: Building
5369
 
     Blocks for Iterative Methods,         2nd Edition,         R.
5370
 
     Barrett, M. Berry, T. F. Chan, J. Demmel, J. Donato, J. Dongarra,
5371
 
     V. Eijkhout,         R. Pozo, C. Romine, H. Van der Vorst,
5372
 
     SIAM, 1994,         `ftp.netlib.org/templates/templates.ps'.
5373
 
 
5374
 
The present implementation is inspired from `IML++ 1.2' iterative
5375
 
method library,   `http://math.nist.gov/iml++'.
5376
 
 
5377
 
 
5378
 
File: rheolef.info,  Node: puzawa algorithm,  Up: Algorithms
5379
 
 
5380
 
6.9 `puzawa' - Uzawa algorithm.
5381
 
===============================
5382
 
 
5383
 
(Source file: `skit/lib/puzawa.h') 
5384
 
 
5385
 
Synopsis
5386
 
--------
5387
 
 
5388
 
         template <class Matrix, class Vector, class Preconditioner, class Real>
5389
 
         int puzawa (const Matrix &A, Vector &x, const Vector &b, const Preconditioner &M,
5390
 
           int &max_iter, Real &tol, const Real& rho, std::ostream *p_cerr=0);
5391
 
 
5392
 
Example
5393
 
-------
5394
 
 
5395
 
The simplest call to 'puzawa' has the folling form:
5396
 
         size_t max_iter = 100;
5397
 
         double tol = 1e-7;
5398
 
         int status = puzawa(A, x, b, EYE, max_iter, tol, 1.0, &cerr);
5399
 
 
5400
 
Description
5401
 
-----------
5402
 
 
5403
 
`puzawa' solves the linear   system A*x=b using the Uzawa method. The
5404
 
Uzawa method is a   descent method in the direction opposite to the
5405
 
gradient,   with a constant step length 'rho'. The convergence is
5406
 
assured   when the step length 'rho' is small enough.    If matrix A is
5407
 
symmetric positive definite, please uses 'pcg' that   computes
5408
 
automatically the optimal descdnt step length at   each iteration.
5409
 
 
5410
 
The return value indicates convergence within max_iter (input)
5411
 
iterations (0), or no convergence within max_iter iterations (1).
5412
 
Upon successful return, output arguments have the following values:
5413
 
`x'
5414
 
     approximate solution to Ax = b
5415
 
 
5416
 
`max_iter'
5417
 
     the number of iterations performed before the tolerance was reached
5418
 
 
5419
 
`tol'
5420
 
     the residual after the final iteration
5421
 
 
5422
 
Implementation
5423
 
--------------
5424
 
 
5425
 
     template < class Matrix, class Vector, class Preconditioner, class Real, class Size>
5426
 
     int puzawa(const Matrix &A, Vector &x, const Vector &Mb, const Preconditioner &M,
5427
 
         Size &max_iter, Real &tol, const Real& rho,
5428
 
         std::ostream *p_cerr, std::string label)
5429
 
     {
5430
 
         Vector b = M.solve(Mb);
5431
 
         Real norm2_b = dot(Mb,b);
5432
 
         Real norm2_r = norm2_b;
5433
 
         if (norm2_b == Real(0)) norm2_b = 1;
5434
 
         if (p_cerr) (*p_cerr) << "[" << label << "] #iteration residue" << std::endl;
5435
 
         for (Size n = 0; n <= max_iter; n++) {
5436
 
             Vector Mr = A*x - Mb;
5437
 
             Vector r = M.solve(Mr);
5438
 
             norm2_r = dot(Mr, r);
5439
 
             if (p_cerr) (*p_cerr) << "[" << label << "] " << n << " " << sqrt(norm2_r/norm2_b) << std::endl;
5440
 
             if (norm2_r <= sqr(tol)*norm2_b) {
5441
 
               tol = sqrt(norm2_r/norm2_b);
5442
 
               max_iter = n;
5443
 
               return 0;
5444
 
             }
5445
 
             x  -= rho*r;
5446
 
         }
5447
 
         tol = sqrt(norm2_r/norm2_b);
5448
 
         return 1;
5449
 
     }
5450
 
 
5451
 
 
5452
 
File: rheolef.info,  Node: gmres algorithm,  Up: Algorithms
5453
 
 
5454
 
6.10 `gmres' - generalized minimum residual method
5455
 
==================================================
5456
 
 
5457
 
(Source file: `skit/lib/gmres.h') 
5458
 
 
5459
 
Synopsis
5460
 
--------
5461
 
 
5462
 
             template <class Operator, class Vector, class Preconditioner,
5463
 
                 class Matrix, class Real, class Int>
5464
 
             int gmres (const Operator &A, Vector &x, const Vector &b,
5465
 
                 const Preconditioner &M, Matrix &H, Int m, Int &max_iter, Real &tol);
5466
 
 
5467
 
Example
5468
 
-------
5469
 
 
5470
 
The simplest call to `gmres' has the folling form:
5471
 
             int m = 6;
5472
 
             dns H(m+1,m+1);
5473
 
             int status = gmres(a, x, b, EYE, H, m, 100, 1e-7);
5474
 
 
5475
 
Description
5476
 
-----------
5477
 
 
5478
 
`gmres' solves the unsymmetric linear system Ax = b   using the
5479
 
generalized minimum residual method.
5480
 
 
5481
 
The return value indicates convergence within max_iter (input)
5482
 
iterations (0), or no convergence within max_iter iterations (1).
5483
 
Upon successful return, output arguments have the following values:
5484
 
`x'
5485
 
     approximate solution to Ax = b
5486
 
 
5487
 
`max_iter'
5488
 
     the number of iterations performed before the tolerance was reached
5489
 
 
5490
 
`tol'
5491
 
     the residual after the final iteration
5492
 
  In addition, M specifies a preconditioner, H specifies a matrix   to
5493
 
hold the coefficients of the upper Hessenberg matrix constructed   by
5494
 
the `gmres' iterations, `m' specifies the number of iterations   for
5495
 
each restart.
5496
 
 
5497
 
`gmres' requires two matrices as input, A and H.    The matrix A, which
5498
 
will typically be a sparse matrix) corresponds   to the matrix in the
5499
 
linear system Ax=b.    The matrix H, which will be typically a dense
5500
 
matrix, corresponds   to the upper Hessenberg matrix H that is
5501
 
constructed during the   `gmres' iterations. Within `gmres', H is used
5502
 
in a different way   than A, so its class must supply different
5503
 
functionality.    That is, A is only accessed though its matrix-vector
5504
 
and   transpose-matrix-vector multiplication functions.    On the other
5505
 
hand, `gmres' solves a dense upper triangular linear   system of
5506
 
equations on H. Therefore, the class   to which H belongs must provide
5507
 
H(i,j) operator for element acess.
5508
 
 
5509
 
Note
5510
 
----
5511
 
 
5512
 
It is important to remember that we use the convention that indices
5513
 
are 0-based. That is H(0,0) is the first component of the   matrix H.
5514
 
Also, the type of the matrix must be compatible with the   type of
5515
 
single vector entry. That is, operations such as   H(i,j)*x(j) must be
5516
 
able to be carried out.
5517
 
 
5518
 
`gmres' is an iterative template routine.
5519
 
 
5520
 
`gmres' follows the algorithm described on p. 20 in
5521
 
 
5522
 
             Templates for the Solution of Linear Systems: Building
5523
 
     Blocks for Iterative Methods,         2nd Edition,         R.
5524
 
     Barrett, M. Berry, T. F. Chan, J. Demmel, J. Donato, J. Dongarra,
5525
 
     V. Eijkhout,         R. Pozo, C. Romine, H. Van der Vorst,
5526
 
     SIAM, 1994,         `ftp.netlib.org/templates/templates.ps'.
5527
 
 
5528
 
The present implementation is inspired from `IML++ 1.2' iterative
5529
 
method library,   `http://math.nist.gov/iml++'.
5530
 
 
5531
 
Implementation
5532
 
--------------
5533
 
 
5534
 
     template < class Matrix, class Vector, class Int >
5535
 
     void
5536
 
     Update(Vector &x, Int k, Matrix &h, Vector &s, Vector v[])
5537
 
     {
5538
 
       Vector y(s);
5539
 
 
5540
 
       // Backsolve:
5541
 
       for (Int i = k; i >= 0; i--) {
5542
 
         y(i) /= h(i,i);
5543
 
         for (Int j = i - 1; j >= 0; j--)
5544
 
           y(j) -= h(j,i) * y(i);
5545
 
       }
5546
 
 
5547
 
       for (Int j = 0; j <= k; j++)
5548
 
         x += v[j] * y(j);
5549
 
     }
5550
 
 
5551
 
     #ifdef TO_CLEAN
5552
 
     template < class Real >
5553
 
     Real
5554
 
     abs(Real x)
5555
 
     {
5556
 
       return (x > Real(0) ? x : -x);
5557
 
     }
5558
 
     #endif // TO_CLEAN
5559
 
 
5560
 
 
5561
 
     template < class Operator, class Vector, class Preconditioner,
5562
 
                class Matrix, class Real, class Int >
5563
 
     int
5564
 
     gmres(const Operator &A, Vector &x, const Vector &b,
5565
 
           const Preconditioner &M, Matrix &H, const Int &m, Int &max_iter,
5566
 
           Real &tol)
5567
 
     {
5568
 
       Real resid;
5569
 
       Int i, j = 1, k;
5570
 
       Vector s(m+1), cs(m+1), sn(m+1), w;
5571
 
 
5572
 
       Real normb = norm(M.solve(b));
5573
 
       Vector r = M.solve(b - A * x);
5574
 
       Real beta = norm(r);
5575
 
 
5576
 
       if (normb == Real(0))
5577
 
         normb = 1;
5578
 
 
5579
 
       if ((resid = norm(r) / normb) <= tol) {
5580
 
         tol = resid;
5581
 
         max_iter = 0;
5582
 
         return 0;
5583
 
       }
5584
 
 
5585
 
       Vector *v = new Vector[m+1];
5586
 
 
5587
 
       while (j <= max_iter) {
5588
 
         v[0] = r * (1.0 / beta);    // ??? r / beta
5589
 
         s = 0.0;
5590
 
         s(0) = beta;
5591
 
 
5592
 
         for (i = 0; i < m && j <= max_iter; i++, j++) {
5593
 
           w = M.solve(A * v[i]);
5594
 
           for (k = 0; k <= i; k++) {
5595
 
             H(k, i) = dot(w, v[k]);
5596
 
             w -= H(k, i) * v[k];
5597
 
           }
5598
 
           H(i+1, i) = norm(w);
5599
 
           v[i+1] = w * (1.0 / H(i+1, i)); // ??? w / H(i+1, i)
5600
 
 
5601
 
           for (k = 0; k < i; k++)
5602
 
             ApplyPlaneRotation(H(k,i), H(k+1,i), cs(k), sn(k));
5603
 
 
5604
 
           GeneratePlaneRotation(H(i,i), H(i+1,i), cs(i), sn(i));
5605
 
           ApplyPlaneRotation(H(i,i), H(i+1,i), cs(i), sn(i));
5606
 
           ApplyPlaneRotation(s(i), s(i+1), cs(i), sn(i));
5607
 
 
5608
 
           if ((resid = abs(s(i+1)) / normb) < tol) {
5609
 
             Update(x, i, H, s, v);
5610
 
             tol = resid;
5611
 
             max_iter = j;
5612
 
             delete [] v;
5613
 
             return 0;
5614
 
           }
5615
 
         }
5616
 
         Update(x, m - 1, H, s, v);
5617
 
         r = M.solve(b - A * x);
5618
 
         beta = norm(r);
5619
 
         if ((resid = beta / normb) < tol) {
5620
 
           tol = resid;
5621
 
           max_iter = j;
5622
 
           delete [] v;
5623
 
           return 0;
5624
 
         }
5625
 
       }
5626
 
 
5627
 
       tol = resid;
5628
 
       delete [] v;
5629
 
       return 1;
5630
 
     }
5631
 
     template<class Real>
5632
 
     void GeneratePlaneRotation(Real &dx, Real &dy, Real &cs, Real &sn)
5633
 
     {
5634
 
       if (dy == Real(0)) {
5635
 
         cs = 1.0;
5636
 
         sn = 0.0;
5637
 
       } else if (abs(dy) > abs(dx)) {
5638
 
         Real temp = dx / dy;
5639
 
         sn = 1.0 / ::sqrt( 1.0 + temp*temp );
5640
 
         cs = temp * sn;
5641
 
       } else {
5642
 
         Real temp = dy / dx;
5643
 
         cs = 1.0 / ::sqrt( 1.0 + temp*temp );
5644
 
         sn = temp * cs;
5645
 
       }
5646
 
     }
5647
 
     template<class Real>
5648
 
     void ApplyPlaneRotation(Real &dx, Real &dy, Real &cs, Real &sn)
5649
 
     {
5650
 
       Real temp  =  cs * dx + sn * dy;
5651
 
       dy = -sn * dx + cs * dy;
5652
 
       dx = temp;
 
6672
(Source file: `skit/plib2/mpi_assembly_begin.h')
 
6673
 
 
6674
Description
 
6675
-----------
 
6676
 
 
6677
Start a dense array or a sparse matrix assembly.
 
6678
 
 
6679
Complexity
 
6680
----------
 
6681
 
 
6682
Assume that stash has indexes in increasing order.    cpu complexity :
 
6683
O(stash.size + nproc)   memory complexity : O(stash.size + nproc)   msg
 
6684
size complexity : O(stash.size + nproc)
 
6685
 
 
6686
When assembling a finite element matrix, the stash.size is at boundaries
 
6687
 of the mesh partition, and stash.size = O(nrow^alpha), where
 
6688
alpha=(d-1)/d   and d=2,3. Using nproc <= O(nrow^alpha) is performant.
 
6689
 
 
6690
Note
 
6691
----
 
6692
 
 
6693
The stash may be sorted by increasing nows and column.
 
6694
 
 
6695
Inspirated from Petsc (petsc/src/vec/vec/impls/mpi/pdvec.c), here with
 
6696
a pre-sorted stash, thanks to the stl::map data structure.
 
6697
 
 
6698
Implementation
 
6699
--------------
 
6700
 
 
6701
     template <
 
6702
         class Stash,
 
6703
         class Message,
 
6704
         class InputIterator>
 
6705
     typename Stash::size_type
 
6706
     mpi_assembly_begin (
 
6707
      // input:
 
6708
         const Stash&                       stash,
 
6709
         InputIterator                      first_stash_idx, // wrapper in shash
 
6710
         InputIterator                      last_stash_idx,
 
6711
         const distributor&                 ownership,
 
6712
      // ouput:
 
6713
         Message&                           receive,         // buffer
 
6714
         Message&                           send)            // buffer
 
6715
     {
 
6716
         typedef typename Stash::size_type      size_type;
 
6717
 
 
6718
         mpi::communicator     comm    = ownership.comm();
 
6719
         size_type             my_proc = ownership.process();
 
6720
         size_type             nproc   = ownership.n_process();
 
6721
         distributor::tag_type tag     = distributor::get_new_tag();
 
6722
 
 
6723
         // ----------------------------------------------------------------
 
6724
         // 1) count the messages contained in stash by process id
 
6725
         // ----------------------------------------------------------------
 
6726
         // assume that stash elements are sorted by increasing stash_idx (e.g. stash = stl::map)
 
6727
         // cpu complexity = O(stash.size + nproc)
 
6728
         // mem complexity = O(stash.size + nproc)
 
6729
         std::vector<size_type> msg_size(nproc, 0);
 
6730
         std::vector<size_type> msg_mark(nproc, 0);
 
6731
         size_type send_nproc = 0;
 
6732
         {
 
6733
           size_type iproc = 0;
 
6734
           size_type i = 0;
 
6735
           for (InputIterator iter_idx = first_stash_idx; iter_idx != last_stash_idx; iter_idx++, i++) {
 
6736
             for (; iproc < nproc; iproc++) {
 
6737
               if (*iter_idx >= ownership[iproc] && *iter_idx < ownership[iproc+1]) {
 
6738
                 msg_size [iproc]++;
 
6739
                 if (!msg_mark[iproc]) {
 
6740
                    msg_mark[iproc] = 1;
 
6741
                    send_nproc++;
 
6742
                 }
 
6743
                 break;
 
6744
               }
 
6745
             }
 
6746
             assert_macro (iproc != nproc, "bad stash data: index "<<*iter_idx<<" out of range [0:"<<ownership[nproc]<<"[");
 
6747
           }
 
6748
         } // end block
 
6749
         // ----------------------------------------------------------------
 
6750
         // 2) avoid to send message to my-proc in counting
 
6751
         // ----------------------------------------------------------------
 
6752
         if (msg_size [my_proc] != 0) {
 
6753
             msg_size [my_proc] = 0;
 
6754
             msg_mark [my_proc] = 0;
 
6755
             send_nproc--;
 
6756
         }
 
6757
         // ----------------------------------------------------------------
 
6758
         // 3) compute number of messages to be send to my_proc
 
6759
         // ----------------------------------------------------------------
 
6760
         // msg complexity : O(nproc) or O(log(nproc)), depending on reduce implementation
 
6761
         std::vector<size_type> work (nproc);
 
6762
         mpi::all_reduce (
 
6763
             comm,
 
6764
             msg_mark.begin().operator->(),
 
6765
             nproc,
 
6766
             work.begin().operator->(),
 
6767
             std::plus<size_type>());
 
6768
         size_type receive_nproc = work [my_proc];
 
6769
         // ----------------------------------------------------------------
 
6770
         // 4) compute messages max size to be send to my_proc
 
6771
         // ----------------------------------------------------------------
 
6772
         // msg complexity : O(nproc) or O(log(nproc)), depending on reduce implementation
 
6773
         mpi::all_reduce (
 
6774
             comm,
 
6775
             msg_size.begin().operator->(),
 
6776
             nproc,
 
6777
             work.begin().operator->(),
 
6778
             mpi::maximum<size_type>());
 
6779
         size_type receive_max_size = work [my_proc];
 
6780
         // ----------------------------------------------------------------
 
6781
         // 5) post receive: exchange the buffer adresses between processes
 
6782
         // ----------------------------------------------------------------
 
6783
         // Each message will consist of ordered pairs (global index,value).
 
6784
         // since we don't know how long each indiidual message is,
 
6785
         // we allocate the largest : receive_nproc*receive_max_size
 
6786
         // potentially, this is a lot of wasted space
 
6787
         // TODO: how to optimize the receive.data buffer ?
 
6788
         // cpu complexity : O(nproc)
 
6789
         // mem complexity : O(nproc*(stash.size/nproc)) = O(stash.size), worst case ?
 
6790
         // msg complexity : O(nproc)
 
6791
         receive.data.resize (receive_nproc*receive_max_size);
 
6792
         for (size_t i_receive = 0; i_receive < receive_nproc; i_receive++) {
 
6793
           mpi::request i_req = comm.irecv (
 
6794
               mpi::any_source,
 
6795
               tag,
 
6796
               receive.data.begin().operator->() + i_receive*receive_max_size,
 
6797
               receive_max_size);
 
6798
           receive.waits.push_back (std::make_pair(i_receive, i_req));
 
6799
         }
 
6800
         // ----------------------------------------------------------------
 
6801
         // 6) copy stash in send buffer
 
6802
         // ----------------------------------------------------------------
 
6803
         // since the stash is sorted by increasing order => simple copy
 
6804
         // cpu complexity : O(stash.size)
 
6805
         // mem complexity : O(stash.size)
 
6806
         send.data.resize (stash.size());
 
6807
         copy (stash.begin(), stash.end(), send.data.begin());
 
6808
         // ---------------------------------------------------------------------------
 
6809
         // 7) do send
 
6810
         // ---------------------------------------------------------------------------
 
6811
         // cpu complexity : O(nproc)
 
6812
         // mem complexity : O(send_nproc) \approx O(nproc), worst case
 
6813
         // msg complexity : O(stash.size)
 
6814
         send.waits.resize(send_nproc);
 
6815
         {
 
6816
           size_type i_send = 0;
 
6817
           size_type i_start = 0;
 
6818
           for (size_type iproc = 0; iproc < nproc; iproc++) {
 
6819
             size_type i_msg_size = msg_size[iproc];
 
6820
             if (i_msg_size == 0) continue;
 
6821
             mpi::request i_req = comm.isend (
 
6822
                 iproc,
 
6823
                 tag,
 
6824
                 send.data.begin().operator->() + i_start,
 
6825
                 i_msg_size);
 
6826
             send.waits.push_back(std::make_pair(i_send,i_req));
 
6827
             i_send++;
 
6828
             i_start += i_msg_size;
 
6829
           }
 
6830
         } // end block
 
6831
         return receive_max_size;
 
6832
     }
 
6833
 
 
6834
 
 
6835
File: rheolef.info,  Node: msg_to_context algorithm,  Up: Algorithms
 
6836
 
 
6837
6.13 msg_to_context - receive pattern
 
6838
=====================================
 
6839
 
 
6840
(Source file: `skit/plib2/msg_to_context.h')
 
6841
 
 
6842
Description
 
6843
-----------
 
6844
 
 
6845
Computes the receive compresed message pattern for gather   and scatter.
 
6846
 The local message part is computed by a separate algorithm   (see
 
6847
"msg_to_local_context"(5)).
 
6848
 
 
6849
Algorithm
 
6850
---------
 
6851
 
 
6852
msg_to_context
 
6853
 
 
6854
"input": the receive pattern and the permutation   |
 
6855
perm(0:receive_nproc-1)   |   r_iproc(0:receive_nproc-1),
 
6856
r_size(0:receive_nproc-1),   |
 
6857
r_idx(0:receive_nproc*receive_max_size-1)   "output": the receive
 
6858
context (to)   |   to_proc(0:receive_nproc-1), to_ptr(0:receive_nproc),
 
6859
 |   to_idx(0:receive_total_size-1)   begin   |     to_ptr(0) := 0   |
 
6860
  for j := 0 to receive_nproc-1 do   |       j1 := perm(j)   |
 
6861
to_proc(j) := r_iproc(j1)   |       to_ptr(j+1) := r_ptr(j) + rsize(j1)
 
6862
 |       for q := to_ptr(j) to to_tr(j+1)-1 do   |         to_idx(q) :=
 
6863
r_idx(j1, q-to_ptr(j)) - istart   |       endfor   |     endfor   end
 
6864
 
 
6865
Complexity
 
6866
----------
 
6867
 
 
6868
Memory and time complexity is O(receive_total_size).
 
6869
 
 
6870
Implementation
 
6871
--------------
 
6872
 
 
6873
     template <
 
6874
         class InputIterator1,
 
6875
         class InputRandomIterator2,
 
6876
         class InputRandomIterator3,
 
6877
         class InputRandomIterator4,
 
6878
         class Size,
 
6879
         class OutputIterator1,
 
6880
         class OutputIterator2,
 
6881
         class OutputIterator3>
 
6882
     void
 
6883
     msg_to_context (
 
6884
         InputIterator1              perm,           // receive_nproc
 
6885
         InputIterator1              last_perm,
 
6886
         InputRandomIterator2        r_iproc,        // receive_nproc
 
6887
         InputRandomIterator3        r_size,         // receive_nproc
 
6888
         InputRandomIterator4        r_idx,          // receive_nproc*receive_max_size
 
6889
         Size                        receive_max_size,
 
6890
         Size                        istart,
 
6891
         OutputIterator1             to_proc,        // receive_nproc
 
6892
         OutputIterator2             to_ptr,         // receive_nproc+1
 
6893
         OutputIterator3             to_idx)         // receive_total_size
 
6894
     {
 
6895
         OutputIterator2 prec_ptr = to_ptr;
 
6896
         (*to_ptr++) = 0;
 
6897
         while (perm != last_perm) {
 
6898
             Size j1 = (*perm++);
 
6899
             (*to_proc++) = r_iproc[j1];
 
6900
             Size size = r_size[j1];
 
6901
             (*to_ptr++) = (*prec_ptr++) + size;
 
6902
             InputRandomIterator4 iter_idx = r_idx + j1*receive_max_size;
 
6903
             InputRandomIterator4 last_idx = iter_idx + size;
 
6904
             while (iter_idx != last_idx)
 
6905
                 (*to_idx++) = (*iter_idx++) - istart;
 
6906
         }
 
6907
     }
 
6908
 
 
6909
 
 
6910
File: rheolef.info,  Node: msg_from_context_indices algorithm,  Up: Algorithms
 
6911
 
 
6912
6.14 msg_from_context_indices - gather
 
6913
======================================
 
6914
 
 
6915
(Source file: `skit/plib2/msg_from_context_indices.h')
 
6916
 
 
6917
Description
 
6918
-----------
 
6919
 
 
6920
Computes the receive compressed message pattern for gather   and
 
6921
scatter.    Suppose indexes are sorted by increasing order.
 
6922
 
 
6923
Algorithm
 
6924
---------
 
6925
 
 
6926
msg_from_context_indices
 
6927
 
 
6928
"input": the owner and indice arrays, the current process   |
 
6929
owner(0:nidx-1), idy(0:nidx-1),   |   proc2from_proc(0:nproc-1), my_proc
 
6930
 "input-output": the pointer array, used for accumulation   |
 
6931
ptr(0:nidx)   "output": the receive context (from) indice array   |
 
6932
from_idx(0:nidx-1)   begin   | for k := 0 to nidx-1 do   |   iproc :=
 
6933
owner(k)   |   if iproc <> my_proc then   |     i :=
 
6934
proc2from_proc(iproc)   |     p := ptr(i)   |     ptr(i) := p + 1   |
 
6935
 from_idx(p) := idy(k)   |   endif   | endfor   end
 
6936
 
 
6937
Complexity
 
6938
----------
 
6939
 
 
6940
Complexity is O(nidx).
 
6941
 
 
6942
Todo
 
6943
----
 
6944
 
 
6945
Uses input iterators.
 
6946
 
 
6947
Implementation
 
6948
--------------
 
6949
 
 
6950
     template <
 
6951
         class InputIterator1,
 
6952
         class InputIterator2,
 
6953
         class InputRandomIterator,
 
6954
         class Proc,
 
6955
         class Size,
 
6956
         class MutableRandomIterator,
 
6957
         class OutputIterator>
 
6958
     void
 
6959
     msg_from_context_indices (
 
6960
         InputIterator1              owner,                  // nidx
 
6961
         InputIterator1              last_owner,
 
6962
         InputIterator2              idy,                    // nidx
 
6963
         InputRandomIterator         proc2from_proc,         // nproc
 
6964
         Proc                        my_proc,
 
6965
         Size                        idy_maxval,
 
6966
         MutableRandomIterator       ptr,                    // send_nproc+1
 
6967
         OutputIterator              from_idx)               // nidx
 
6968
     {
 
6969
         Size nidx = distance(owner,last_owner);
 
6970
         for (Size i = 0; i < nidx; i++) {
 
6971
             if (owner[i] != my_proc) {
 
6972
                 assert_macro (idy[i] < idy_maxval, "Scattering past end of TO vector: idy="
 
6973
                     << idy[i] << " out of range 0.." << idy_maxval-1);
 
6974
                 Size p = ptr[proc2from_proc[owner[i]]]++;
 
6975
                 from_idx[p] = idy[i];
 
6976
             }
 
6977
         }
 
6978
     }
 
6979
 
 
6980
 
 
6981
File: rheolef.info,  Node: mpi_scatter_end algorithm,  Up: Algorithms
 
6982
 
 
6983
6.15 mpi_scatter_end - gather/scatter finalize
 
6984
==============================================
 
6985
 
 
6986
(Source file: `skit/plib2/mpi_scatter_end.h')
 
6987
 
 
6988
Description
 
6989
-----------
 
6990
 
 
6991
Finishes communication   for distributed to sequential scatter context.
 
6992
 
 
6993
Implementation
 
6994
--------------
 
6995
 
 
6996
     template <
 
6997
         class InputIterator,
 
6998
         class OutputIterator,
 
6999
         class Message,
 
7000
         class SetOp,
 
7001
         class Tag,
 
7002
         class Comm>
 
7003
     void
 
7004
     mpi_scatter_end(
 
7005
         InputIterator                       x,
 
7006
         OutputIterator                      y,
 
7007
         Message&                            from,
 
7008
         Message&                            to,
 
7009
         SetOp                               op,
 
7010
         Tag                                 tag,
 
7011
         Comm                                comm)
 
7012
     {
 
7013
         typedef typename Message::base_value_type data_type; // the data type to be received by mpi
 
7014
         typedef boost::transform_iterator<select2nd<size_t,mpi::request>, std::list<std::pair<size_t,mpi::request> >::iterator>
 
7015
                 request_iterator;
 
7016
 
 
7017
         // -----------------------------------------------------------
 
7018
         // 1) wait on receives and unpack receives into local space
 
7019
         // -----------------------------------------------------------
 
7020
         while (from.requests.size() != 0) {
 
7021
             request_iterator iter_r_waits (from.requests.begin(), select2nd<size_t,mpi::request>()),
 
7022
                              last_r_waits (from.requests.end(),   select2nd<size_t,mpi::request>());
 
7023
             // waits on any receive...
 
7024
             std::pair<mpi::status,request_iterator> pair_status = mpi::wait_any (iter_r_waits, last_r_waits);
 
7025
             // check status
 
7026
             boost::optional<int> i_msg_size_opt = pair_status.first.count<data_type>();
 
7027
             check_macro (i_msg_size_opt, "receive wait failed");
 
7028
             int iproc = pair_status.first.source();
 
7029
             check_macro (iproc >= 0, "receive: source iproc = "<<iproc<<" < 0 !");
 
7030
             // get size of receive and number in data
 
7031
             size_t i_msg_size = (size_t)i_msg_size_opt.get();
 
7032
             std::list<std::pair<size_t,mpi::request> >::iterator i_pair_ptr = pair_status.second.base();
 
7033
             size_t i_receive = (*i_pair_ptr).first;
 
7034
             check_macro (i_msg_size == from.starts()[i_receive+1] - from.starts()[i_receive], "unexpected size");
 
7035
 
 
7036
             // unpack receives into our local space
 
7037
             from.store_values (y, i_receive, op);
 
7038
             from.requests.erase (i_pair_ptr);
 
7039
         }
 
7040
         // -----------------------------------------------------------
 
7041
         // 2) wait on sends
 
7042
         // -----------------------------------------------------------
 
7043
         request_iterator iter_s_waits (to.requests.begin(), select2nd<size_t,mpi::request>()),
 
7044
                          last_s_waits (to.requests.end(),   select2nd<size_t,mpi::request>());
 
7045
         mpi::wait_all (iter_s_waits, last_s_waits);
5653
7046
     }
5654
7047
 
5655
7048
 
5660
7053
 
5661
7054
* Menu:
5662
7055
 
5663
 
* convect form::
5664
 
* d_dx form::
5665
 
* 2W form::
5666
 
* curl form::
5667
 
* 2D_D form::
5668
 
* d_ds form::
5669
 
* d2_ds2 form::
5670
 
* div form::
5671
7056
* mass form::
5672
 
* grad form::
5673
 
* inv_mass form::
5674
7057
* grad_grad form::
5675
 
* div_div form::
5676
 
* 2D form::
5677
 
 
5678
 
 
5679
 
File: rheolef.info,  Node: convect form,  Up: Forms
5680
 
 
5681
 
7.1 `convect' - discontinuous Galerkin
5682
 
======================================
5683
 
 
5684
 
(Source file: `nfem/form_element/convect.h') 
5685
 
 
5686
 
Synopsis
5687
 
--------
5688
 
 
5689
 
             form(const space& V, const space& V, "convect", uh);
5690
 
 
5691
 
Description
5692
 
-----------
5693
 
 
5694
 
Assembly the matrix associated to the     discontinuous Galerkin method
5695
 
on the finite element space V.
5696
 
                      /
5697
 
                      |
5698
 
             c(u,v) = |  a.grad(u) v dx + skips...
5699
 
                      |
5700
 
                      / Omega
5701
 
    for all u,v in V, where the vector field a is given.      The V
5702
 
space may `P1d'     finite element spaces for building the form.
5703
 
 
5704
 
 
5705
 
File: rheolef.info,  Node: d_dx form,  Up: Forms
5706
 
 
5707
 
7.2 `d_dx'I - derivatives
5708
 
=========================
5709
 
 
5710
 
(Source file: `nfem/form_element/d_dx0.h') 
5711
 
 
5712
 
Synopsis
5713
 
--------
5714
 
 
5715
 
             form (const space V, const space& M, "d_dx0");
5716
 
             form (const space V, const space& M, "d_dx1");
5717
 
             form (const space V, const space& M, "d_dx2");
5718
 
 
5719
 
Description
5720
 
-----------
5721
 
 
5722
 
Assembly the form associated to a   derivative operator from the `V'
5723
 
finite element space   to the `M' one:
5724
 
                      /
5725
 
                      |  d u
5726
 
           b_i(u,q) = |  ----  q  dx,  i = 0,1,2
5727
 
                      |  d xi
5728
 
                      / Omega
5729
 
  In the axisymetric `rz' case, the form is defined by
5730
 
                      /
5731
 
                      |  d u
5732
 
           b_0(u,q) = |  ---  q  r dr dz
5733
 
                      |  d r
5734
 
                      / Omega
5735
 
  If the V space is a `P1' (resp. `P2')   finite element space, the M
5736
 
space may be   a `P0' (resp. `P1d') one.
5737
 
 
5738
 
Example
5739
 
-------
5740
 
 
5741
 
The following piece of code build the Laplacian form   associated to
5742
 
the P1 approximation:
5743
 
             geo omega ("square");
5744
 
             space V (omega, "P1");
5745
 
             space M (omega, "P0");
5746
 
             form  b (V, M, "d_dx0");
5747
 
 
5748
 
Limitations
5749
 
-----------
5750
 
 
5751
 
Only edge, triangular and tetrahedal finite element meshes are yet
5752
 
supported.
5753
 
 
5754
 
 
5755
 
File: rheolef.info,  Node: 2W form,  Up: Forms
5756
 
 
5757
 
7.3 `2W' - vorticity tensor
5758
 
===========================
5759
 
 
5760
 
(Source file: `nfem/form_element/2W.h') 
5761
 
 
5762
 
Synopsis
5763
 
--------
5764
 
 
5765
 
             form (const space V, const space& T, "2W");
5766
 
 
5767
 
Description
5768
 
-----------
5769
 
 
5770
 
Assembly the form associated to the vorticity   tensor, i.e. the
5771
 
unsymmetric part of the gradient of a   vector field.    These
5772
 
derivative are usefull in fluid mechanic.
5773
 
                      /
5774
 
                      |
5775
 
           b(u,tau) = | 2 W(u) : tau dx,
5776
 
                      |
5777
 
                      / Omega
5778
 
  where
5779
 
          2 D(u) = grad u - (grad u)^T
5780
 
  If the V space is a vector-valued `P1' (resp. `P2')   finite element
5781
 
space, the T space may be   a tensor-valued `P0' (resp. `P1d') one.
5782
 
 
5783
 
Example
5784
 
-------
5785
 
 
5786
 
The following piece of code build the Laplacian form   associated to
5787
 
the P1 approximation:
5788
 
             geo omega ("square");
5789
 
             space V (omega, "P1", "vector");
5790
 
             space T (omega, "P0", "tensor");
5791
 
             form  b (V, T, "2W");
5792
 
 
5793
 
 
5794
 
File: rheolef.info,  Node: curl form,  Up: Forms
5795
 
 
5796
 
7.4 `curl' - curl operator
5797
 
==========================
5798
 
 
5799
 
(Source file: `nfem/form_element/curl.h') 
5800
 
 
5801
 
Synopsis
5802
 
--------
5803
 
 
5804
 
           form(const space V, const space& M, "curl");
5805
 
 
5806
 
Description
5807
 
-----------
5808
 
 
5809
 
Assembly the form associated to the curl operator on finite element
5810
 
space.      In three dimensions, both V and M are vector-valued:
5811
 
                    /
5812
 
                    |
5813
 
           b(u,q) = |  curl(u).q dx
5814
 
                    |
5815
 
                    / Omega
5816
 
    In two dimensions, only V is vector-valued.      The V space may be
5817
 
a either     `P2' finite element space,     while the M space may be
5818
 
`P1d'.      See also *note form class:: and *note space class::.
5819
 
 
5820
 
Example
5821
 
-------
5822
 
 
5823
 
The following piece of code build the divergence form     associated to
5824
 
the `P2' approximation for a three dimensional     geometry:
5825
 
             geo omega("cube");
5826
 
             space V(omega, "P2",  "vector");
5827
 
             space M(omega, "P1d", "vector");
5828
 
             form b(V, M, "curl");
5829
 
    while this code becomes in two dimension:
5830
 
             geo omega("square");
5831
 
             space V(omega, "P2",  "vector");
5832
 
             space M(omega, "P1d");
5833
 
             form b(V, M, "curl");
5834
 
 
5835
 
 
5836
 
File: rheolef.info,  Node: 2D_D form,  Up: Forms
5837
 
 
5838
 
7.5 `2D_D' - -div 2D operator
5839
 
=============================
5840
 
 
5841
 
(Source file: `nfem/form_element/2D_D.h') 
5842
 
 
5843
 
Synopsis
5844
 
--------
5845
 
 
5846
 
             form (const space V, const space& V, "2D_D");
5847
 
 
5848
 
Description
5849
 
-----------
5850
 
 
5851
 
  Assembly the form associated to the `div(2D(.))' components of the
5852
 
operator on the finite element space `V':
5853
 
                      /
5854
 
                      |
5855
 
             a(u,v) = |  2 Dij(ui) Dij(vj) dx
5856
 
                      |
5857
 
                      / Omega
5858
 
  where
5859
 
                     1 ( d ui   d uj )
5860
 
           Dij(u) =  - ( ---- + ---- )
5861
 
                     2 ( d xj   d xi )
5862
 
  This form is usefull when considering elasticity or Stokes   problems.
5863
 
 
5864
 
Example
5865
 
-------
5866
 
 
5867
 
Here is an example of the vector-valued form:
5868
 
             geo omega ("square");
5869
 
             space V (omega, "P2", "vector");
5870
 
             form  a (V, V, "2D_D");
5871
 
  Note that a factor two is here applied to the form.    This factor is
5872
 
commonly used in practice.
5873
 
 
5874
 
 
5875
 
File: rheolef.info,  Node: d_ds form,  Up: Forms
5876
 
 
5877
 
7.6 `d_ds' - Curvilinear derivative
5878
 
===================================
5879
 
 
5880
 
(Source file: `nfem/form_element/d_ds.h') 
5881
 
 
5882
 
Synopsis
5883
 
--------
5884
 
 
5885
 
             form(const space& V, const space& W, "d_ds");
5886
 
 
5887
 
Description
5888
 
-----------
5889
 
 
5890
 
Assembly the matrix associated to the following integral:
5891
 
                      /
5892
 
                      |
5893
 
             m(u,v) = | du/ds v ds
5894
 
                      |
5895
 
                      / Gamma
5896
 
 
5897
 
 
5898
 
File: rheolef.info,  Node: d2_ds2 form,  Up: Forms
5899
 
 
5900
 
7.7 `d2_ds2' - Curvilinear second derivative
5901
 
============================================
5902
 
 
5903
 
(Source file: `nfem/form_element/d2_ds2.h') 
5904
 
 
5905
 
Synopsis
5906
 
--------
5907
 
 
5908
 
             form(const space& V, const space& W, "d2_ds2");
5909
 
 
5910
 
Description
5911
 
-----------
5912
 
 
5913
 
Assembly the matrix associated to the following integral:
5914
 
                      /
5915
 
                      |
5916
 
             m(u,v) = | d^2u/ds^2 v ds
5917
 
                      |
5918
 
                      / Gamma
5919
 
 
5920
 
 
5921
 
File: rheolef.info,  Node: div form,  Up: Forms
5922
 
 
5923
 
7.8 `div' - divergence operator
5924
 
===============================
5925
 
 
5926
 
(Source file: `nfem/form_element/div.h') 
5927
 
 
5928
 
Synopsis
5929
 
--------
5930
 
 
5931
 
           form(const space V, const space& M, "div");
5932
 
 
5933
 
Description
5934
 
-----------
5935
 
 
5936
 
Assembly the form associated to the     divergence operator on a finite
5937
 
element space `V':
5938
 
                    /
5939
 
                    |
5940
 
           b(u,q) = |  div(u) q dx
5941
 
                    |
5942
 
                    / Omega
5943
 
    The V space may be a either     `P1' or `P2' finite element space,
5944
 
  while the M space may be `P0' or `P1d' respectively.      See also
5945
 
*note form class:: and *note space class::.
5946
 
 
5947
 
Example
5948
 
-------
5949
 
 
5950
 
The following piece of code build the divergence form     associated to
5951
 
the `P1' approximation:
5952
 
             geo omega("square");
5953
 
             space V(omega, "P1", "vector");
5954
 
             space M(omega, "P0");
5955
 
             form b(V, M, "div");
5956
7058
 
5957
7059
 
5958
7060
File: rheolef.info,  Node: mass form,  Up: Forms
5959
7061
 
5960
 
7.9 `mass' - L2 scalar product
 
7062
7.1 `mass' - L2 scalar product
5961
7063
==============================
5962
7064
 
5963
 
(Source file: `nfem/form_element/mass.h') 
 
7065
(Source file: `nfem/pform_element/mass.h') 
5964
7066
 
5965
7067
Synopsis
5966
7068
--------
6071
7173
             form  ab (V, V, "mass", gamma);
6072
7174
 
6073
7175
 
6074
 
File: rheolef.info,  Node: grad form,  Up: Forms
6075
 
 
6076
 
7.10 `grad' - gradient operator
6077
 
===============================
6078
 
 
6079
 
(Source file: `nfem/form_element/grad.h') 
6080
 
 
6081
 
Synopsis
6082
 
--------
6083
 
 
6084
 
           form(const space V, const space& M, "grad");
6085
 
 
6086
 
Description
6087
 
-----------
6088
 
 
6089
 
Assembly the form associated to the     gradient operator on a finite
6090
 
element space `V':
6091
 
                     /
6092
 
                     |
6093
 
           b(u, q) = | grad(u).q dx
6094
 
                     |
6095
 
                     / Omega
6096
 
    The V space may be a either     `P1'  or `P2'  finite element space,
6097
 
   while the M space may be `P0'  or `P1d'  respectively.      See also
6098
 
*note form class:: and *note space class::.
6099
 
 
6100
 
Example
6101
 
-------
6102
 
 
6103
 
The following piece of code build the divergence form     associated to
6104
 
the `P1' approximation:
6105
 
             geo omega("square");
6106
 
             space V(omega, "P1");
6107
 
             space M(omega, "P0", "vector");
6108
 
             form b(V, M, "grad");
6109
 
 
6110
 
 
6111
 
File: rheolef.info,  Node: inv_mass form,  Up: Forms
6112
 
 
6113
 
7.11 `inv_mass' - invert of L2 scalar product
6114
 
=============================================
6115
 
 
6116
 
(Source file: `nfem/form_element/inv_mass.h') 
6117
 
 
6118
 
Synopsis
6119
 
--------
6120
 
 
6121
 
             form(const space& V, const space& V, "inv_mass");
6122
 
 
6123
 
Description
6124
 
-----------
6125
 
 
6126
 
Assembly the invert of the matrix associated to the   L2 scalar product
6127
 
of the finite element space V:
6128
 
                      /
6129
 
                      |
6130
 
             m(u,v) = | u v dx
6131
 
                      |
6132
 
                      / Omega
6133
 
  The V space may be either a   `P0' or   `P1d'   discontinuous finite
6134
 
element spaces   *note form class::.
6135
 
 
6136
 
Example
6137
 
-------
6138
 
 
6139
 
The following piece of code build the invert of   the mass matrix
6140
 
associated to the `P1d'  approximation:
6141
 
             geo omega_h ("square");
6142
 
             space Vh (omega_h , "P1d");
6143
 
             form im (Vh, Vh, "inv_mass");
6144
 
 
6145
 
 
6146
7176
File: rheolef.info,  Node: grad_grad form,  Up: Forms
6147
7177
 
6148
 
7.12 `grad_grad' - -Laplacian operator
6149
 
======================================
 
7178
7.2 `grad_grad' - -Laplacian operator
 
7179
=====================================
6150
7180
 
6151
 
(Source file: `nfem/form_element/grad_grad.h') 
 
7181
(Source file: `nfem/pform_element/grad_grad.h') 
6152
7182
 
6153
7183
Synopsis
6154
7184
--------
6178
7208
             form a(V, V, "grad_grad");
6179
7209
 
6180
7210
 
6181
 
File: rheolef.info,  Node: div_div form,  Up: Forms
6182
 
 
6183
 
7.13 `div_div' - -grad div operator
6184
 
===================================
6185
 
 
6186
 
(Source file: `nfem/form_element/div_div.h') 
6187
 
 
6188
 
Synopsis
6189
 
--------
6190
 
 
6191
 
             form (const space V, const space& V, "div_div");
6192
 
 
6193
 
Description
6194
 
-----------
6195
 
 
6196
 
Assembly the form associated to the `grad(div(.))'   operator on the
6197
 
finite element space `V':
6198
 
                      /
6199
 
                      |
6200
 
             a(u,v) = | div(u) div(v) dx
6201
 
                      |
6202
 
                      / Omega
6203
 
  This form is usefull when considering elasticity problem.
6204
 
 
6205
 
Example
6206
 
-------
6207
 
 
6208
 
Here is an example of the vector-valued form:
6209
 
             geo omega ("square");
6210
 
             space V (omega, "P2", "vector");
6211
 
             form  a (V, V, "div_div");
6212
 
 
6213
 
 
6214
 
File: rheolef.info,  Node: 2D form,  Up: Forms
6215
 
 
6216
 
7.14 `2D' - rate of deformation tensor
6217
 
======================================
6218
 
 
6219
 
(Source file: `nfem/form_element/2D.h') 
6220
 
 
6221
 
Synopsis
6222
 
--------
6223
 
 
6224
 
             form (const space V, const space& T, "2D");
6225
 
 
6226
 
Description
6227
 
-----------
6228
 
 
6229
 
Assembly the form associated to the rate of deformation   tensor, i.e.
6230
 
the symmetric part of the gradient of a   vector field.    These
6231
 
derivative are usefull in fluid mechanic and   elasticity.
6232
 
                      /
6233
 
                      |
6234
 
           b(u,tau) = | 2 D(u) : tau dx,
6235
 
                      |
6236
 
                      / Omega
6237
 
  where
6238
 
          2 D(u) = grad u + (grad u)^T
6239
 
 
6240
 
If the V space is a vector-valued `P1' (resp. `P2')   finite element
6241
 
space, the T space may be   a tensor-valued `P0' (resp. `P1d') one.
6242
 
 
6243
 
Example
6244
 
-------
6245
 
 
6246
 
The following piece of code build the Laplacian form   associated to
6247
 
the P1 approximation:
6248
 
             geo omega ("square");
6249
 
             space V (omega, "P1", "vector");
6250
 
             space T (omega, "P0", "tensor");
6251
 
             form  b (V, T, "2D");
6252
 
 
6253
 
 
6254
7211
File: rheolef.info,  Node: Internals,  Up: Top
6255
7212
 
6256
7213
8 Internals
6258
7215
 
6259
7216
* Menu:
6260
7217
 
6261
 
* geomap internal::
6262
 
* form_element internal::
6263
 
* iofem internal::
6264
 
* characteristic internal::
 
7218
* basis internal::
 
7219
* numbering internal::
 
7220
* tetrahedron internal::
6265
7221
* point internal::
6266
 
* basis internal::
 
7222
* scratch_array internal::
 
7223
* hexa internal::
 
7224
* tetra internal::
 
7225
* hexahedron internal::
 
7226
* hack_array internal::
6267
7227
* reference_element internal::
6268
7228
* quadrature internal::
6269
7229
* quadrangle internal::
6270
7230
* prism internal::
6271
 
* hexa internal::
6272
7231
* triangle internal::
6273
7232
* geo_element internal::
6274
 
* tetra internal::
6275
7233
* edge internal::
6276
 
* numbering internal::
 
7234
* index_set internal::
6277
7235
* smart_pointer internal::
6278
7236
* heap_allocator internal::
6279
7237
* stack_allocator internal::
6281
7239
* acinclude internal::
6282
7240
 
6283
7241
 
6284
 
File: rheolef.info,  Node: geomap internal,  Up: Internals
6285
 
 
6286
 
8.1 `geomap' - discrete mesh advection by a field: gh(x)=fh(x-dt*uh
6287
 
===================================================================
6288
 
 
6289
 
(Source file: `nfem/lib/geomap.h') 
6290
 
 
6291
 
Synopsys
6292
 
--------
6293
 
 
6294
 
The class geomap is a fundamental class used for the correspondance
6295
 
between fields defined on different meshes or for advection problems.
6296
 
This class is used for the method of characteristic.
6297
 
 
6298
 
Example
6299
 
-------
6300
 
 
6301
 
The following code compute gh(x)=fh(x-dt*uh(x)):
6302
 
       field uh = interpolate (Vh, u);
6303
 
       field fh = interpolate (Fh, f);
6304
 
       geomap X (Fh, -dt*uh);
6305
 
       field gh = compose (fh, X);
6306
 
 For a complete example, see `convect.cc' in the  example directory.
6307
 
 
6308
 
Implementation
6309
 
--------------
6310
 
 
6311
 
     struct geomap_option_type {
6312
 
         size_t n_track_step; // loop while tracking: y = X_u(x)
6313
 
         geomap_option_type() : n_track_step(1) {}
6314
 
     };
6315
 
     class geomap : public Vector<meshpoint> {
6316
 
     public:
6317
 
             geomap () : advected(false), use_space(true) {}
6318
 
             //  Maps a quadrature-dependent lattice over Th_1 onto Th_2 triangulation.
6319
 
             geomap (const geo& Th_2, const geo& Th_1,
6320
 
                             std::string quadrature="default", size_t order=0, bool allow_approximate_edges=true);
6321
 
 
6322
 
             //  Maps a quadrature-dependent lattice over Th_1 onto Th_2 triangulation
6323
 
             //  thro' an offset vector field u to be defined on Th_1.
6324
 
             geomap (const geo& Th_2, const geo& Th_1, const field& advection_h_1,
6325
 
                             std::string quadrature="default", size_t order=0) ;
6326
 
 
6327
 
             //  TO BE REMOVED: backward compatibility
6328
 
             //  Maps space Vh_1 dof's onto the meshpoints of Th_2 triangulation
6329
 
             /*  geomap : ( Vh_1.dof's ) |--> ( Th_2 )
6330
 
              */
6331
 
             geomap (const geo& Th_2, const space& Vh_1,
6332
 
                              bool allow_approximate_edges=true );
6333
 
             //  Same but for P1d, using points inside the triangle to preserve discontinuity
6334
 
             geomap (const geo& Th_2, const space& Vh_1,
6335
 
                              Float barycentric_weight );
6336
 
 
6337
 
             //  TO BE REMOVED: backward compatibility
6338
 
             //  Maps space Vh_1 dof's onto the meshpoints of Th_2 triangulation
6339
 
             //  thro' an offset u to be defined on Vh_1 dof's.
6340
 
             /*  geomap : ( Vh_1.dof's ) |--> ( Th_2 )
6341
 
              */
6342
 
             geomap (const geo& Th_2, const space& Vh_1, const field& advection_h_1);
6343
 
 
6344
 
             //  Does the same, but assumes that Th_2 is the triangulation for Vh_1
6345
 
             geomap (const space& Vh_2, const field& advection_h_1, const geomap_option_type& opts = geomap_option_type());
6346
 
 
6347
 
             ~geomap () {};
6348
 
 
6349
 
     //accessors
6350
 
             //  TO BE REMOVED: backward compatibility
6351
 
             const space&
6352
 
             get_space () const
6353
 
                     { if (!use_space) error_macro("Lattice-based geomaps use no space");
6354
 
                       return _Vh_1;
6355
 
                     };
6356
 
 
6357
 
             const geo&
6358
 
             get_origin_triangulation () const
6359
 
                     { return _Th_1; };
6360
 
 
6361
 
             const geo&
6362
 
             get_target_triangulation () const
6363
 
                     { return _Th_2; };
6364
 
 
6365
 
             size_t
6366
 
             order () const
6367
 
                     {
6368
 
                     //  TO BE REMOVED: backward compatibility
6369
 
                     if (!use_space)
6370
 
                     return _order;
6371
 
                     }
6372
 
 
6373
 
             const std::string&
6374
 
             quadrature () const
6375
 
                     {
6376
 
                     //  TO BE REMOVED: backward compatibility
6377
 
                     if (!use_space)
6378
 
                     return _quadrature; }
6379
 
 
6380
 
             bool is_inside (size_t dof) const { return _is_inside [dof]; }
6381
 
             bool no_barycentric_weight() const { return _barycentric_weight == Float(0); }
6382
 
             Float barycentric_weight() const { return _barycentric_weight; }
6383
 
 
6384
 
     protected:
6385
 
             friend class fieldog;
6386
 
             //  use_space mode
6387
 
             void init (const field& advection);
6388
 
             //  non use_space mode
6389
 
             void init ();
6390
 
             meshpoint advect (const point& q, size_t iK_Th_1);
6391
 
             meshpoint robust_advect_1 (const point& x0, const point& va, bool& is_inside) const;
6392
 
             meshpoint robust_advect_N (const point& x0, const point& v0, const field& vh, size_t n, bool& is_inside) const;
6393
 
 
6394
 
 
6395
 
     // data:
6396
 
             geo _Th_1;
6397
 
             geo _Th_2;
6398
 
             field _advection;
6399
 
             bool advected;
6400
 
             std::string _quadrature;
6401
 
             size_t _order;
6402
 
             bool _allow_approximate_edges;
6403
 
 
6404
 
             // TO BE REMOVED:
6405
 
             bool use_space;
6406
 
             space _Vh_1;
6407
 
 
6408
 
             std::vector<point> quad_point;
6409
 
             std::vector<Float> quad_weight;
6410
 
 
6411
 
             // flag when a dof go outside of the domain
6412
 
             std::vector<bool> _is_inside;
6413
 
 
6414
 
             Float _barycentric_weight;
6415
 
             geomap_option_type _option;
6416
 
      };
6417
 
 
6418
 
     inline
6419
 
     geomap::geomap (const geo& Th_2, const space& Vh_1, const field& advection) :
6420
 
             _Th_1 (Vh_1.get_geo()), _Th_2 (Th_2), _advection(advection), advected(true),
6421
 
             _quadrature("default"), _order(0),
6422
 
             _allow_approximate_edges(true), use_space(true), _Vh_1(Vh_1),
6423
 
             _is_inside(), _barycentric_weight(0)
6424
 
                     { init (advection); };
6425
 
 
6426
 
     inline
6427
 
     geomap::geomap (const space& Vh_1, const field& advection, const geomap_option_type& opt) :
6428
 
             _Th_1 (Vh_1.get_geo()), _Th_2 (Vh_1.get_geo()), _advection(advection), advected(true),
6429
 
             _quadrature("default"), _order(0),
6430
 
             _allow_approximate_edges(true), use_space(true), _Vh_1(Vh_1),
6431
 
             _is_inside(), _barycentric_weight(0), _option(opt)
6432
 
                     { init (advection); };
6433
 
 
6434
 
     inline
6435
 
     geomap::geomap (
6436
 
         const geo& Th_2,
6437
 
         const geo& Th_1,
6438
 
         const field& advection,
6439
 
         std::string quadrature,
6440
 
         size_t order)
6441
 
       :
6442
 
         _Th_1 (Th_1),
6443
 
         _Th_2 (Th_2),
6444
 
         _advection(advection),
6445
 
         advected(true),
6446
 
         _quadrature(quadrature),
6447
 
         _order(order),
6448
 
         _allow_approximate_edges(true),
6449
 
         use_space(false),
6450
 
         _Vh_1(),
6451
 
         _is_inside(),
6452
 
         _barycentric_weight(0),
6453
 
         _option()
6454
 
     {
6455
 
         if (_advection.get_geo() !=_Th_1)
6456
 
             error_macro("The advection field should be defined on the original mesh Th_1="
6457
 
                 << Th_1.name() << " and not " << _advection.get_geo().name());
6458
 
         init();
6459
 
     }
6460
 
 
6461
 
     inline
6462
 
     geomap::geomap (
6463
 
         const geo& Th_2,
6464
 
         const geo& Th_1,
6465
 
         std::string quadrature,
6466
 
         size_t order,
6467
 
         bool allow_approximate_edges)
6468
 
       : _Th_1 (Th_1),
6469
 
         _Th_2 (Th_2),
6470
 
         _advection(),
6471
 
         advected(false),
6472
 
         _quadrature(quadrature),
6473
 
         _order(order),
6474
 
         _allow_approximate_edges(allow_approximate_edges),
6475
 
         use_space(false),
6476
 
         _Vh_1(),
6477
 
         _is_inside(),
6478
 
         _barycentric_weight(0),
6479
 
         _option()
6480
 
     {
6481
 
         init();
6482
 
     }
6483
 
 
6484
 
     //  Composition with a field
6485
 
     /*  f being a field of space V, X a geomap on this space, foX=compose(f,X) is their
6486
 
      *  composition.
6487
 
      */
6488
 
     field compose (const field& f, const geomap& g);
6489
 
     /*  send also a callback function when advection goes outside a domain
6490
 
      *  this is usefull when using upstream boundary conditions
6491
 
      */
6492
 
     field compose (const field& f, const geomap& g, Float (*f_outside)(const point&));
6493
 
     template <class Func>
6494
 
     field compose (const field& f, const geomap& g, Func f_outside);
6495
 
 
6496
 
Implementation
6497
 
--------------
6498
 
 
6499
 
     class fieldog: public field // and friend of geomap.
6500
 
      {
6501
 
     public:
6502
 
        // Constructor
6503
 
             fieldog (const field& _f, const geomap& _g) : f(_f), g(_g) {};
6504
 
 
6505
 
             // Accessors
6506
 
             Float
6507
 
             operator() (const point& x) const;
6508
 
 
6509
 
             Float
6510
 
             operator() (const meshpoint& x) const;
6511
 
 
6512
 
             Float
6513
 
             operator() (const point& x_hat, size_t e) const
6514
 
             { return operator() (meshpoint(x_hat,e)); };
6515
 
 
6516
 
             std::vector<Float>
6517
 
             quadrature_values (size_t iK) const;
6518
 
 
6519
 
             std::vector<Float>
6520
 
             quadrature_d_dxi_values (size_t i, size_t iK) const;
6521
 
 
6522
 
             const std::string&
6523
 
             quadrature() const
6524
 
             { return g._quadrature; };
6525
 
 
6526
 
             size_t
6527
 
             order() const
6528
 
             { return g._order; };
6529
 
 
6530
 
             const space&
6531
 
             get_space() const
6532
 
             { return f.get_space(); };
6533
 
 
6534
 
     protected:
6535
 
             field f;
6536
 
             geomap g;
6537
 
      };
6538
 
 
6539
 
 
6540
 
File: rheolef.info,  Node: form_element internal,  Up: Internals
6541
 
 
6542
 
8.2 `form_element' - bilinear form on a single element
6543
 
======================================================
6544
 
 
6545
 
(Source file: `nfem/lib/form_element.h') 
6546
 
 
6547
 
Synopsys
6548
 
--------
6549
 
 
6550
 
The `form_element' class defines functions that compute   a bilinear
6551
 
form defined between two polynomial basis on a single   geometrical
6552
 
element. This bilinear form is represented   by a matrix.
6553
 
 
6554
 
The bilinear form is designated by a string, e.g. "mass", "grad_grad",
6555
 
...    indicating the form. The form depends also of the geometrical
6556
 
element:   triangle, square, tetrahedron (*note geo_element internal::).
6557
 
 
6558
 
Implementation note
6559
 
-------------------
6560
 
 
6561
 
The `form_element' class   is managed by (*note smart_pointer
6562
 
internal::).    This class uses a pointer on a pure virtual class
6563
 
`form_element_rep'   while the effective code refers to the specific
6564
 
concrete derived classes:   mass, grad_grad, etc.
6565
 
 
6566
 
Implementation
6567
 
--------------
6568
 
 
6569
 
     class form_element : public smart_pointer<form_element_rep> {
6570
 
     public:
6571
 
 
6572
 
     // typedefs:
6573
 
 
6574
 
         typedef size_t size_type;
6575
 
 
6576
 
     // allocators:
6577
 
 
6578
 
         form_element (std::string name = "");
6579
 
 
6580
 
     // modifier:
6581
 
 
6582
 
         void initialize (const space& X, const space& Y) const;
6583
 
 
6584
 
         //  optional, for scalar-weighted forms:
6585
 
         void set_weight (const field& wh) const;
6586
 
 
6587
 
             //  for special forms for which coordinate-system specific weights (ie, cylindrical
6588
 
             //  coordinates weights) should not be used:
6589
 
             void set_use_coordinate_system_weight(bool use) const;
6590
 
 
6591
 
     // accessor:
6592
 
 
6593
 
         void operator() (const geo_element& K, ublas::matrix<Float>& m) const;
6594
 
         const field& get_weight() const;
6595
 
     };
6596
 
 
6597
 
 
6598
 
File: rheolef.info,  Node: iofem internal,  Up: Internals
6599
 
 
6600
 
8.3 `iofem' - input and output finite element manipulators
6601
 
==========================================================
6602
 
 
6603
 
(Source file: `nfem/lib/iofem.h') 
6604
 
 
6605
 
Description
6606
 
-----------
6607
 
 
6608
 
This class implements some specific finite element manipulators.
6609
 
For a general presentation of stream manipulators, reports     to class
6610
 
`iostream'.
6611
 
 
6612
 
Valuated manipulators
6613
 
---------------------
6614
 
 
6615
 
`origin'
6616
 
`normal'
6617
 
     set a cutting plane for visualizations and post-processing.
6618
 
                      cout << cut << origin(point(0.5, 0.5, 0.5)) << normal(point(1,1,0) << uh;
6619
 
     
6620
 
 
6621
 
`topography'
6622
 
     specifies the topography field when representing a bidimensionnal
6623
 
           field in tridimensionnal elevation.
6624
 
                      cout << topography(zh) << uh;
6625
 
            This manipulator takes an agument that specifies a scalar
6626
 
     field value        `zh' for the elevation, while `uh' is the
6627
 
     scalar field        to represent. Then, the z-elevation takes
6628
 
     zh(x,y)+uh(x,y).
6629
 
 
6630
 
 
6631
 
File: rheolef.info,  Node: characteristic internal,  Up: Internals
6632
 
 
6633
 
8.4 `characteristic' - discrete mesh advection by a field: gh(x)=fh(x-dt*uh
6634
 
===========================================================================
6635
 
 
6636
 
(Source file: `nfem/lib/characteristic.h') 
6637
 
 
6638
 
Synopsys
6639
 
--------
6640
 
 
6641
 
The class characteristic is a class implementing the  Lagrange-Galerkin
6642
 
method. It is the extension of the method  of characteristic in the
6643
 
finite element context.   This is an expreimental implementation:
6644
 
please use the "geomap"  one for practical usage.
6645
 
 
6646
 
Example
6647
 
-------
6648
 
 
6649
 
The following code compute the Riesz representant, denoted  by "mgh" of
6650
 
gh(x)=fh(x-dt*uh(x)).
6651
 
       geo omega_h;
6652
 
       field uh = ...;
6653
 
       field fh = ...;
6654
 
       characteristic X (omega_h, -dt*uh);
6655
 
       field mgh = riesz_representer(Vh, compose(fh, X));
6656
 
 The Riesz representer is the "mgh" vector of values:
6657
 
             mgh(i) = integrate fh(x-dt*uh(x)) phi_i(x) dx
6658
 
 where phi_i is the i-th basis function in Vh  and the integral is
6659
 
evaluated by using a quadrature formulae.   By default the quadrature
6660
 
formule is Gauss-Lobatto with  the order equal to the polynomial order
6661
 
of Vh.   This quadrature formulae guaranties inconditional stability
6662
 
at any polynomial order (order 1: trapeze, order 2: simpson).
6663
 
Extension will accept in the future alternative quadrature  formulae.
6664
 
 
6665
 
Implementation
6666
 
--------------
6667
 
 
6668
 
     class characteristic {
6669
 
     public:
6670
 
             characteristic(const geo& bg_omega, const field& ah);
6671
 
             const geo& get_background_geo() const;
6672
 
             const field& get_advection() const;
6673
 
     protected:
6674
 
             geo   _bg_omega;
6675
 
             field _ah;
6676
 
     };
6677
 
     class field_o_characteristic {
6678
 
     public:
6679
 
             field_o_characteristic(const field& fh, const characteristic& X);
6680
 
             friend field_o_characteristic compose(
6681
 
                     const field& fh, const characteristic& X);
6682
 
             Float operator() (const point& x) const;
6683
 
             point vector_evaluate (const point& x) const;
6684
 
             tensor tensor_evaluate (const point& x) const;
6685
 
             const field& get_field() const;
6686
 
             const geo& get_background_geo() const;
6687
 
             const field& get_advection() const;
6688
 
     protected:
6689
 
             field          _fh;
6690
 
             characteristic _X;
6691
 
             point advect (const point& x0) const;
6692
 
     };
6693
 
 
6694
 
 
6695
 
File: rheolef.info,  Node: point internal,  Up: Internals
6696
 
 
6697
 
8.5 `point' - Point reference element
6698
 
=====================================
6699
 
 
6700
 
(Source file: `nfem/basis/point.icc') 
6701
 
 
6702
 
Description
6703
 
-----------
6704
 
 
6705
 
The point reference element is defined for convenience.    It is a
6706
 
0-dimensional element   with measure equal to 1.
6707
 
 
6708
 
Implementation
6709
 
--------------
6710
 
 
6711
 
     const size_t dimension = 0;
6712
 
     const size_t measure = 1;
6713
 
 
6714
 
 
6715
7242
File: rheolef.info,  Node: basis internal,  Up: Internals
6716
7243
 
6717
 
8.6 `basis' - polynomial basis
 
7244
8.1 `basis' - polynomial basis
6718
7245
==============================
6719
7246
 
6720
 
(Source file: `nfem/basis/basis.h') 
 
7247
(Source file: `nfem/plib/basis.h') 
6721
7248
 
6722
7249
Synopsys
6723
7250
--------
6776
7303
             size_type         i_dof_local,
6777
7304
             const point&      hat_x) const;
6778
7305
 
6779
 
         basic_point<point> hessian_eval(
 
7306
         tensor hessian_eval(
6780
7307
             reference_element hat_K,
6781
7308
             size_type         i_dof_local,
6782
7309
             const point&      hat_x) const;
6794
7321
         void hessian_eval(
6795
7322
             reference_element    hat_K,
6796
7323
             const point&         hat_x,
6797
 
             std::vector<basic_point<point> >&  values) const;
 
7324
             std::vector<tensor>& values) const;
6798
7325
 
6799
7326
         void hat_node(
6800
7327
             reference_element    hat_K,
6804
7331
     };
6805
7332
 
6806
7333
 
 
7334
File: rheolef.info,  Node: numbering internal,  Up: Internals
 
7335
 
 
7336
8.2 `numbering' - global degree of freedom numbering
 
7337
====================================================
 
7338
 
 
7339
(Source file: `nfem/plib/numbering.h') 
 
7340
 
 
7341
Synopsys
 
7342
--------
 
7343
 
 
7344
The `numbering' class defines methods that furnish global   numbering
 
7345
of degrees of freedom. This numbering depends upon   the degrees of
 
7346
polynoms on elements and upon the continuity   requirement at
 
7347
inter-element boundary. For instance the   "P1" continuous finite
 
7348
element approximation has one degree   of freedom per vertice of the
 
7349
mesh, while its discontinuous   counterpart has dim(basis) times the
 
7350
number of elements of the   mesh, where dim(basis) is the size of the
 
7351
local finite element basis.
 
7352
 
 
7353
Implementation
 
7354
--------------
 
7355
 
 
7356
     template <class T, class M = rheo_default_memory_model>
 
7357
     class numbering : public smart_pointer<numbering_rep<T,M> > {
 
7358
     public:
 
7359
 
 
7360
     // typedefs:
 
7361
 
 
7362
       typedef numbering_rep<T,M> rep;
 
7363
       typedef smart_pointer<rep> base;
 
7364
       typedef size_t             size_type;
 
7365
 
 
7366
     // allocators:
 
7367
 
 
7368
       numbering (std::string name = "");
 
7369
       numbering (numbering_rep<T,M>* ptr);
 
7370
       ~numbering() {}
 
7371
 
 
7372
     // accessors & modifiers:
 
7373
 
 
7374
       std::string name() const;
 
7375
       size_type degree () const;
 
7376
       void set_degree (size_type degree) const;
 
7377
       bool is_continuous()    const;
 
7378
       bool is_discontinuous() const { return !is_continuous(); }
 
7379
 
 
7380
       size_type     ndof   (const geo_size& gs, size_type map_dim) const;
 
7381
       size_type dis_ndof   (const geo_size& gs, size_type map_dim) const;
 
7382
       void      dis_idof   (const geo_size& gs, const geo_element& K, std::vector<size_type>& dis_idof) const;
 
7383
       basic_point<T> x_dof (const class geo_basic<T,M>& omega, size_type idof) const;
 
7384
       void set_ios_permutations (const class geo_basic<T,M>& omega,
 
7385
                     array<size_type,M>&   idof2ios_dis_idof,
 
7386
                     array<size_type,M>&   ios_idof2dis_idof) const;
 
7387
 
 
7388
     // i/o:
 
7389
 
 
7390
         void dump(std::ostream& out = std::cerr) const;
 
7391
     };
 
7392
 
 
7393
 
 
7394
File: rheolef.info,  Node: tetrahedron internal,  Up: Internals
 
7395
 
 
7396
8.3 `tetrahedron' - Tetraedron reference element
 
7397
================================================
 
7398
 
 
7399
(Source file: `nfem/geo_element/tetrahedron.icc') 
 
7400
 
 
7401
Description
 
7402
-----------
 
7403
 
 
7404
The tetrahedron reference element is
 
7405
             K = { 0 < x < 1 and 0 < y < 1-x and 0 < z < 1-x-y }
 
7406
 
 
7407
                            z
 
7408
                          .
 
7409
                        ,/
 
7410
                       /
 
7411
                     3
 
7412
                   ,/|`\\
 
7413
                 ,/  |  `\\
 
7414
               ,/    '.   `\\
 
7415
             ,/       |     `\\
 
7416
           ,/         |       `\\
 
7417
          0-----------'.--------2 --> y
 
7418
           `\\.         |      ,/
 
7419
              `\\.      |    ,/
 
7420
                 `\\.   '. ,/
 
7421
                    `\\. |/
 
7422
                       `1
 
7423
                          `\\.
 
7424
                            ` x
 
7425
Curved high order Pk tetrahedra (k >= 1) in 3d geometries are supported.
 
7426
These tetrahedra have additional edge-nodes, face-nodes and internal
 
7427
volume-nodes.
 
7428
 
 
7429
These nodes are numbered as
 
7430
---------------------------
 
7431
 
 
7432
first vertex, then edge-node, following the edge numbering order and
 
7433
orientation, then face-nodes following the face numbering order and
 
7434
orientation, and finally the face internal nodes, following the
 
7435
tetrahedron lattice.  See below for edges and faces numbering and
 
7436
orioentation.
 
7437
                     3
 
7438
                   ,/|`\\
 
7439
                 ,/  |  `\\
 
7440
               ,7    '.   `9
 
7441
             ,/       |     `\\
 
7442
           ,/         8       `\\
 
7443
          0--------6--'.--------2
 
7444
           `\\.         |      ,/
 
7445
              `\\.      |    ,5
 
7446
                 `4.   '. ,/
 
7447
                    `\\. |/
 
7448
                       `1
 
7449
                    P2
 
7450
 
 
7451
Numbering
 
7452
---------
 
7453
 
 
7454
The orientation is such that triedra (01, 02, 03) is direct, and all
 
7455
faces, see from exterior, are in the direct sens.  References: P. L.
 
7456
Georges, "Generation automatique de maillages", page 24-, coll RMA, 16,
 
7457
Masson, 1994.  Notice that the edge-nodes and face-nodes numbering
 
7458
slighly differ from those used in the `gmsh' mesh generator when using
 
7459
high-order elements.  This difference is handled by the `msh2geo' mesh
 
7460
file converter (*note msh2geo command::).
 
7461
 
 
7462
Implementation
 
7463
--------------
 
7464
 
 
7465
     const size_t dimension = 3;
 
7466
     const Float  measure = Float(1.)/Float(6.);
 
7467
     const size_t n_vertex = 4;
 
7468
     const Float vertex [n_vertex][dimension] = {
 
7469
             { 0, 0, 0 },
 
7470
             { 1, 0, 0 },
 
7471
             { 0, 1, 0 },
 
7472
             { 0, 0, 1 } };
 
7473
     const size_t  n_face = 4;
 
7474
     const size_t face [n_face][3] = {
 
7475
             { 0, 2, 1 },
 
7476
             { 0, 3, 2 },
 
7477
             { 0, 1, 3 },
 
7478
             { 1, 2, 3 } };
 
7479
     const size_t  n_edge = 6;
 
7480
     const size_t edge [n_edge][2] = {
 
7481
             { 0, 1 },
 
7482
             { 1, 2 },
 
7483
             { 2, 0 },
 
7484
             { 0, 3 },
 
7485
             { 1, 3 },
 
7486
             { 2, 3 } };
 
7487
 
 
7488
 
 
7489
File: rheolef.info,  Node: point internal,  Up: Internals
 
7490
 
 
7491
8.4 `point' - Point reference element
 
7492
=====================================
 
7493
 
 
7494
(Source file: `nfem/geo_element/point.icc') 
 
7495
 
 
7496
Description
 
7497
-----------
 
7498
 
 
7499
The point reference element is defined for convenience.    It is a
 
7500
0-dimensional element   with measure equal to 1.
 
7501
 
 
7502
Implementation
 
7503
--------------
 
7504
 
 
7505
     const size_t dimension = 0;
 
7506
     const size_t measure = 1;
 
7507
 
 
7508
 
 
7509
File: rheolef.info,  Node: scratch_array internal,  Up: Internals
 
7510
 
 
7511
8.5 scratch_array - container in distributed environment
 
7512
========================================================
 
7513
 
 
7514
(Source file: `nfem/geo_element/scratch_array.h')
 
7515
 
 
7516
Synopsys
 
7517
--------
 
7518
 
 
7519
STL-like vector container for a distributed memory machine model.
 
7520
Contrarily to array<T>, here T can have a size only known at compile
 
7521
time.  This class is used when T is a geo_element raw class, i.e.
 
7522
T=geo_element_e_raw.  The size of the geo_element depends upon the oder
 
7523
and is known only at run-time.  For efficiency purpose, the
 
7524
scratch_array allocate all geo_elements of the same variant (e.g. edge)
 
7525
and order in a contiguous area, since the coreesponding element size is
 
7526
constant.
 
7527
 
 
7528
Example
 
7529
-------
 
7530
 
 
7531
A sample usage of the class is:
 
7532
         std::pair<size_t,size_t> param (reference_element::t, 3); // triangle, order=3
 
7533
         scratch_array<geo_element_raw> x (distributor(100), param);
 
7534
The scratch_array<T> interface is similar to those of the array<T> one.
 
7535
 
 
7536
Object requirement
 
7537
------------------
 
7538
 
 
7539
There are many pre-requises for the template objet type T:
 
7540
         class T : public T::generic_type {
 
7541
          typedef variant_type;
 
7542
          typedef raw_type;
 
7543
          typedef genetic_type;
 
7544
          typedef automatic_type;
 
7545
          static const variant_type _variant;
 
7546
          static size_t _data_size(const parameter_type& param);
 
7547
          static size_t _value_size(const parameter_type& param);
 
7548
         };
 
7549
         class T::automatic_type : public T::generic_type {
 
7550
          automatic_type (const parameter_type& param);
 
7551
         };
 
7552
         class T::generic_type {
 
7553
          typedef raw_type;
 
7554
          typedef iterator;
 
7555
          typedef const_iterator;
 
7556
          iterator _data_begin();
 
7557
          const_iterator _data_begin() const;
 
7558
         };
 
7559
         ostream& operator<< (ostream&, const T::generic_type&);
 
7560
 
 
7561
Implementation
 
7562
--------------
 
7563
 
 
7564
     template <class T, class A>
 
7565
     class scratch_array<T,sequential,A> : public smart_pointer<scratch_array_seq_rep<T,A> > {
 
7566
     public:
 
7567
 
 
7568
     // typedefs:
 
7569
 
 
7570
         typedef scratch_array_seq_rep<T,A>    rep;
 
7571
         typedef smart_pointer<rep>            base;
 
7572
 
 
7573
         typedef sequential                    memory_type;
 
7574
         typedef typename rep::size_type       size_type;
 
7575
         typedef typename rep::value_type      value_type;
 
7576
         typedef typename rep::reference       reference;
 
7577
         typedef typename rep::dis_reference   dis_reference;
 
7578
         typedef typename rep::iterator        iterator;
 
7579
         typedef typename rep::const_reference const_reference;
 
7580
         typedef typename rep::const_iterator  const_iterator;
 
7581
         typedef typename rep::parameter_type  parameter_type;
 
7582
 
 
7583
     // allocators:
 
7584
 
 
7585
         scratch_array (const A& alloc = A());
 
7586
         scratch_array (size_type loc_size,           const parameter_type& param, const A& alloc = A());
 
7587
         void resize   (const distributor& ownership, const parameter_type& param);
 
7588
         scratch_array (const distributor& ownership, const parameter_type& param, const A& alloc = A());
 
7589
         void resize   (size_type loc_size,           const parameter_type& param);
 
7590
 
 
7591
     // local accessors & modifiers:
 
7592
 
 
7593
         A get_allocator() const              { return base::data().get_allocator(); }
 
7594
         size_type     size () const          { return base::data().size(); }
 
7595
         size_type dis_size () const          { return base::data().dis_size(); }
 
7596
         const distributor& ownership() const { return base::data().ownership(); }
 
7597
         const communicator& comm() const     { return ownership().comm(); }
 
7598
 
 
7599
         reference       operator[] (size_type i)       { return base::data().operator[] (i); }
 
7600
         const_reference operator[] (size_type i) const { return base::data().operator[] (i); }
 
7601
 
 
7602
               iterator begin()       { return base::data().begin(); }
 
7603
         const_iterator begin() const { return base::data().begin(); }
 
7604
               iterator end()         { return base::data().end(); }
 
7605
         const_iterator end() const   { return base::data().end(); }
 
7606
 
 
7607
     // global modifiers (for compatibility with distributed interface):
 
7608
 
 
7609
         dis_reference dis_entry (size_type dis_i) { return operator[] (dis_i); }
 
7610
         void dis_entry_assembly()                 {}
 
7611
         template<class SetOp>
 
7612
         void dis_entry_assembly(SetOp my_set_op)        {}
 
7613
         template<class SetOp>
 
7614
         void dis_entry_assembly_begin (SetOp my_set_op) {}
 
7615
         template<class SetOp>
 
7616
         void dis_entry_assembly_end (SetOp my_set_op)   {}
 
7617
 
 
7618
     // apply a partition:
 
7619
 
 
7620
     #ifdef TODO
 
7621
         template<class RepSize>
 
7622
         void repartition (                               // old_numbering for *this
 
7623
             const RepSize&         partition,            // old_ownership
 
7624
             scratch_array<T,sequential,A>& new_array,            // new_ownership (created)
 
7625
             RepSize&               old_numbering,        // new_ownership
 
7626
             RepSize&               new_numbering) const  // old_ownership
 
7627
             { return base::data().repartition (partition, new_array, old_numbering, new_numbering); }
 
7628
 
 
7629
         template<class RepSize>
 
7630
         void permutation_apply (                       // old_numbering for *this
 
7631
             const RepSize&          new_numbering,     // old_ownership
 
7632
             scratch_array<T,sequential,A>&  new_array) const   // new_ownership (already allocated)
 
7633
             { return base::data().permutation_apply (new_numbering, new_array); }
 
7634
     #endif // TODO
 
7635
 
 
7636
     // i/o:
 
7637
 
 
7638
         odiststream& put_values (odiststream& ops) const { return base::data().put_values(ops); }
 
7639
         idiststream& get_values (idiststream& ips)       { return base::data().get_values(ips); }
 
7640
         template <class GetFunction>
 
7641
         idiststream& get_values (idiststream& ips, GetFunction get_element)       { return base::data().get_values(ips, get_element); }
 
7642
         template <class PutFunction>
 
7643
         odiststream& put_values (odiststream& ops, PutFunction put_element) const { return base::data().put_values(ops, put_element); }
 
7644
     #ifdef TODO
 
7645
         void dump (std::string name) const { return base::data().dump(name); }
 
7646
     #endif // TODO
 
7647
     };
 
7648
 
 
7649
Implementation
 
7650
--------------
 
7651
 
 
7652
     template <class T, class A>
 
7653
     class scratch_array<T,distributed,A> : public smart_pointer<scratch_array_mpi_rep<T,A> > {
 
7654
     public:
 
7655
 
 
7656
     // typedefs:
 
7657
 
 
7658
         typedef scratch_array_mpi_rep<T,A>    rep;
 
7659
         typedef smart_pointer<rep>            base;
 
7660
 
 
7661
         typedef distributed                   memory_type;
 
7662
         typedef typename rep::size_type       size_type;
 
7663
         typedef typename rep::value_type      value_type;
 
7664
         typedef typename rep::reference       reference;
 
7665
         typedef typename rep::dis_reference   dis_reference;
 
7666
         typedef typename rep::iterator        iterator;
 
7667
         typedef typename rep::parameter_type  parameter_type;
 
7668
         typedef typename rep::const_reference const_reference;
 
7669
         typedef typename rep::const_iterator  const_iterator;
 
7670
         typedef typename rep::scatter_map_type scatter_map_type;
 
7671
 
 
7672
     // allocators:
 
7673
 
 
7674
         scratch_array (const A& alloc = A());
 
7675
         scratch_array (const distributor& ownership, const parameter_type& param, const A& alloc = A());
 
7676
         void resize   (const distributor& ownership, const parameter_type& param);
 
7677
 
 
7678
     // local accessors & modifiers:
 
7679
 
 
7680
         A get_allocator() const              { return base::data().get_allocator(); }
 
7681
         size_type     size () const          { return base::data().size(); }
 
7682
         size_type dis_size () const          { return base::data().dis_size(); }
 
7683
         const distributor& ownership() const { return base::data().ownership(); }
 
7684
         const communicator& comm() const     { return base::data().comm(); }
 
7685
 
 
7686
         reference       operator[] (size_type i)       { return base::data().operator[] (i); }
 
7687
         const_reference operator[] (size_type i) const { return base::data().operator[] (i); }
 
7688
 
 
7689
               iterator begin()       { return base::data().begin(); }
 
7690
         const_iterator begin() const { return base::data().begin(); }
 
7691
               iterator end()         { return base::data().end(); }
 
7692
         const_iterator end() const   { return base::data().end(); }
 
7693
 
 
7694
     // global accessor:
 
7695
 
 
7696
         template<class Set, class Map>
 
7697
         void append_dis_entry (const Set& ext_idx_set, Map& ext_idx_map) const { base::data().append_dis_entry (ext_idx_set, ext_idx_map); }
 
7698
 
 
7699
         template<class Set, class Map>
 
7700
         void get_dis_entry    (const Set& ext_idx_set, Map& ext_idx_map) const { base::data().get_dis_entry (ext_idx_set, ext_idx_map); }
 
7701
 
 
7702
         template<class Set>
 
7703
         void append_dis_indexes (const Set& ext_idx_set)  { base::data().append_dis_indexes (ext_idx_set); }
 
7704
 
 
7705
         template<class Set>
 
7706
         void set_dis_indexes    (const Set& ext_idx_set)  { base::data().set_dis_indexes (ext_idx_set); }
 
7707
 
 
7708
         const_reference dis_at (size_type dis_i) const { return base::data().dis_at (dis_i); }
 
7709
 
 
7710
         // get all external pairs (dis_i, values):
 
7711
         const scatter_map_type& get_dis_map_entries() const { return base::data().get_dis_map_entries(); }
 
7712
 
 
7713
     // global modifiers (for compatibility with distributed interface):
 
7714
 
 
7715
         dis_reference dis_entry (size_type dis_i)       { return base::data().dis_entry(dis_i); }
 
7716
 
 
7717
         void dis_entry_assembly()                       { return base::data().dis_entry_assembly(); }
 
7718
 
 
7719
         template<class SetOp>
 
7720
         void dis_entry_assembly       (SetOp my_set_op) { return base::data().dis_entry_assembly       (my_set_op); }
 
7721
         template<class SetOp>
 
7722
         void dis_entry_assembly_begin (SetOp my_set_op) { return base::data().dis_entry_assembly_begin (my_set_op); }
 
7723
         template<class SetOp>
 
7724
         void dis_entry_assembly_end   (SetOp my_set_op) { return base::data().dis_entry_assembly_end   (my_set_op); }
 
7725
 
 
7726
     // apply a partition:
 
7727
 
 
7728
         template<class RepSize>
 
7729
         void repartition (                              // old_numbering for *this
 
7730
             const RepSize&        partition,            // old_ownership
 
7731
             scratch_array<T,distributed>& new_array,            // new_ownership (created)
 
7732
             RepSize&              old_numbering,        // new_ownership
 
7733
             RepSize&              new_numbering) const  // old_ownership
 
7734
             { return base::data().repartition (partition.data(), new_array.data(), old_numbering.data(), new_numbering.data()); }
 
7735
 
 
7736
     #ifdef TODO
 
7737
         template<class RepSize>
 
7738
         void permutation_apply (                       // old_numbering for *this
 
7739
             const RepSize&          new_numbering,     // old_ownership
 
7740
             scratch_array<T,distributed,A>& new_array) const   // new_ownership (already allocated)
 
7741
             { base::data().permutation_apply (new_numbering.data(), new_array.data()); }
 
7742
 
 
7743
         void reverse_permutation (                                 // old_ownership for *this=iold2dis_inew
 
7744
             scratch_array<size_type,distributed,A>& inew2dis_iold) const   // new_ownership
 
7745
             { base::data().reverse_permutation (inew2dis_iold.data()); }
 
7746
     #endif // TODO
 
7747
 
 
7748
     // i/o:
 
7749
 
 
7750
         odiststream& put_values (odiststream& ops) const { return base::data().put_values(ops); }
 
7751
         idiststream& get_values (idiststream& ips)       { return base::data().get_values(ips); }
 
7752
     #ifdef TODO
 
7753
         void dump (std::string name) const      { return base::data().dump(name); }
 
7754
     #endif // TODO
 
7755
 
 
7756
         template <class GetFunction>
 
7757
         idiststream& get_values (idiststream& ips, GetFunction get_element)
 
7758
                  { return base::data().get_values(ips, get_element); }
 
7759
         template <class PutFunction>
 
7760
         odiststream& put_values (odiststream& ops, PutFunction put_element) const
 
7761
                  { return base::data().put_values(ops, put_element); }
 
7762
 
 
7763
         template <class PutFunction, class Permutation>
 
7764
         odiststream& permuted_put_values (
 
7765
             odiststream&                       ops,
 
7766
             const Permutation&                 perm,
 
7767
             PutFunction                        put_element) const
 
7768
                  { return base::data().permuted_put_values (ops, perm.data(), put_element); }
 
7769
     };
 
7770
 
 
7771
 
 
7772
File: rheolef.info,  Node: hexa internal,  Up: Internals
 
7773
 
 
7774
8.6 `hexa' - Hexaedra reference element
 
7775
=======================================
 
7776
 
 
7777
(Source file: `nfem/geo_element/hexa.icc') 
 
7778
 
 
7779
Description
 
7780
-----------
 
7781
 
 
7782
The hexa reference element is [-1,1]^3.
 
7783
          ^ z
 
7784
          |
 
7785
          4----------7
 
7786
          |\\         |\\
 
7787
          | \\        | \\
 
7788
          |  \\       |  \\
 
7789
          |   5------+---6
 
7790
          |   |      |   |
 
7791
          0---+------3 - | ---> y
 
7792
           \\  |       \\  |
 
7793
            \\ |        \\ |
 
7794
             \\|         \\|
 
7795
              1----------2
 
7796
               \\
 
7797
                x
 
7798
Curved high order Pk hexaedrons (k >= 1) in 3d geometries are supported.
 
7799
These hexaedrons have additional edge-nodes, face-nodes and internal
 
7800
volume-nodes.
 
7801
 
 
7802
These nodes are numbered as
 
7803
---------------------------
 
7804
 
 
7805
first vertex, then edge-node, following the edge numbering order and
 
7806
orientation, then face-nodes following the face numbering order and
 
7807
orientation, and finally the face internal nodes, following the
 
7808
hexaedra lattice.  See below for edges and faces numbering and
 
7809
orioentation.
 
7810
          4----19----7
 
7811
          |\\         |\\
 
7812
          |16    23  | 18
 
7813
         12  \\ 21    15 \\
 
7814
          |   5----17+---6
 
7815
          |22 |  26  | 25|
 
7816
          0---+-11---3   |
 
7817
           \\ 13    24 \\  14
 
7818
            8 |  20    10|
 
7819
             \\|         \\|
 
7820
              1-----9----2
 
7821
                  P2
 
7822
 
 
7823
Numbering
 
7824
---------
 
7825
 
 
7826
The orientation is such that triedra (01, 03, 04) is direct and all
 
7827
faces, see from exterior, are in the direct sens.  References: P. L.
 
7828
Georges, "Generation automatique de maillages", page 24-, coll RMA, 16,
 
7829
Masson, 1994.  Notice that the edge-nodes and face-nodes numbering
 
7830
slighly differ from those used in the `gmsh' mesh generator when using
 
7831
high-order elements.  This difference is handled by the `msh2geo' mesh
 
7832
file converter (*note msh2geo command::).
 
7833
 
 
7834
Implementation
 
7835
--------------
 
7836
 
 
7837
     const size_t dimension = 3;
 
7838
     const Float  measure = 8;
 
7839
     const size_t n_vertex = 8;
 
7840
     const Float vertex [n_vertex][dimension] = {
 
7841
             {-1,-1,-1 },
 
7842
             { 1,-1,-1 },
 
7843
             { 1, 1,-1 },
 
7844
             {-1, 1,-1 },
 
7845
             {-1,-1, 1 },
 
7846
             { 1,-1, 1 },
 
7847
             { 1, 1, 1 },
 
7848
             {-1, 1, 1 } };
 
7849
     const size_t  n_face = 6;
 
7850
     const size_t face [n_face][4] = {
 
7851
             {0, 3, 2, 1 },
 
7852
             {0, 4, 7, 3 },
 
7853
             {0, 1, 5, 4 },
 
7854
             {4, 5, 6, 7 },
 
7855
             {1, 2, 6, 5 },
 
7856
             {2, 3, 7, 6 } };
 
7857
     const size_t  n_edge = 12;
 
7858
     const size_t edge [n_edge][2] = {
 
7859
             {0, 1 },
 
7860
             {1, 2 },
 
7861
             {2, 3 },
 
7862
             {3, 0 },
 
7863
             {0, 4 },
 
7864
             {1, 5 },
 
7865
             {2, 6 },
 
7866
             {3, 7 },
 
7867
             {4, 5 },
 
7868
             {5, 6 },
 
7869
             {6, 7 },
 
7870
             {7, 4 } };
 
7871
 
 
7872
 
 
7873
File: rheolef.info,  Node: tetra internal,  Up: Internals
 
7874
 
 
7875
8.7 `tetra' - Tetraedra reference element
 
7876
=========================================
 
7877
 
 
7878
(Source file: `nfem/geo_element/tetra.icc') 
 
7879
 
 
7880
Description
 
7881
-----------
 
7882
 
 
7883
The tetrahedron reference element is
 
7884
             K = { 0 < x < 1 and 0 < y < 1-x and 0 < z < 1-x-y }
 
7885
 
 
7886
                            z
 
7887
                          .
 
7888
                        ,/
 
7889
                       /
 
7890
                     3
 
7891
                   ,/|`\\
 
7892
                 ,/  |  `\\
 
7893
               ,/    '.   `\\
 
7894
             ,/       |     `\\
 
7895
           ,/         |       `\\
 
7896
          0-----------'.--------2 --> y
 
7897
           `\\.         |      ,/
 
7898
              `\\.      |    ,/
 
7899
                 `\\.   '. ,/
 
7900
                    `\\. |/
 
7901
                       `1
 
7902
                          `\\.
 
7903
                            ` x
 
7904
Curved high order Pk tetrahedra (k >= 1) in 3d geometries are supported.
 
7905
These tetrahedra have additional edge-nodes, face-nodes and internal
 
7906
volume-nodes.
 
7907
 
 
7908
These nodes are numbered as
 
7909
---------------------------
 
7910
 
 
7911
first vertex, then edge-node, following the edge numbering order and
 
7912
orientation, then face-nodes following the face numbering order and
 
7913
orientation, and finally the face internal nodes, following the
 
7914
tetrahedron lattice.  See below for edges and faces numbering and
 
7915
orioentation.
 
7916
                     3
 
7917
                   ,/|`\\
 
7918
                 ,/  |  `\\
 
7919
               ,7    '.   `9
 
7920
             ,/       |     `\\
 
7921
           ,/         8       `\\
 
7922
          0--------6--'.--------2
 
7923
           `\\.         |      ,/
 
7924
              `\\.      |    ,5
 
7925
                 `4.   '. ,/
 
7926
                    `\\. |/
 
7927
                       `1
 
7928
                    P2
 
7929
 
 
7930
Numbering
 
7931
---------
 
7932
 
 
7933
The orientation is such that triedra (01, 02, 03) is direct, and all
 
7934
faces, see from exterior, are in the direct sens.  References: P. L.
 
7935
Georges, "Generation automatique de maillages", page 24-, coll RMA, 16,
 
7936
Masson, 1994.  Notice that the edge-nodes and face-nodes numbering
 
7937
slighly differ from those used in the `gmsh' mesh generator when using
 
7938
high-order elements.  This difference is handled by the `msh2geo' mesh
 
7939
file converter (*note msh2geo command::).
 
7940
 
 
7941
Implementation
 
7942
--------------
 
7943
 
 
7944
     const size_t dimension = 3;
 
7945
     const Float  measure = Float(1.)/Float(6.);
 
7946
     const size_t n_vertex = 4;
 
7947
     const Float vertex [n_vertex][dimension] = {
 
7948
             { 0, 0, 0 },
 
7949
             { 1, 0, 0 },
 
7950
             { 0, 1, 0 },
 
7951
             { 0, 0, 1 } };
 
7952
     const size_t  n_face = 4;
 
7953
     const size_t face [n_face][3] = {
 
7954
             { 0, 2, 1 },
 
7955
             { 0, 3, 2 },
 
7956
             { 0, 1, 3 },
 
7957
             { 1, 2, 3 } };
 
7958
     const size_t  n_edge = 6;
 
7959
     const size_t edge [n_edge][2] = {
 
7960
             { 0, 1 },
 
7961
             { 1, 2 },
 
7962
             { 2, 0 },
 
7963
             { 0, 3 },
 
7964
             { 1, 3 },
 
7965
             { 2, 3 } };
 
7966
 
 
7967
 
 
7968
File: rheolef.info,  Node: hexahedron internal,  Up: Internals
 
7969
 
 
7970
8.8 `hexahedron' - Hexaedron reference element
 
7971
==============================================
 
7972
 
 
7973
(Source file: `nfem/geo_element/hexahedron.icc') 
 
7974
 
 
7975
Description
 
7976
-----------
 
7977
 
 
7978
The hexahedron reference element is [-1,1]^3.
 
7979
          ^ z
 
7980
          |
 
7981
          4----------7
 
7982
          |\\         |\\
 
7983
          | \\        | \\
 
7984
          |  \\       |  \\
 
7985
          |   5------+---6
 
7986
          |   |      |   |
 
7987
          0---+------3 - | ---> y
 
7988
           \\  |       \\  |
 
7989
            \\ |        \\ |
 
7990
             \\|         \\|
 
7991
              1----------2
 
7992
               \\
 
7993
                x
 
7994
Curved high order Pk hexaedra (k >= 1) in 3d geometries are supported.
 
7995
These hexaedra have additional edge-nodes, face-nodes and internal
 
7996
volume-nodes.
 
7997
 
 
7998
These nodes are numbered as
 
7999
---------------------------
 
8000
 
 
8001
first vertex, then edge-node, following the edge numbering order and
 
8002
orientation, then face-nodes following the face numbering order and
 
8003
orientation, and finally the face internal nodes, following the
 
8004
hexaedron lattice.  See below for edges and faces numbering and
 
8005
orioentation.
 
8006
          4----19----7
 
8007
          |\\         |\\
 
8008
          |16    23  | 18
 
8009
         12  \\ 21    15 \\
 
8010
          |   5----17+---6
 
8011
          |22 |  26  | 25|
 
8012
          0---+-11---3   |
 
8013
           \\ 13    24 \\  14
 
8014
            8 |  20    10|
 
8015
             \\|         \\|
 
8016
              1-----9----2
 
8017
                  P2
 
8018
 
 
8019
Numbering
 
8020
---------
 
8021
 
 
8022
The orientation is such that triedra (01, 03, 04) is direct and all
 
8023
faces, see from exterior, are in the direct sens.  References: P. L.
 
8024
Georges, "Generation automatique de maillages", page 24-, coll RMA, 16,
 
8025
Masson, 1994.  Notice that the edge-nodes and face-nodes numbering
 
8026
slighly differ from those used in the `gmsh' mesh generator when using
 
8027
high-order elements.  This difference is handled by the `msh2geo' mesh
 
8028
file converter (*note msh2geo command::).
 
8029
 
 
8030
Implementation
 
8031
--------------
 
8032
 
 
8033
     const size_t dimension = 3;
 
8034
     const Float  measure = 8;
 
8035
     const size_t n_vertex = 8;
 
8036
     const Float vertex [n_vertex][dimension] = {
 
8037
             {-1,-1,-1 },
 
8038
             { 1,-1,-1 },
 
8039
             { 1, 1,-1 },
 
8040
             {-1, 1,-1 },
 
8041
             {-1,-1, 1 },
 
8042
             { 1,-1, 1 },
 
8043
             { 1, 1, 1 },
 
8044
             {-1, 1, 1 } };
 
8045
     const size_t  n_face = 6;
 
8046
     const size_t face [n_face][4] = {
 
8047
             {0, 3, 2, 1 },
 
8048
             {0, 4, 7, 3 },
 
8049
             {0, 1, 5, 4 },
 
8050
             {4, 5, 6, 7 },
 
8051
             {1, 2, 6, 5 },
 
8052
             {2, 3, 7, 6 } };
 
8053
     const size_t  n_edge = 12;
 
8054
     const size_t edge [n_edge][2] = {
 
8055
             {0, 1 },
 
8056
             {1, 2 },
 
8057
             {2, 3 },
 
8058
             {3, 0 },
 
8059
             {0, 4 },
 
8060
             {1, 5 },
 
8061
             {2, 6 },
 
8062
             {3, 7 },
 
8063
             {4, 5 },
 
8064
             {5, 6 },
 
8065
             {6, 7 },
 
8066
             {7, 4 } };
 
8067
 
 
8068
 
 
8069
File: rheolef.info,  Node: hack_array internal,  Up: Internals
 
8070
 
 
8071
8.9 hack_array - container in distributed environment
 
8072
=====================================================
 
8073
 
 
8074
(Source file: `nfem/geo_element/hack_array.h')
 
8075
 
 
8076
Synopsys
 
8077
--------
 
8078
 
 
8079
STL-like vector container for a distributed memory machine model.
 
8080
Contrarily to array<T>, here T can have a size only known at compile
 
8081
time.  This class is used when T is a geo_element raw class, i.e.
 
8082
T=geo_element_e_raw.  The size of the geo_element depends upon the oder
 
8083
and is known only at run-time.  For efficiency purpose, the hack_array
 
8084
allocate all geo_elements of the same variant (e.g. edge) and order in
 
8085
a contiguous area, since the coreesponding element size is constant.
 
8086
 
 
8087
Example
 
8088
-------
 
8089
 
 
8090
A sample usage of the class is:
 
8091
         std::pair<size_t,size_t> param (reference_element::t, 3); // triangle, order=3
 
8092
         hack_array<geo_element_raw> x (distributor(100), param);
 
8093
The hack_array<T> interface is similar to those of the array<T> one.
 
8094
 
 
8095
Object requirement
 
8096
------------------
 
8097
 
 
8098
There are many pre-requises for the template objet type T:
 
8099
         class T : public T::generic_type {
 
8100
          typedef variant_type;
 
8101
          typedef raw_type;
 
8102
          typedef genetic_type;
 
8103
          typedef automatic_type;
 
8104
          static const variant_type _variant;
 
8105
          static size_t _data_size(const parameter_type& param);
 
8106
          static size_t _value_size(const parameter_type& param);
 
8107
         };
 
8108
         class T::automatic_type : public T::generic_type {
 
8109
          automatic_type (const parameter_type& param);
 
8110
         };
 
8111
         class T::generic_type {
 
8112
          typedef raw_type;
 
8113
          typedef iterator;
 
8114
          typedef const_iterator;
 
8115
          iterator _data_begin();
 
8116
          const_iterator _data_begin() const;
 
8117
         };
 
8118
         ostream& operator<< (ostream&, const T::generic_type&);
 
8119
 
 
8120
Implementation
 
8121
--------------
 
8122
 
 
8123
     template <class T, class A>
 
8124
     class hack_array<T,sequential,A> : public smart_pointer<hack_array_seq_rep<T,A> > {
 
8125
     public:
 
8126
 
 
8127
     // typedefs:
 
8128
 
 
8129
         typedef hack_array_seq_rep<T,A>    rep;
 
8130
         typedef smart_pointer<rep>            base;
 
8131
 
 
8132
         typedef sequential                    memory_type;
 
8133
         typedef typename rep::size_type       size_type;
 
8134
         typedef typename rep::value_type      value_type;
 
8135
         typedef typename rep::reference       reference;
 
8136
         typedef typename rep::dis_reference   dis_reference;
 
8137
         typedef typename rep::iterator        iterator;
 
8138
         typedef typename rep::const_reference const_reference;
 
8139
         typedef typename rep::const_iterator  const_iterator;
 
8140
         typedef typename rep::parameter_type  parameter_type;
 
8141
 
 
8142
     // allocators:
 
8143
 
 
8144
         hack_array (const A& alloc = A());
 
8145
         hack_array (size_type loc_size,           const parameter_type& param, const A& alloc = A());
 
8146
         void resize   (const distributor& ownership, const parameter_type& param);
 
8147
         hack_array (const distributor& ownership, const parameter_type& param, const A& alloc = A());
 
8148
         void resize   (size_type loc_size,           const parameter_type& param);
 
8149
 
 
8150
     // local accessors & modifiers:
 
8151
 
 
8152
         A get_allocator() const              { return base::data().get_allocator(); }
 
8153
         size_type     size () const          { return base::data().size(); }
 
8154
         size_type dis_size () const          { return base::data().dis_size(); }
 
8155
         const distributor& ownership() const { return base::data().ownership(); }
 
8156
         const communicator& comm() const     { return ownership().comm(); }
 
8157
 
 
8158
         reference       operator[] (size_type i)       { return base::data().operator[] (i); }
 
8159
         const_reference operator[] (size_type i) const { return base::data().operator[] (i); }
 
8160
 
 
8161
               iterator begin()       { return base::data().begin(); }
 
8162
         const_iterator begin() const { return base::data().begin(); }
 
8163
               iterator end()         { return base::data().end(); }
 
8164
         const_iterator end() const   { return base::data().end(); }
 
8165
 
 
8166
     // global modifiers (for compatibility with distributed interface):
 
8167
 
 
8168
         dis_reference dis_entry (size_type dis_i) { return operator[] (dis_i); }
 
8169
         void dis_entry_assembly()                 {}
 
8170
         template<class SetOp>
 
8171
         void dis_entry_assembly(SetOp my_set_op)        {}
 
8172
         template<class SetOp>
 
8173
         void dis_entry_assembly_begin (SetOp my_set_op) {}
 
8174
         template<class SetOp>
 
8175
         void dis_entry_assembly_end (SetOp my_set_op)   {}
 
8176
 
 
8177
     // apply a partition:
 
8178
 
 
8179
     #ifdef TODO
 
8180
         template<class RepSize>
 
8181
         void repartition (                               // old_numbering for *this
 
8182
             const RepSize&         partition,            // old_ownership
 
8183
             hack_array<T,sequential,A>& new_array,       // new_ownership (created)
 
8184
             RepSize&               old_numbering,        // new_ownership
 
8185
             RepSize&               new_numbering) const  // old_ownership
 
8186
             { return base::data().repartition (partition, new_array, old_numbering, new_numbering); }
 
8187
 
 
8188
         template<class RepSize>
 
8189
         void permutation_apply (                       // old_numbering for *this
 
8190
             const RepSize&          new_numbering,     // old_ownership
 
8191
             hack_array<T,sequential,A>&  new_array) const   // new_ownership (already allocated)
 
8192
             { return base::data().permutation_apply (new_numbering, new_array); }
 
8193
     #endif // TODO
 
8194
 
 
8195
     // i/o:
 
8196
 
 
8197
         odiststream& put_values (odiststream& ops) const { return base::data().put_values(ops); }
 
8198
         idiststream& get_values (idiststream& ips)       { return base::data().get_values(ips); }
 
8199
         template <class GetFunction>
 
8200
         idiststream& get_values (idiststream& ips, GetFunction get_element)       { return base::data().get_values(ips, get_element); }
 
8201
         template <class PutFunction>
 
8202
         odiststream& put_values (odiststream& ops, PutFunction put_element) const { return base::data().put_values(ops, put_element); }
 
8203
     #ifdef TODO
 
8204
         void dump (std::string name) const { return base::data().dump(name); }
 
8205
     #endif // TODO
 
8206
     };
 
8207
 
 
8208
Implementation
 
8209
--------------
 
8210
 
 
8211
     template <class T, class A>
 
8212
     class hack_array<T,distributed,A> : public smart_pointer<hack_array_mpi_rep<T,A> > {
 
8213
     public:
 
8214
 
 
8215
     // typedefs:
 
8216
 
 
8217
         typedef hack_array_mpi_rep<T,A>    rep;
 
8218
         typedef smart_pointer<rep>            base;
 
8219
 
 
8220
         typedef distributed                   memory_type;
 
8221
         typedef typename rep::size_type       size_type;
 
8222
         typedef typename rep::value_type      value_type;
 
8223
         typedef typename rep::reference       reference;
 
8224
         typedef typename rep::dis_reference   dis_reference;
 
8225
         typedef typename rep::iterator        iterator;
 
8226
         typedef typename rep::parameter_type  parameter_type;
 
8227
         typedef typename rep::const_reference const_reference;
 
8228
         typedef typename rep::const_iterator  const_iterator;
 
8229
         typedef typename rep::scatter_map_type scatter_map_type;
 
8230
 
 
8231
     // allocators:
 
8232
 
 
8233
         hack_array (const A& alloc = A());
 
8234
         hack_array (const distributor& ownership, const parameter_type& param, const A& alloc = A());
 
8235
         void resize   (const distributor& ownership, const parameter_type& param);
 
8236
 
 
8237
     // local accessors & modifiers:
 
8238
 
 
8239
         A get_allocator() const              { return base::data().get_allocator(); }
 
8240
         size_type     size () const          { return base::data().size(); }
 
8241
         size_type dis_size () const          { return base::data().dis_size(); }
 
8242
         const distributor& ownership() const { return base::data().ownership(); }
 
8243
         const communicator& comm() const     { return base::data().comm(); }
 
8244
 
 
8245
         reference       operator[] (size_type i)       { return base::data().operator[] (i); }
 
8246
         const_reference operator[] (size_type i) const { return base::data().operator[] (i); }
 
8247
 
 
8248
               iterator begin()       { return base::data().begin(); }
 
8249
         const_iterator begin() const { return base::data().begin(); }
 
8250
               iterator end()         { return base::data().end(); }
 
8251
         const_iterator end() const   { return base::data().end(); }
 
8252
 
 
8253
     // global accessor:
 
8254
 
 
8255
         template<class Set, class Map>
 
8256
         void append_dis_entry (const Set& ext_idx_set, Map& ext_idx_map) const { base::data().append_dis_entry (ext_idx_set, ext_idx_map); }
 
8257
 
 
8258
         template<class Set, class Map>
 
8259
         void get_dis_entry    (const Set& ext_idx_set, Map& ext_idx_map) const { base::data().get_dis_entry (ext_idx_set, ext_idx_map); }
 
8260
 
 
8261
         template<class Set>
 
8262
         void append_dis_indexes (const Set& ext_idx_set)  { base::data().append_dis_indexes (ext_idx_set); }
 
8263
 
 
8264
         template<class Set>
 
8265
         void set_dis_indexes    (const Set& ext_idx_set)  { base::data().set_dis_indexes (ext_idx_set); }
 
8266
 
 
8267
         const_reference dis_at (size_type dis_i) const { return base::data().dis_at (dis_i); }
 
8268
 
 
8269
         // get all external pairs (dis_i, values):
 
8270
         const scatter_map_type& get_dis_map_entries() const { return base::data().get_dis_map_entries(); }
 
8271
 
 
8272
     // global modifiers (for compatibility with distributed interface):
 
8273
 
 
8274
         dis_reference dis_entry (size_type dis_i)       { return base::data().dis_entry(dis_i); }
 
8275
 
 
8276
         void dis_entry_assembly()                       { return base::data().dis_entry_assembly(); }
 
8277
 
 
8278
         template<class SetOp>
 
8279
         void dis_entry_assembly       (SetOp my_set_op) { return base::data().dis_entry_assembly       (my_set_op); }
 
8280
         template<class SetOp>
 
8281
         void dis_entry_assembly_begin (SetOp my_set_op) { return base::data().dis_entry_assembly_begin (my_set_op); }
 
8282
         template<class SetOp>
 
8283
         void dis_entry_assembly_end   (SetOp my_set_op) { return base::data().dis_entry_assembly_end   (my_set_op); }
 
8284
 
 
8285
     // apply a partition:
 
8286
 
 
8287
         template<class RepSize>
 
8288
         void repartition (                              // old_numbering for *this
 
8289
             const RepSize&        partition,            // old_ownership
 
8290
             hack_array<T,distributed>& new_array,            // new_ownership (created)
 
8291
             RepSize&              old_numbering,        // new_ownership
 
8292
             RepSize&              new_numbering) const  // old_ownership
 
8293
             { return base::data().repartition (partition.data(), new_array.data(), old_numbering.data(), new_numbering.data()); }
 
8294
 
 
8295
     #ifdef TODO
 
8296
         template<class RepSize>
 
8297
         void permutation_apply (                       // old_numbering for *this
 
8298
             const RepSize&          new_numbering,     // old_ownership
 
8299
             hack_array<T,distributed,A>& new_array) const   // new_ownership (already allocated)
 
8300
             { base::data().permutation_apply (new_numbering.data(), new_array.data()); }
 
8301
 
 
8302
         void reverse_permutation (                                 // old_ownership for *this=iold2dis_inew
 
8303
             hack_array<size_type,distributed,A>& inew2dis_iold) const   // new_ownership
 
8304
             { base::data().reverse_permutation (inew2dis_iold.data()); }
 
8305
     #endif // TODO
 
8306
 
 
8307
     // i/o:
 
8308
 
 
8309
         odiststream& put_values (odiststream& ops) const { return base::data().put_values(ops); }
 
8310
         idiststream& get_values (idiststream& ips)       { return base::data().get_values(ips); }
 
8311
     #ifdef TODO
 
8312
         void dump (std::string name) const      { return base::data().dump(name); }
 
8313
     #endif // TODO
 
8314
 
 
8315
         template <class GetFunction>
 
8316
         idiststream& get_values (idiststream& ips, GetFunction get_element)
 
8317
                  { return base::data().get_values(ips, get_element); }
 
8318
         template <class PutFunction>
 
8319
         odiststream& put_values (odiststream& ops, PutFunction put_element) const
 
8320
                  { return base::data().put_values(ops, put_element); }
 
8321
 
 
8322
         template <class PutFunction, class Permutation>
 
8323
         odiststream& permuted_put_values (
 
8324
             odiststream&                       ops,
 
8325
             const Permutation&                 perm,
 
8326
             PutFunction                        put_element) const
 
8327
                  { return base::data().permuted_put_values (ops, perm.data(), put_element); }
 
8328
     };
 
8329
 
 
8330
 
6807
8331
File: rheolef.info,  Node: reference_element internal,  Up: Internals
6808
8332
 
6809
 
8.7 `reference_element' - reference element
6810
 
===========================================
 
8333
8.10 `reference_element' - reference element
 
8334
============================================
6811
8335
 
6812
 
(Source file: `nfem/basis/reference_element.h') 
 
8336
(Source file: `nfem/geo_element/reference_element.h') 
6813
8337
 
6814
8338
Synopsys
6815
8339
--------
6841
8365
Implementation
6842
8366
--------------
6843
8367
 
 
8368
 
6844
8369
     class reference_element {
6845
8370
     public:
6846
8371
 
6847
 
 
6848
8372
     // typedefs:
6849
8373
 
6850
8374
         typedef std::vector<int>::size_type size_type;
6851
8375
 
6852
 
         // defines enum_type { p, t, q ..., H, ...};
 
8376
         // defines variant_type { p, t, q ..., H, ...};
6853
8377
         // in an automatically generated file :
6854
8378
 
6855
 
         typedef enum {
 
8379
         typedef size_type variant_type;
 
8380
         static const variant_type
6856
8381
             p = 0,
6857
8382
             e = 1,
6858
8383
             t = 2,
6860
8385
             T = 4,
6861
8386
             P = 5,
6862
8387
             H = 6,
6863
 
             max_size = 7
6864
 
         } enum_type;
6865
 
 
6866
 
         typedef enum {
6867
 
             Lagrange = 0,
6868
 
             Hermite = 1,
6869
 
             dof_family_max =2
6870
 
         } dof_family_type;
6871
 
 
6872
 
     // constants:
6873
 
 
6874
 
         static const size_type not_set;
6875
 
         static const size_type max_n_subgeo      = 12;
6876
 
         static const size_type max_subgeo_vertex = 8;
 
8388
             max_variant = 7;
 
8389
 
 
8390
         typedef size_type dof_family_type; // TODO: move elsewhere (not a ref elem concept...)
 
8391
         static const dof_family_type
 
8392
             Lagrange       = 0,
 
8393
             Hermite        = 1,
 
8394
             dof_family_max = 2;
6877
8395
 
6878
8396
     // allocators/deallocators:
6879
8397
 
6880
 
         reference_element (enum_type x = max_size);
 
8398
         reference_element (variant_type x = max_variant)
 
8399
           : _x(x) { assert_macro (x >= 0 && x <= max_variant, "invalid type " << x); }
6881
8400
 
6882
8401
     // accessors:
6883
8402
 
6884
 
         enum_type type() const;
6885
 
         char name() const;
6886
 
         size_type dimension() const;
 
8403
         variant_type variant() const { return _x; }
 
8404
         char name() const { return _name[_x]; }
 
8405
         size_type dimension() const { return _dimension[_x]; }
6887
8406
         friend Float measure (reference_element hat_K);
6888
 
         size_type size() const;
6889
 
         size_type n_edge() const;
6890
 
         size_type n_face() const;
6891
 
         size_type n_subgeo(size_type subgeo_dim) const;
6892
 
         size_type subgeo_size(size_type subgeo_dim, size_type i_subgeo) const;
6893
 
         size_type subgeo_local_vertex(size_type subgeo_dim, size_type i_subgeo, size_type i_subgeo_vertex) const;
6894
 
         size_type heap_size() const;
6895
 
         size_type heap_offset(size_type subgeo_dim) const;
6896
 
 
6897
 
         void set_type (enum_type x);
6898
 
         void set_type (size_type n_vertex, size_type dim);
6899
 
         void set_name (char name);
6900
 
 
6901
 
     // data:
 
8407
         size_type size() const { return _n_vertex[_x]; }
 
8408
         size_type n_subgeo(size_type subgeo_dim) const { return n_subgeo (variant(), subgeo_dim); }
 
8409
         size_type n_edge() const { return n_subgeo(1); }
 
8410
         size_type n_face() const { return n_subgeo(2); }
 
8411
         size_type subgeo_size (size_type subgeo_dim, size_type loc_isid) const {
 
8412
             return subgeo_n_node (_x, 1, subgeo_dim, loc_isid); }
 
8413
         size_type subgeo_local_vertex(size_type subgeo_dim, size_type loc_isid, size_type loc_jsidvert) const {
 
8414
             return subgeo_local_node (_x, 1, subgeo_dim, loc_isid, loc_jsidvert); }
 
8415
 
 
8416
         void set_variant (variant_type x) { _x = x; }
 
8417
         void set_variant (size_type n_vertex, size_type dim) { _x = variant (n_vertex, dim); }
 
8418
         void set_name    (char name);
 
8419
 
 
8420
     // helpers:
 
8421
 
 
8422
         static variant_type variant  (char name);
 
8423
         static variant_type variant  (size_type n_vertex, size_type dim);
 
8424
         static char         name     (variant_type variant) { return _name     [variant]; }
 
8425
         static size_type dimension   (variant_type variant) { return _dimension[variant]; }
 
8426
         static size_type n_vertex    (variant_type variant) { return _n_vertex [variant]; }
 
8427
         static size_type n_node      (variant_type variant, size_type order);
 
8428
 
 
8429
         static size_type n_sub_edge    (variant_type variant);
 
8430
         static size_type n_sub_face    (variant_type variant);
 
8431
         static size_type n_subgeo      (variant_type variant, size_type subgeo_dim);
 
8432
         static size_type subgeo_n_node (variant_type variant, size_type order, size_type subgeo_dim, size_type loc_isid);
 
8433
         static size_type subgeo_local_node (variant_type variant, size_type order, size_type subgeo_dim, size_type loc_isid, size_type loc_jsidnod);
 
8434
 
 
8435
         static variant_type first_variant_by_dimension (size_type dim) {
 
8436
                     return _first_variant_by_dimension[dim]; }
 
8437
         static variant_type  last_variant_by_dimension (size_type dim) {
 
8438
                     return _first_variant_by_dimension[dim+1]; }
 
8439
 
 
8440
         static size_type first_inod_by_variant (variant_type variant, size_type order, variant_type subgeo_variant);
 
8441
         static size_type  last_inod_by_variant (variant_type variant, size_type order, variant_type subgeo_variant)
 
8442
            { return first_inod_by_variant (variant, order, subgeo_variant+1); }
 
8443
         static size_type first_inod (variant_type variant, size_type order, size_type subgeo_dim)
 
8444
            { return first_inod_by_variant (variant, order, first_variant_by_dimension(subgeo_dim)); }
 
8445
         static size_type  last_inod (variant_type variant, size_type order, size_type subgeo_dim)
 
8446
            { return first_inod_by_variant (variant, order,  last_variant_by_dimension(subgeo_dim)); }
 
8447
         static void init_local_nnode_by_variant (size_type order, size_type sz [reference_element::max_variant]);
 
8448
 
6902
8449
     protected:
6903
 
 
6904
 
         enum_type _x;
6905
 
 
6906
8450
     // constants:
6907
8451
 
6908
 
         // these constants are initialized in
6909
 
         //   "reference_element_declare.c"
6910
 
         // automatically generated.
6911
 
 
6912
 
         static const char _name                     [max_size];
6913
 
         static const size_type _dimension           [max_size];
6914
 
         static const size_type _n_subgeo            [max_size][4];
6915
 
         static const size_type _subgeo_size         [max_size*4*max_n_subgeo];
6916
 
         static const size_type _subgeo_local_vertex [max_size*4*max_n_subgeo*max_subgeo_vertex];
6917
 
         static const size_type _heap_size           [max_size];
6918
 
         static const size_type _heap_offset         [max_size][4];
6919
 
         friend std::istream& operator>>(std::istream&, class geo_element&);
 
8452
         static const char      _name [max_variant];
 
8453
         static const size_type _dimension [max_variant];
 
8454
         static const size_type _n_vertex [max_variant];
 
8455
         static const variant_type _first_variant_by_dimension[5];
 
8456
 
 
8457
     // data:
 
8458
 
 
8459
         variant_type _x;
6920
8460
     };
6921
8461
 
6922
8462
 
6923
8463
File: rheolef.info,  Node: quadrature internal,  Up: Internals
6924
8464
 
6925
 
8.8 `quadrature' - quadrature formulae on the reference lement
6926
 
==============================================================
 
8465
8.11 `quadrature' - quadrature formulae on the reference lement
 
8466
===============================================================
6927
8467
 
6928
 
(Source file: `nfem/basis/quadrature.h') 
 
8468
(Source file: `nfem/geo_element/quadrature.h') 
6929
8469
 
6930
8470
Synopsys
6931
8471
--------
6986
8526
         friend std::ostream& operator<< (std::ostream&, const quadrature&);
6987
8527
     protected:
6988
8528
         quadrature_option_type     _options;
6989
 
         mutable quadrature_on_geo  _quad        [reference_element::max_size];
 
8529
         mutable quadrature_on_geo  _quad        [reference_element::max_variant];
6990
8530
         mutable std::vector<bool>  _initialized;
6991
8531
         void _initialize (reference_element hat_K) const;
6992
8532
     private:
6997
8537
 
6998
8538
File: rheolef.info,  Node: quadrangle internal,  Up: Internals
6999
8539
 
7000
 
8.9 `quadrangle' - Quadrangular reference element
7001
 
=================================================
 
8540
8.12 `quadrangle' - Quadrangular reference element
 
8541
==================================================
7002
8542
 
7003
 
(Source file: `nfem/basis/quadrangle.icc') 
 
8543
(Source file: `nfem/geo_element/quadrangle.icc') 
7004
8544
 
7005
8545
Description
7006
8546
-----------
7019
8559
           |         |
7020
8560
           |         |
7021
8561
           0---------1   x
 
8562
Curved high order Pk quadrangles (k >= 1), in 2d or 3d geometries, are
 
8563
supported.  These quadrangles have additional edge-nodes and face-nodes.
 
8564
 
 
8565
These nodes are numbered as
 
8566
---------------------------
 
8567
 
 
8568
first vertex, then edge-node, following the edge numbering order and
 
8569
orientation, and finally the face internal nodes, following the
 
8570
quadrangle lattice.  See below for edge numbering and orientation.
 
8571
           3-----6-----2   3---9---8---2
 
8572
           |           |   |           |
 
8573
           |           |  10  14  15   7
 
8574
           7     8     5   |           |
 
8575
           |           |  11  12  13   6
 
8576
           |           |   |           |
 
8577
           0-----4-----1   0---4---5---1
 
8578
                 P2              P3
7022
8579
 
7023
8580
Implementation
7024
8581
--------------
7041
8598
 
7042
8599
File: rheolef.info,  Node: prism internal,  Up: Internals
7043
8600
 
7044
 
8.10 `prism' - Prism reference element
 
8601
8.13 `prism' - Prism reference element
7045
8602
======================================
7046
8603
 
7047
 
(Source file: `nfem/basis/prism.icc') 
 
8604
(Source file: `nfem/geo_element/prism.icc') 
7048
8605
 
7049
8606
Description
7050
8607
-----------
7087
8644
             { 0, 1, 1 } };
7088
8645
     const size_t  n_face = 5;
7089
8646
     const size_t face [n_face][4] = {
 
8647
             { 3, 4, 5, size_t(-1) },
7090
8648
             { 0, 2, 1, size_t(-1) },
7091
8649
             { 0, 3, 5, 2 },
7092
8650
             { 0, 1, 4, 3 },
7093
 
             { 3, 4, 5, size_t(-1) },
7094
8651
             { 1, 2, 5, 4 } };
7095
8652
     const size_t  n_edge = 9;
7096
8653
     const size_t edge [n_edge][2] = {
7105
8662
             { 5, 3 } };
7106
8663
 
7107
8664
 
7108
 
File: rheolef.info,  Node: hexa internal,  Up: Internals
7109
 
 
7110
 
8.11 `hexa' - Hexaedra reference element
7111
 
========================================
7112
 
 
7113
 
(Source file: `nfem/basis/hexa.icc') 
7114
 
 
7115
 
Description
7116
 
-----------
7117
 
 
7118
 
The hexa reference element is [-1,1]^3.
7119
 
 
7120
 
Numbering
7121
 
---------
7122
 
 
7123
 
The orientation is such that triedra (01, 03, 04) is direct and all
7124
 
faces, see from exterior, are in the direct sens.  References: P. L.
7125
 
Georges, "Generation automatique de maillages", page 24-, coll RMA, 16,
7126
 
Masson, 1994.
7127
 
                 z
7128
 
 
7129
 
                 4 - - -7
7130
 
            . '  .  . ' |
7131
 
           5 - - -6     |
7132
 
           |     .|     |
7133
 
           |     .|     |
7134
 
           |     .|     |
7135
 
           |     0|. . .3     y
7136
 
           | . '  | . '
7137
 
           1 - - -2
7138
 
 
7139
 
         x
7140
 
 
7141
 
Implementation
7142
 
--------------
7143
 
 
7144
 
     const size_t dimension = 3;
7145
 
     const Float  measure = 8;
7146
 
     const size_t n_vertex = 8;
7147
 
     const Float vertex [n_vertex][dimension] = {
7148
 
             {-1,-1,-1 },
7149
 
             { 1,-1,-1 },
7150
 
             { 1, 1,-1 },
7151
 
             {-1, 1,-1 },
7152
 
             {-1,-1, 1 },
7153
 
             { 1,-1, 1 },
7154
 
             { 1, 1, 1 },
7155
 
             {-1, 1, 1 } };
7156
 
     const size_t  n_face = 6;
7157
 
     const size_t face [n_face][4] = {
7158
 
             {0, 3, 2, 1 },
7159
 
             {0, 4, 7, 3 },
7160
 
             {0, 1, 5, 4 },
7161
 
             {4, 5, 6, 7 },
7162
 
             {1, 2, 6, 5 },
7163
 
             {2, 3, 7, 6 } };
7164
 
     const size_t  n_edge = 12;
7165
 
     const size_t edge [n_edge][2] = {
7166
 
             {0, 1 },
7167
 
             {1, 2 },
7168
 
             {2, 3 },
7169
 
             {3, 0 },
7170
 
             {0, 4 },
7171
 
             {1, 5 },
7172
 
             {2, 6 },
7173
 
             {3, 7 },
7174
 
             {4, 5 },
7175
 
             {5, 6 },
7176
 
             {6, 7 },
7177
 
             {7, 4 } };
7178
 
 
7179
 
 
7180
8665
File: rheolef.info,  Node: triangle internal,  Up: Internals
7181
8666
 
7182
 
8.12 `triangle' - Triangle reference element
 
8667
8.14 `triangle' - Triangle reference element
7183
8668
============================================
7184
8669
 
7185
 
(Source file: `nfem/basis/triangle.icc') 
 
8670
(Source file: `nfem/geo_element/triangle.icc') 
7186
8671
 
7187
8672
Description
7188
8673
-----------
7202
8687
           |     +
7203
8688
           |       +
7204
8689
           0---------1   x
 
8690
Curved high order Pk triangles (k >= 1), in 2d or 3d geometries, are
 
8691
supported.  These triangles have additional edge-nodes and face-nodes.
 
8692
 
 
8693
These nodes are numbered as
 
8694
---------------------------
 
8695
 
 
8696
first vertex, then edge-node, following the edge numbering order and
 
8697
orientation, and finally the face internal nodes, following the
 
8698
triangle lattice.  See below for edge numbering and orientation.
 
8699
           2               2               2
 
8700
           | +             | +             | +
 
8701
           |   +           7   6           9   8
 
8702
           5     4         |     +        10 14  7
 
8703
           |       +       8   9   5      11 12 13 6
 
8704
           |         +     |         +     |         +
 
8705
           0-----3-----1   0---3---4---1   0--3--4--5--1
 
8706
                 P2              P3              P4
7205
8707
 
7206
8708
Implementation
7207
8709
--------------
7222
8724
 
7223
8725
File: rheolef.info,  Node: geo_element internal,  Up: Internals
7224
8726
 
7225
 
8.13 `geo_element' - element of a mesh
 
8727
8.15 `geo_element' - element of a mesh
7226
8728
======================================
7227
8729
 
7228
 
(Source file: `nfem/basis/geo_element_v1.h') 
 
8730
(Source file: `nfem/geo_element/geo_element_v4.h') 
7229
8731
 
7230
8732
Description
7231
8733
-----------
7241
8743
-------
7242
8744
 
7243
8745
This is the test of geo_element:
7244
 
         geo_element K;
 
8746
         geo_element_auto<> K;
7245
8747
         K.set_name('t') ;
7246
8748
         cout << "n_vertices: " << K.size()      << endl
7247
8749
              << "n_edges   : " << K.n_edges()   << endl
7263
8765
                  << ") -> (" << vloc1 << ", " << vloc2 << ")" << endl;
7264
8766
         }
7265
8767
 
7266
 
Implementation
7267
 
--------------
7268
 
 
7269
 
     class geo_element : public reference_element {
7270
 
     public:
7271
 
 
7272
 
     // allocators/deallocators:
7273
 
 
7274
 
         geo_element(enum_type t = max_size);
7275
 
         geo_element(const geo_element&);
7276
 
         explicit geo_element (const class tiny_element&);
7277
 
         void copy (const geo_element&);
7278
 
         void copy (const class tiny_element&);
7279
 
         geo_element& operator = (const geo_element&);
7280
 
         ~geo_element();
7281
 
 
7282
 
     // accessors:
7283
 
 
7284
 
         size_type index() const;
7285
 
         size_type operator [] (size_type i) const;
7286
 
         size_type side(size_type i_side) const;
7287
 
         void build_side(size_type i_side, geo_element& S) const;
7288
 
 
7289
 
 
7290
 
         size_type edge (size_type i_edge) const;
7291
 
         size_type face (size_type i_face) const;
7292
 
 
7293
 
         size_type subgeo(const geo_element& S) const;
7294
 
         size_type subgeo (size_type subgeo_dim, size_type i_subgeo) const;
7295
 
         size_type subgeo_vertex (size_type subgeo_dim, size_type i_subgeo,
7296
 
                                size_type i_subgeo_vertex) const;
7297
 
         void build_subgeo(size_type subgeo_dim, size_type i_subgeo, geo_element& S) const;
7298
 
         size_type subgeo_local_index(const geo_element& S) const;
7299
 
 
7300
 
     // modifiers:
7301
 
 
7302
 
         void set_type (enum_type t);
7303
 
         void set_type (size_type sz, size_type dim);
7304
 
         void set_name (char      name);
7305
 
 
7306
 
         void set_index(size_type idx);
7307
 
         size_type& operator [] (size_type i);
7308
 
         void set_side (size_type i_side, size_type idx);
7309
 
 
7310
 
         void set_edge (size_type i_edge, size_type idx);
7311
 
         void set_face (size_type i_face, size_type idx);
7312
 
         void set_subgeo (size_type subgeo_dim, size_type i_subgeo,
7313
 
                                size_type idx);
7314
 
         void set_subgeo(const geo_element& S, size_type idx);
7315
 
 
7316
 
     // inputs/outputs:
7317
 
 
7318
 
         friend std::istream& operator >> (std::istream&, geo_element&);
7319
 
         friend std::ostream& operator << (std::ostream&, const geo_element&);
7320
 
         std::ostream& dump(std::ostream& s = std::cerr) const;
7321
 
         void check() const;
7322
 
 
7323
 
     // data:
7324
 
     protected:
7325
 
         size_type *_heap;
7326
 
 
7327
 
     // memory management:
7328
 
         void _heap_init();
7329
 
         void _heap_close();
7330
 
     };
7331
 
 
7332
 
 
7333
 
File: rheolef.info,  Node: tetra internal,  Up: Internals
7334
 
 
7335
 
8.14 `tetra' - Tetraedra reference element
7336
 
==========================================
7337
 
 
7338
 
(Source file: `nfem/basis/tetra.icc') 
7339
 
 
7340
 
Description
7341
 
-----------
7342
 
 
7343
 
The tetraedra reference element is
7344
 
             K = { 0 < x < 1 and 0 < y < 1-x and 0 < z < 1-x-y }
7345
 
 
7346
 
Numbering
7347
 
---------
7348
 
 
7349
 
The orientation is such that triedra (01, 02, 03) is direct, and all
7350
 
faces, see from exterior, are in the direct sens.  References: P. L.
7351
 
Georges, "Generation automatique de maillages", page 24-, coll RMA, 16,
7352
 
Masson, 1994.
7353
 
                 z
7354
 
 
7355
 
                 3
7356
 
                /| +
7357
 
               / |   +
7358
 
              /  |     +
7359
 
             /   0 . . .2     y
7360
 
            / '    .
7361
 
           1 .  '
7362
 
 
7363
 
         x
7364
 
 
7365
 
Implementation
7366
 
--------------
7367
 
 
7368
 
     const size_t dimension = 3;
7369
 
     const Float  measure = Float(1.)/Float(6.);
7370
 
     const size_t n_vertex = 4;
7371
 
     const Float vertex [n_vertex][dimension] = {
7372
 
             { 0, 0, 0 },
7373
 
             { 1, 0, 0 },
7374
 
             { 0, 1, 0 },
7375
 
             { 0, 0, 1 } };
7376
 
     const size_t  n_face = 4;
7377
 
     const size_t face [n_face][3] = {
7378
 
             { 0, 2, 1 },
7379
 
             { 0, 3, 2 },
7380
 
             { 0, 1, 3 },
7381
 
             { 1, 2, 3 } };
7382
 
     const size_t  n_edge = 6;
7383
 
     const size_t edge [n_edge][2] = {
7384
 
             { 0, 1 },
7385
 
             { 1, 2 },
7386
 
             { 2, 0 },
7387
 
             { 0, 3 },
7388
 
             { 1, 3 },
7389
 
             { 2, 3 } };
7390
 
 
7391
8768
 
7392
8769
File: rheolef.info,  Node: edge internal,  Up: Internals
7393
8770
 
7394
 
8.15 `edge' - Edge reference element
 
8771
8.16 `edge' - Edge reference element
7395
8772
====================================
7396
8773
 
7397
 
(Source file: `nfem/basis/edge.icc') 
 
8774
(Source file: `nfem/geo_element/edge.icc') 
7398
8775
 
7399
8776
Description
7400
8777
-----------
7401
8778
 
7402
8779
The edge reference element is K = [0,1].
7403
8780
           0---------1   x
 
8781
Curved high order Pk edges (k >= 1), in 2d or 3d geometries, are
 
8782
supported.  These edges have internal nodes, numbered as:
 
8783
           0----2----1     0--2--3--1    0-2-3-4-1
 
8784
               P2              P3           P4
7404
8785
 
7405
8786
Implementation
7406
8787
--------------
7413
8794
             { 1 } };
7414
8795
 
7415
8796
 
7416
 
File: rheolef.info,  Node: numbering internal,  Up: Internals
7417
 
 
7418
 
8.16 `numbering' - global degree of freedom numbering
7419
 
=====================================================
7420
 
 
7421
 
(Source file: `nfem/basis/numbering.h') 
 
8797
File: rheolef.info,  Node: index_set internal,  Up: Internals
 
8798
 
 
8799
8.17 index_set - a set of indexes
 
8800
=================================
 
8801
 
 
8802
(Source file: `skit/plib2/index_set.h')
7422
8803
 
7423
8804
Synopsys
7424
8805
--------
7425
8806
 
7426
 
The `numbering' class defines methods that furnish global   numbering
7427
 
of degrees of freedom. This numbering depends upon   the degrees of
7428
 
polynoms on elements and upon the continuity   requirement at
7429
 
inter-element boundary. For instance the   "P1" continuous finite
7430
 
element approximation has one degree   of freedom per vertice of the
7431
 
mesh, while its discontinuous   counterpart has dim(basis) times the
7432
 
number of elements of the   mesh, where dim(basis) is the size of the
7433
 
local finite element basis.
 
8807
A class for: l = {1,3,...9} i.e. a wrapper for STL `set<size_t>' with
 
8808
 some assignment operators, such as l1 += l2.      This class is
 
8809
suitable for use with the `array<T>' class, as `array<index_set>'
 
8810
(*note array class::).
7434
8811
 
7435
8812
Implementation
7436
8813
--------------
7437
8814
 
7438
 
     class numbering : public smart_pointer<numbering_rep> {
 
8815
     class index_set : public std::set<std::size_t> {
7439
8816
     public:
7440
8817
 
7441
8818
     // typedefs:
7442
 
         typedef numbering_rep                rep;
7443
 
         typedef smart_pointer<numbering_rep> base;
7444
 
         typedef size_t                       size_type;
 
8819
 
 
8820
       typedef std::set<std::size_t>    base;
 
8821
       typedef std::size_t              value_type;
 
8822
       typedef std::size_t              size_type;
7445
8823
 
7446
8824
     // allocators:
7447
8825
 
7448
 
         numbering (std::string name = "");
7449
 
         numbering (numbering_rep* ptr);
7450
 
 
7451
 
         virtual ~numbering() {}
7452
 
 
7453
 
     // accessors:
7454
 
 
7455
 
         std::string name() const;
7456
 
         virtual
7457
 
         size_type ndof (
7458
 
                   size_type  mesh_map_dimension,
7459
 
             const size_type* mesh_n_geo,
7460
 
             const size_type* mesh_n_element) const;
7461
 
 
7462
 
         virtual
7463
 
         size_type idof (
7464
 
             const size_type*      mesh_n_geo,
7465
 
             const size_type*      mesh_n_element,
7466
 
             const geo_element&    K,
7467
 
             size_type             i_dof_local) const;
7468
 
 
7469
 
         virtual
7470
 
         void idof (
7471
 
             const size_type*        mesh_n_geo,
7472
 
             const size_type*        mesh_n_element,
7473
 
             const geo_element&      K,
7474
 
             std::vector<size_type>& i_dof) const;
7475
 
 
7476
 
         virtual bool is_continuous() const;
7477
 
         virtual bool is_discontinuous() const { return !is_continuous(); }
7478
 
 
7479
 
     // i/o:
7480
 
 
7481
 
         void dump(std::ostream& out = std::cerr) const;
 
8826
       index_set ();
 
8827
       index_set (const index_set& x);
 
8828
       index_set& operator= (const index_set& x);
 
8829
       template <int N>
 
8830
       index_set& operator= (size_type x[N]);
 
8831
       void clear ();
 
8832
 
 
8833
     // basic algebra:
 
8834
 
 
8835
       void       insert     (size_type dis_i);    // a := a union {dis_i}
 
8836
       index_set& operator+= (size_type dis_i);    // idem
 
8837
       index_set& operator+= (const index_set& b); // a := a union b
 
8838
 
 
8839
       // a := a union b
 
8840
       void inplace_union        (const index_set& b);
 
8841
       void inplace_intersection (const index_set& b);
 
8842
 
 
8843
       // c := a union b
 
8844
       friend void set_union        (const index_set& a, const index_set& b, index_set& c);
 
8845
       friend void set_intersection (const index_set& a, const index_set& b, index_set& c);
 
8846
 
 
8847
     // io:
 
8848
 
 
8849
       friend std::istream& operator>> (std::istream& is, index_set& x);
 
8850
       friend std::ostream& operator<< (std::ostream& os, const index_set& x);
 
8851
 
 
8852
     // boost mpi:
 
8853
 
 
8854
       template <class Archive>
 
8855
       void serialize (Archive& ar, const unsigned int version);
7482
8856
     };
7483
8857
 
7484
8858
 
7485
8859
File: rheolef.info,  Node: smart_pointer internal,  Up: Internals
7486
8860
 
7487
 
8.17 `occurence', `smart_pointer' - memory management
 
8861
8.18 `occurence', `smart_pointer' - memory management
7488
8862
=====================================================
7489
8863
 
7490
8864
(Source file: `util/lib/smart_pointer.h') 
7546
8920
 
7547
8921
File: rheolef.info,  Node: heap_allocator internal,  Up: Internals
7548
8922
 
7549
 
8.18 heap_allocator - heap-based allocator
 
8923
8.19 heap_allocator - heap-based allocator
7550
8924
==========================================
7551
8925
 
7552
8926
(Source file: `util/lib/heap_allocator.h')
7675
9049
 
7676
9050
File: rheolef.info,  Node: stack_allocator internal,  Up: Internals
7677
9051
 
7678
 
8.19 stack_allocator - stack-based allocator
 
9052
8.20 stack_allocator - stack-based allocator
7679
9053
============================================
7680
9054
 
7681
9055
(Source file: `util/lib/stack_allocator.h')
7864
9238
 
7865
9239
File: rheolef.info,  Node: pretty_name internal,  Up: Internals
7866
9240
 
7867
 
8.20 `typename_macro', `pretty_typename_macro' - type demangler and pretty printer
 
9241
8.21 `typename_macro', `pretty_typename_macro' - type demangler and pretty printer
7868
9242
==================================================================================
7869
9243
 
7870
9244
(Source file: `util/lib/pretty_name.h')
7902
9276
 
7903
9277
File: rheolef.info,  Node: acinclude internal,  Up: Internals
7904
9278
 
7905
 
8.21 `acinclude' - autoconf macros
 
9279
8.22 `acinclude' - autoconf macros
7906
9280
==================================
7907
9281
 
7908
9282
(Source file: `config/acinclude.m4') 
8804
10178
[index]
8805
10179
* Menu:
8806
10180
 
8807
 
* advection <1>:                         characteristic internal.
8808
 
                                                              (line   6)
8809
 
* advection:                             geomap internal.     (line   6)
8810
 
* anaglyph 3D stereo rendering <1>:      field command.       (line 135)
8811
 
* anaglyph 3D stereo rendering:          mfield command.      (line 135)
8812
 
* animation <1>:                         form class.          (line 102)
8813
 
* animation:                             branch command.      (line   8)
8814
 
* axisymetric geometry:                  geo class.           (line  51)
8815
 
* Bezier patches:                        cad class.           (line   6)
8816
 
* bilinear form:                         form_element internal.
8817
 
                                                              (line   6)
8818
 
* blocked degree of freedom:             space class.         (line  47)
8819
 
* boundary conditions <1>:               mass form.           (line   6)
8820
 
* boundary conditions <2>:               d2_ds2 form.         (line   6)
8821
 
* boundary conditions:                   d_ds form.           (line   6)
8822
 
* boundary geometry:                     cad class.           (line   6)
 
10181
* bilinear form:                         form_element class.  (line   6)
 
10182
* boundary conditions:                   mass form.           (line   6)
8823
10183
* bugs:                                  Problems.            (line   6)
8824
 
* cad file format conversion:            cad command.         (line  64)
8825
 
* CAD, Computer Aid Design:              cad command.         (line   6)
8826
 
* cemagref topographic mesh <1>:         iorheo class.        (line 136)
8827
 
* cemagref topographic mesh <2>:         cemagref2field command.
8828
 
                                                              (line   6)
8829
 
* cemagref topographic mesh <3>:         field command.       (line  53)
8830
 
* cemagref topographic mesh:             geo command.         (line 171)
8831
 
* chevron data structure:                ssk class.           (line   6)
8832
 
* Choleski factorization <1>:            ssk class.           (line   6)
8833
 
* Choleski factorization:                permutation class.   (line   6)
 
10184
* cemagref topographic mesh:             iorheo class.        (line 136)
 
10185
* Choleski factorization:                solver class.        (line   6)
8834
10186
* configure:                             rheolef-config command.
8835
10187
                                                              (line   6)
8836
 
* conjugate gradien algorithm:           mixed_solver algorithm.
8837
 
                                                              (line   6)
8838
 
* conjugate gradient algorithm <1>:      pcg algorithm.       (line   6)
8839
 
* conjugate gradient algorithm:          pminres algorithm.   (line   6)
8840
 
* continuation methods <1>:              form class.          (line 102)
8841
 
* continuation methods:                  branch command.      (line   8)
8842
 
* curl operator:                         curl form.           (line   6)
 
10188
* conjugate gradient algorithm:          pcg class.           (line   6)
8843
10189
* debugging <1>:                         acinclude internal.  (line 125)
8844
10190
* debugging:                             Installing.          (line 293)
8845
10191
* deformation:                           iorheo class.        (line  70)
8846
 
* degree of freedom:                     space class.         (line  18)
8847
 
* derivative:                            d_dx form.           (line   6)
8848
 
* diagonal matrix:                       diag class.          (line   6)
8849
 
* direct solver:                         ssk class.           (line   6)
8850
 
* discontinuous approximation:           inv_mass form.       (line   6)
8851
 
* distributed memory:                    csr class.           (line   6)
8852
 
* div(D(.)) operator:                    2D_D form.           (line   6)
8853
 
* divergence <1>:                        div_div form.        (line   6)
8854
 
* divergence:                            div form.            (line   6)
8855
 
* divergence of tensor:                  2D_D form.           (line   6)
 
10192
* direct solver:                         solver class.        (line   6)
8856
10193
* edge:                                  edge internal.       (line   6)
8857
 
* elasticity problem <1>:                div_div form.        (line   6)
8858
 
* elasticity problem:                    2D_D form.           (line   6)
8859
 
* elevation <1>:                         iorheo class.        (line  78)
8860
 
* elevation <2>:                         branch command.      (line  79)
8861
 
* elevation:                             field command.       (line 191)
 
10194
* elevation:                             iorheo class.        (line  78)
8862
10195
* environment sanity check writes:       rheolef-config command.
8863
10196
                                                              (line  36)
8864
10197
* factorization of sparse matrix:        Installing.          (line  77)
8865
10198
* FAQ:                                   FAQ for developers.  (line   6)
8866
 
* finite element method:                 mixed_solver algorithm.
8867
 
                                                              (line   6)
8868
 
* generalized minimum residual method:   gmres algorithm.     (line   6)
 
10199
* finite element method:                 element class.       (line   6)
8869
10200
* geometrical element <1>:               geo_element internal.
8870
10201
                                                              (line   6)
8871
 
* geometrical element:                   form_element internal.
8872
 
                                                              (line   6)
8873
 
* Gibbs renumbering <1>:                 ssk class.           (line   6)
8874
 
* Gibbs renumbering:                     permutation class.   (line   6)
8875
 
* grad(div(.)) operator:                 div_div form.        (line   6)
8876
 
* gradient:                              grad form.           (line   6)
 
10202
* geometrical element:                   form_element class.  (line   6)
 
10203
* graphic render <1>:                    iorheo class.        (line   6)
 
10204
* graphic render <2>:                    field command.       (line  40)
 
10205
* graphic render:                        geo command.         (line  56)
8877
10206
* hexaedra:                              hexa internal.       (line   6)
8878
 
* incompresible elasticity:              mixed_solver algorithm.
8879
 
                                                              (line   6)
8880
 
* inheritance diagrams for classes:      Installing.          (line 419)
 
10207
* hexaedron:                             hexahedron internal. (line   6)
 
10208
* image file format <1>:                 iorheo class.        (line 228)
 
10209
* image file format <2>:                 field command.       (line  40)
 
10210
* image file format:                     geo command.         (line  79)
 
10211
* inheritance diagrams for classes:      Installing.          (line 414)
8881
10212
* installing <1>:                        rheolef-config command.
8882
10213
                                                              (line   6)
8883
10214
* installing:                            Installing.          (line   6)
8884
 
* iterative solver <1>:                  gmres algorithm.     (line   6)
8885
 
* iterative solver <2>:                  puzawa algorithm.    (line   6)
8886
 
* iterative solver <3>:                  bicgstab algorithm.  (line   6)
8887
 
* iterative solver <4>:                  pcg algorithm.       (line   6)
8888
 
* iterative solver <5>:                  qmr algorithm.       (line   6)
8889
 
* iterative solver:                      pminres algorithm.   (line   6)
 
10215
* iterative solver:                      pcg class.           (line   6)
8890
10216
* Laplacian:                             grad_grad form.      (line   6)
8891
10217
* lumped mass form:                      mass form.           (line   6)
8892
10218
* Makefile:                              rheolef-config command.
8893
10219
                                                              (line   6)
8894
 
* mass matrix inversion:                 inv_mass form.       (line   6)
8895
 
* mesh <1>:                              characteristic internal.
8896
 
                                                              (line   6)
8897
 
* mesh <2>:                              geomap internal.     (line   6)
8898
 
* mesh <3>:                              geo class.           (line   6)
8899
 
* mesh <4>:                              msh2geo command.     (line   6)
8900
 
* mesh <5>:                              qmg2geo command.     (line   6)
8901
 
* mesh <6>:                              cemagref2field command.
8902
 
                                                              (line   6)
8903
 
* mesh <7>:                              mesh2geo command.    (line   6)
8904
 
* mesh <8>:                              bamg2geo command.    (line   6)
8905
 
* mesh <9>:                              tetgen2geo command.  (line   6)
8906
 
* mesh <10>:                             grummp2geo command.  (line   6)
8907
 
* mesh:                                  mkgeo_grid command.  (line   6)
8908
 
* mesh boundary:                         domain class.        (line   6)
8909
 
* mesh file format conversion:           geo command.         (line 196)
 
10220
* mesh:                                  msh2geo command.     (line   6)
 
10221
* mesh boundary <1>:                     domain_indirect class.
 
10222
                                                              (line   6)
 
10223
* mesh boundary <2>:                     geo_domain_indirect class.
 
10224
                                                              (line   6)
 
10225
* mesh boundary:                         geo_domain class.    (line   6)
8910
10226
* mesh graphic representation:           geo command.         (line   6)
8911
 
* method of characteristic <1>:          characteristic internal.
8912
 
                                                              (line   6)
8913
 
* method of characteristic:              geomap internal.     (line   6)
8914
 
* mixed linear problem:                  mixed_solver algorithm.
8915
 
                                                              (line   6)
8916
 
* multifrontal factorization:            ssk class.           (line   6)
8917
10227
* multifrontal linear solver:            Installing.          (line  77)
8918
10228
* Neumann boundary conditions:           mass form.           (line   6)
8919
 
* Newton method <1>:                     damped-newton algorithm.
8920
 
                                                              (line   6)
8921
 
* Newton method:                         newton algorithm.    (line   6)
8922
 
* nonlinear problem <1>:                 damped-newton algorithm.
8923
 
                                                              (line   6)
8924
 
* nonlinear problem:                     newton algorithm.    (line   6)
8925
 
* normal:                                iofem internal.      (line  18)
8926
10229
* numbering, global degree of freedom:   numbering internal.  (line   6)
8927
 
* origin:                                iofem internal.      (line  18)
8928
10230
* out-of-core sparse linear solver:      Installing.          (line  77)
8929
10231
* plotting <1>:                          field command.       (line   6)
8930
10232
* plotting:                              geo command.         (line   6)
8935
10237
* polynomial basis:                      basis internal.      (line   6)
8936
10238
* portability limitation:                Installing.          (line 216)
8937
10239
* porting the code:                      acinclude internal.  (line   6)
8938
 
* preconditioner <1>:                    puzawa algorithm.    (line   6)
8939
 
* preconditioner <2>:                    pcg algorithm.       (line   6)
8940
 
* preconditioner:                        pminres algorithm.   (line   6)
 
10240
* preconditioner:                        pcg class.           (line   6)
8941
10241
* prism:                                 prism internal.      (line   6)
8942
10242
* problems:                              Problems.            (line   6)
8943
 
* projection <1>:                        branch command.      (line  74)
8944
 
* projection:                            field command.       (line 155)
8945
10243
* quadrangle:                            quadrangle internal. (line   6)
8946
 
* quadrature formulae <1>:               quadrature internal. (line   6)
8947
 
* quadrature formulae <2>:               characteristic internal.
8948
 
                                                              (line   6)
8949
 
* quadrature formulae:                   riesz_representer algorithm.
8950
 
                                                              (line   6)
8951
 
* quasi-minimal residual algorithm:      qmr algorithm.       (line   6)
8952
 
* rate of deformation tensor <1>:        2D form.             (line   6)
8953
 
* rate of deformation tensor <2>:        div_div form.        (line   6)
8954
 
* rate of deformation tensor:            2D_D form.           (line   6)
 
10244
* quadrature formulae:                   quadrature internal. (line   6)
8955
10245
* reference counting:                    smart_pointer internal.
8956
10246
                                                              (line   6)
8957
10247
* reference element <1>:                 edge internal.       (line   6)
8958
 
* reference element <2>:                 tetra internal.      (line   6)
8959
 
* reference element <3>:                 triangle internal.   (line   6)
8960
 
* reference element <4>:                 hexa internal.       (line   6)
8961
 
* reference element <5>:                 prism internal.      (line   6)
8962
 
* reference element <6>:                 quadrangle internal. (line   6)
8963
 
* reference element <7>:                 reference_element internal.
8964
 
                                                              (line   6)
8965
 
* reference element <8>:                 basis internal.      (line   6)
8966
 
* reference element:                     point internal.      (line   6)
8967
 
* regions in geometry:                   geo command.         (line 228)
8968
 
* RHEOPATH environment variable <1>:     rheostream class.    (line   6)
8969
 
* RHEOPATH environment variable <2>:     geo class.           (line   6)
8970
 
* RHEOPATH environment variable <3>:     cad class.           (line   6)
8971
 
* RHEOPATH environment variable <4>:     cad command.         (line  51)
8972
 
* RHEOPATH environment variable <5>:     branch command.      (line   8)
8973
 
* RHEOPATH environment variable <6>:     field command.       (line   6)
8974
 
* RHEOPATH environment variable <7>:     geo command.         (line  37)
8975
 
* RHEOPATH environment variable:         mfield command.      (line   6)
8976
 
* riesz representer:                     riesz_representer algorithm.
8977
 
                                                              (line   6)
 
10248
* reference element <2>:                 triangle internal.   (line   6)
 
10249
* reference element <3>:                 prism internal.      (line   6)
 
10250
* reference element <4>:                 quadrangle internal. (line   6)
 
10251
* reference element <5>:                 reference_element internal.
 
10252
                                                              (line   6)
 
10253
* reference element <6>:                 hexahedron internal. (line   6)
 
10254
* reference element <7>:                 tetra internal.      (line   6)
 
10255
* reference element <8>:                 hexa internal.       (line   6)
 
10256
* reference element <9>:                 point internal.      (line   6)
 
10257
* reference element <10>:                tetrahedron internal.
 
10258
                                                              (line   6)
 
10259
* reference element:                     basis internal.      (line   6)
 
10260
* RHEOPATH environment variable:         rheostream class.    (line   6)
8978
10261
* Robin boundary conditions:             mass form.           (line   6)
8979
10262
* scalar product:                        mass form.           (line   6)
8980
10263
* shallow copy:                          smart_pointer internal.
8981
10264
                                                              (line   6)
8982
 
* skyline data structure <1>:            ssk class.           (line   6)
8983
 
* skyline data structure:                permutation class.   (line   6)
8984
10265
* smart pointer:                         smart_pointer internal.
8985
10266
                                                              (line   6)
8986
 
* sparse matrix <1>:                     csr class.           (line   6)
8987
 
* sparse matrix <2>:                     ic0 class.           (line   6)
8988
10267
* sparse matrix:                         Installing.          (line  77)
8989
 
* stabilized conjugate gradient:         bicgstab algorithm.  (line   6)
8990
 
* stabilized mixed finite element method: mixed_solver algorithm.
8991
 
                                                              (line   6)
8992
10268
* standard template library (STL):       Installing.          (line 176)
8993
 
* stereo 3D rendering:                   geo command.         (line 101)
8994
 
* Stokes problem <1>:                    2D_D form.           (line   6)
8995
 
* Stokes problem:                        mixed_solver algorithm.
 
10269
* supernodal factorization:              solver class.        (line   6)
 
10270
* tensor:                                tensor class.        (line   6)
 
10271
* tetrahedron <1>:                       tetra internal.      (line   6)
 
10272
* tetrahedron:                           tetrahedron internal.
8996
10273
                                                              (line   6)
8997
 
* stream function:                       field command.       (line 177)
8998
 
* tensor <1>:                            2D form.             (line   6)
8999
 
* tensor <2>:                            2W form.             (line   6)
9000
 
* tensor:                                tensor class.        (line   6)
9001
 
* tetraedra:                             tetra internal.      (line   6)
9002
 
* time-dependent problems <1>:           form class.          (line 102)
9003
 
* time-dependent problems:               branch command.      (line   8)
9004
 
* topography <1>:                        iofem internal.      (line  22)
9005
 
* topography <2>:                        iorheo class.        (line 136)
9006
 
* topography:                            branch command.      (line  70)
9007
 
* trace operator:                        trace class.         (line   6)
 
10274
* topography:                            iorheo class.        (line 136)
9008
10275
* triangle:                              triangle internal.   (line   6)
9009
 
* unknow degree of freedom:              space class.         (line  47)
9010
 
* Uzawa algorithm:                       puzawa algorithm.    (line   6)
9011
10276
* velocity:                              iorheo class.        (line  70)
9012
10277
* version management:                    FAQ for developers.  (line 143)
9013
 
* vorticity:                             field command.       (line 177)
9014
 
* vorticity tensor:                      2W form.             (line   6)
9015
10278
 
9016
10279
 
9017
10280
File: rheolef.info,  Node: Program Index,  Up: Top
9022
10285
[index]
9023
10286
* Menu:
9024
10287
 
9025
 
* bamg2geo <1>:                          cemagref2field command.
9026
 
                                                              (line   6)
9027
 
* bamg2geo:                              bamg2geo command.    (line   6)
9028
 
* branch:                                branch command.      (line   8)
9029
 
* cad:                                   cad command.         (line   6)
9030
10288
* configure:                             Installing.          (line   6)
9031
10289
* dmalloc <1>:                           acinclude internal.  (line 125)
9032
10290
* dmalloc:                               Installing.          (line 293)
9033
 
* field <1>:                             branch command.      (line 116)
9034
 
* field <2>:                             cemagref2field command.
9035
 
                                                              (line   6)
9036
10291
* field:                                 field command.       (line   6)
9037
10292
* geo <1>:                               msh2geo command.     (line   6)
9038
 
* geo <2>:                               qmg2geo command.     (line   6)
9039
 
* geo <3>:                               cemagref2field command.
9040
 
                                                              (line   6)
9041
 
* geo <4>:                               mesh2geo command.    (line   6)
9042
 
* geo <5>:                               bamg2geo command.    (line   6)
9043
 
* geo <6>:                               geo command.         (line   6)
9044
 
* geo <7>:                               tetgen2geo command.  (line   6)
9045
 
* geo <8>:                               grummp2geo command.  (line   6)
9046
 
* geo:                                   mkgeo_grid command.  (line   6)
9047
 
* grummp2geo:                            grummp2geo command.  (line   6)
9048
 
* gzip:                                  cemagref2field command.
 
10293
* geo:                                   geo command.         (line   6)
 
10294
* gmsh <1>:                              hexahedron internal. (line   6)
 
10295
* gmsh <2>:                              tetra internal.      (line   6)
 
10296
* gmsh <3>:                              hexa internal.       (line   6)
 
10297
* gmsh:                                  tetrahedron internal.
9049
10298
                                                              (line   6)
9050
10299
* latex:                                 acinclude internal.  (line 342)
9051
 
* mesh2geo:                              mesh2geo command.    (line   6)
9052
 
* mfield <1>:                            iorheo class.        (line 217)
9053
 
* mfield <2>:                            branch command.      (line 116)
9054
 
* mfield:                                mfield command.      (line   6)
9055
 
* mkgeo_grid:                            mkgeo_grid command.  (line   6)
9056
 
* msh2geo:                               msh2geo command.     (line   6)
9057
 
* qmg2geo:                               qmg2geo command.     (line   6)
 
10300
* mfield:                                iorheo class.        (line 217)
 
10301
* msh2geo <1>:                           hexahedron internal. (line   6)
 
10302
* msh2geo <2>:                           tetra internal.      (line   6)
 
10303
* msh2geo <3>:                           hexa internal.       (line   6)
 
10304
* msh2geo:                               tetrahedron internal.
 
10305
                                                              (line   6)
9058
10306
* rheolef-config <1>:                    rheolef-config command.
9059
10307
                                                              (line   6)
9060
10308
* rheolef-config:                        Installing.          (line  64)
9061
 
* tetgen2geo:                            tetgen2geo command.  (line   6)
9062
10309
 
9063
10310
 
9064
10311
File: rheolef.info,  Node: Class Index,  Up: Top
9069
10316
[index]
9070
10317
* Menu:
9071
10318
 
9072
 
* array:                                 vec class.           (line   6)
9073
 
* asr:                                   csr class.           (line   6)
9074
 
* basic_diag <1>:                        diag class.          (line   6)
9075
 
* basic_diag:                            csr class.           (line   6)
9076
10319
* basis <1>:                             basis internal.      (line   6)
9077
 
* basis:                                 form_element internal.
9078
 
                                                              (line   6)
9079
 
* cad <1>:                               cad class.           (line   6)
9080
 
* cad:                                   cad command.         (line   6)
 
10320
* basis:                                 form_element class.  (line   6)
9081
10321
* catchmark <1>:                         catchmark class.     (line   6)
9082
10322
* catchmark:                             iorheo class.        (line 221)
9083
10323
* csr <1>:                               iorheo class.        (line   6)
9084
 
* csr <2>:                               csr class.           (line   6)
9085
 
* csr <3>:                               ssk class.           (line   6)
9086
 
* csr:                                   permutation class.   (line   6)
9087
 
* dns:                                   csr class.           (line   6)
9088
 
* domain <1>:                            mass form.           (line   6)
9089
 
* domain <2>:                            d2_ds2 form.         (line   6)
9090
 
* domain <3>:                            d_ds form.           (line   6)
9091
 
* domain:                                domain class.        (line   6)
9092
 
* eye:                                   csr class.           (line   6)
9093
 
* field <1>:                             riesz_representer algorithm.
 
10324
* csr:                                   solver class.        (line   6)
 
10325
* domain:                                mass form.           (line   6)
 
10326
* domain_indirect:                       domain_indirect class.
9094
10327
                                                              (line   6)
9095
 
* field <2>:                             catchmark class.     (line   6)
9096
 
* field <3>:                             iorheo class.        (line   6)
9097
 
* field <4>:                             tensor class.        (line   6)
9098
 
* field <5>:                             form class.          (line 102)
9099
 
* field <6>:                             trace class.         (line   6)
9100
 
* field:                                 space class.         (line  18)
9101
 
* Float <1>:                             vec class.           (line   6)
9102
 
* Float <2>:                             field command.       (line   6)
 
10328
* element:                               element class.       (line   6)
 
10329
* field <1>:                             catchmark class.     (line   6)
 
10330
* field <2>:                             iorheo class.        (line   6)
 
10331
* field:                                 tensor class.        (line   6)
9103
10332
* Float:                                 Installing.          (line 278)
9104
 
* form <1>:                              2D form.             (line   6)
9105
 
* form <2>:                              div_div form.        (line   6)
9106
 
* form <3>:                              inv_mass form.       (line   6)
9107
 
* form <4>:                              2D_D form.           (line   6)
9108
 
* form <5>:                              2W form.             (line   6)
9109
 
* form <6>:                              d_dx form.           (line   6)
9110
 
* form <7>:                              trace class.         (line   6)
9111
 
* form:                                  space class.         (line  18)
9112
10333
* geo <1>:                               geo_element internal.
9113
10334
                                                              (line   6)
9114
 
* geo <2>:                               characteristic internal.
9115
 
                                                              (line   6)
9116
 
* geo <3>:                               geomap internal.     (line   6)
9117
 
* geo <4>:                               iorheo class.        (line   6)
9118
 
* geo <5>:                               point class.         (line   6)
9119
 
* geo <6>:                               space class.         (line  18)
9120
 
* geo <7>:                               geo class.           (line   6)
 
10335
* geo <2>:                               iorheo class.        (line   6)
 
10336
* geo <3>:                               point class.         (line   6)
9121
10337
* geo:                                   geo command.         (line   6)
 
10338
* geo_domain:                            geo_domain class.    (line   6)
 
10339
* geo_domain_indirect_rep:               geo_domain_indirect class.
 
10340
                                                              (line   6)
9122
10341
* geo_element <1>:                       geo_element internal.
9123
10342
                                                              (line   6)
9124
 
* geo_element:                           form_element internal.
9125
 
                                                              (line   6)
9126
 
* geomap <1>:                            characteristic internal.
9127
 
                                                              (line   6)
9128
 
* geomap:                                geomap internal.     (line   6)
9129
 
* iofem:                                 iofem internal.      (line   6)
 
10343
* geo_element:                           form_element class.  (line   6)
9130
10344
* iorheo <1>:                            rheostream class.    (line   6)
9131
 
* iorheo <2>:                            iorheo class.        (line   6)
9132
 
* iorheo:                                csr class.           (line   6)
 
10345
* iorheo:                                iorheo class.        (line   6)
9133
10346
* irheostream:                           rheostream class.    (line   6)
9134
10347
* numbering <1>:                         numbering internal.  (line   6)
9135
 
* numbering:                             form_element internal.
9136
 
                                                              (line   6)
 
10348
* numbering:                             form_element class.  (line   6)
9137
10349
* occurence:                             smart_pointer internal.
9138
10350
                                                              (line   6)
9139
10351
* orheostream:                           rheostream class.    (line   6)
9140
 
* permutation <1>:                       ssk class.           (line   6)
9141
 
* permutation:                           permutation class.   (line   6)
 
10352
* permutation:                           solver class.        (line   6)
9142
10353
* point <1>:                             point class.         (line   6)
9143
10354
* point:                                 tensor class.        (line   6)
9144
10355
* quadrature:                            quadrature internal. (line   6)
9150
10361
* reference_element <3>:                 reference_element internal.
9151
10362
                                                              (line   6)
9152
10363
* reference_element:                     basis internal.      (line   6)
9153
 
* rheostream:                            geo command.         (line   6)
9154
10364
* smart_pointer:                         smart_pointer internal.
9155
10365
                                                              (line   6)
9156
 
* space <1>:                             characteristic internal.
9157
 
                                                              (line   6)
9158
 
* space <2>:                             geomap internal.     (line   6)
9159
 
* space <3>:                             2D form.             (line   6)
9160
 
* space <4>:                             div_div form.        (line   6)
9161
 
* space <5>:                             mass form.           (line   6)
9162
 
* space <6>:                             d2_ds2 form.         (line   6)
9163
 
* space <7>:                             d_ds form.           (line   6)
9164
 
* space <8>:                             2D_D form.           (line   6)
9165
 
* space <9>:                             2W form.             (line   6)
9166
 
* space <10>:                            d_dx form.           (line   6)
9167
 
* space <11>:                            convect form.        (line   6)
9168
 
* space <12>:                            riesz_representer algorithm.
9169
 
                                                              (line   6)
9170
 
* space <13>:                            trace class.         (line   6)
 
10366
* solver:                                solver class.        (line   6)
 
10367
* space <1>:                             mass form.           (line   6)
 
10368
* space <2>:                             element class.       (line   6)
9171
10369
* space:                                 space class.         (line   6)
9172
 
* ssk <1>:                               csr class.           (line   6)
9173
 
* ssk <2>:                               ssk class.           (line   6)
9174
 
* ssk:                                   permutation class.   (line   6)
9175
 
* ssr:                                   ic0 class.           (line   6)
9176
10370
* string:                                smart_pointer internal.
9177
10371
                                                              (line   6)
9178
10372
* tensor:                                tensor class.        (line   6)
9179
 
* trace:                                 trace class.         (line   6)
9180
 
* vec <1>:                               diag class.          (line   6)
9181
 
* vec <2>:                               csr class.           (line   6)
9182
 
* vec <3>:                               ssk class.           (line   6)
9183
 
* vec <4>:                               vec class.           (line   6)
9184
 
* vec:                                   ic0 class.           (line   6)
 
10373
* vec:                                   solver class.        (line   6)
9185
10374
* Vector:                                Vector class.        (line   6)
9186
10375
 
9187
10376
 
9193
10382
[index]
9194
10383
* Menu:
9195
10384
 
9196
 
* 2D:                                    2D form.               (line 6)
9197
 
* 2D_D:                                  2D_D form.             (line 6)
9198
 
* 2W:                                    2W form.               (line 6)
9199
 
* convect:                               convect form.          (line 6)
9200
 
* curl:                                  curl form.             (line 6)
9201
 
* d2_ds2:                                d2_ds2 form.           (line 6)
9202
 
* d_ds:                                  d_ds form.             (line 6)
9203
 
* d_dx0:                                 d_dx form.             (line 6)
9204
 
* d_dx1:                                 d_dx form.             (line 6)
9205
 
* d_dx2:                                 d_dx form.             (line 6)
9206
 
* div:                                   div form.              (line 6)
9207
 
* div_div:                               div_div form.          (line 6)
9208
 
* grad:                                  grad form.             (line 6)
9209
10385
* grad_grad:                             grad_grad form.        (line 6)
9210
 
* inv_mass <1>:                          inv_mass form.         (line 6)
9211
10386
* inv_mass:                              mass form.             (line 6)
9212
10387
* mass:                                  mass form.             (line 6)
9213
10388
 
9220
10395
[index]
9221
10396
* Menu:
9222
10397
 
9223
 
* bubble <1>:                            mass form.            (line  6)
9224
 
* bubble:                                space class.          (line 27)
9225
 
* H3:                                    d2_ds2 form.          (line  6)
9226
 
* P0 <1>:                                2D form.              (line  6)
9227
 
* P0 <2>:                                inv_mass form.        (line  6)
9228
 
* P0 <3>:                                grad form.            (line  6)
9229
 
* P0 <4>:                                mass form.            (line  6)
9230
 
* P0 <5>:                                div form.             (line  6)
9231
 
* P0 <6>:                                d_ds form.            (line  6)
9232
 
* P0 <7>:                                curl form.            (line  6)
9233
 
* P0 <8>:                                2W form.              (line  6)
9234
 
* P0 <9>:                                d_dx form.            (line  6)
9235
 
* P0 <10>:                               space class.          (line 27)
9236
 
* P0:                                    branch command.       (line 74)
9237
 
* P1 <1>:                                2D form.              (line  6)
9238
 
* P1 <2>:                                div_div form.         (line  6)
9239
 
* P1 <3>:                                grad_grad form.       (line  6)
9240
 
* P1 <4>:                                grad form.            (line  6)
9241
 
* P1 <5>:                                mass form.            (line  6)
9242
 
* P1 <6>:                                div form.             (line  6)
9243
 
* P1 <7>:                                d_ds form.            (line  6)
9244
 
* P1 <8>:                                2D_D form.            (line  6)
9245
 
* P1 <9>:                                curl form.            (line  6)
9246
 
* P1 <10>:                               2W form.              (line  6)
9247
 
* P1 <11>:                               d_dx form.            (line  6)
9248
 
* P1 <12>:                               space class.          (line 27)
9249
 
* P1:                                    branch command.       (line 74)
9250
 
* P1d <1>:                               2D form.              (line  6)
9251
 
* P1d <2>:                               grad_grad form.       (line  6)
9252
 
* P1d <3>:                               inv_mass form.        (line  6)
9253
 
* P1d <4>:                               grad form.            (line  6)
9254
 
* P1d <5>:                               mass form.            (line  6)
9255
 
* P1d <6>:                               div form.             (line  6)
9256
 
* P1d <7>:                               d_ds form.            (line  6)
9257
 
* P1d <8>:                               curl form.            (line  6)
9258
 
* P1d <9>:                               2W form.              (line  6)
9259
 
* P1d <10>:                              d_dx form.            (line  6)
9260
 
* P1d <11>:                              convect form.         (line  6)
9261
 
* P1d:                                   space class.          (line 27)
9262
 
* P2 <1>:                                2D form.              (line  6)
9263
 
* P2 <2>:                                div_div form.         (line  6)
9264
 
* P2 <3>:                                grad_grad form.       (line  6)
9265
 
* P2 <4>:                                grad form.            (line  6)
9266
 
* P2 <5>:                                mass form.            (line  6)
9267
 
* P2 <6>:                                div form.             (line  6)
9268
 
* P2 <7>:                                d_ds form.            (line  6)
9269
 
* P2 <8>:                                2D_D form.            (line  6)
9270
 
* P2 <9>:                                curl form.            (line  6)
9271
 
* P2 <10>:                               2W form.              (line  6)
9272
 
* P2 <11>:                               d_dx form.            (line  6)
9273
 
* P2:                                    space class.          (line 27)
 
10398
* bubble:                                mass form.             (line 6)
 
10399
* P0:                                    mass form.             (line 6)
 
10400
* P1 <1>:                                grad_grad form.        (line 6)
 
10401
* P1:                                    mass form.             (line 6)
 
10402
* P1d <1>:                               grad_grad form.        (line 6)
 
10403
* P1d:                                   mass form.             (line 6)
 
10404
* P2 <1>:                                grad_grad form.        (line 6)
 
10405
* P2:                                    mass form.             (line 6)
9274
10406
 
9275
10407
 
9276
10408
File: rheolef.info,  Node: Function Index,  Up: Top
9282
10414
* Menu:
9283
10415
 
9284
10416
* append_dir_to_rheo_path:               rheostream class.     (line  6)
9285
 
* bicgstab:                              bicgstab algorithm.   (line  6)
9286
 
* catchmark iostream manipulator:        mfield command.       (line 30)
9287
 
* damped\_newton:                        damped-newton algorithm.
9288
 
                                                               (line  6)
9289
10417
* delete_suffix:                         rheostream class.     (line  6)
9290
10418
* fastfieldload:                         iorheo class.         (line 84)
9291
10419
* file_exists:                           rheostream class.     (line  6)
9295
10423
* get_full_name_from_rheo_path:          rheostream class.     (line  6)
9296
10424
* has_suffix:                            rheostream class.     (line  6)
9297
10425
* itos:                                  rheostream class.     (line  6)
9298
 
* newton:                                newton algorithm.     (line  6)
9299
 
* normal:                                iofem internal.       (line 18)
9300
 
* origin:                                iofem internal.       (line 18)
9301
 
* pcg <1>:                               pcg algorithm.        (line  6)
9302
 
* pcg:                                   mixed_solver algorithm.
9303
 
                                                               (line  6)
9304
 
* pcg\_abtb:                             mixed_solver algorithm.
9305
 
                                                               (line  6)
9306
 
* pcg\_abtbc:                            mixed_solver algorithm.
9307
 
                                                               (line  6)
9308
 
* pminres <1>:                           pminres algorithm.    (line  6)
9309
 
* pminres:                               mixed_solver algorithm.
9310
 
                                                               (line  6)
9311
 
* pminres\_abtb:                         mixed_solver algorithm.
9312
 
                                                               (line  6)
9313
 
* pminres\_abtbc:                        mixed_solver algorithm.
9314
 
                                                               (line  6)
 
10426
* pcg:                                   pcg class.            (line  6)
9315
10427
* prepend_dir_to_rheo_path:              rheostream class.     (line  6)
9316
 
* puzawa:                                puzawa algorithm.     (line  6)
9317
 
* qmr <1>:                               gmres algorithm.      (line  6)
9318
 
* qmr:                                   qmr algorithm.        (line  6)
9319
 
* riesz_representer <1>:                 characteristic internal.
9320
 
                                                               (line  6)
9321
 
* riesz_representer:                     riesz_representer algorithm.
9322
 
                                                               (line  6)
9323
10428
* scatch:                                rheostream class.     (line  6)
9324
 
* topography:                            iofem internal.       (line 22)
9325
10429
 
9326
10430
 
9327
10431
File: rheolef.info,  Node: File Format Index,  Up: Top
9334
10438
 
9335
10439
* .1, .3,... unix manual pages:          Installing.          (line  18)
9336
10440
* .atom PlotM mesh:                      iorheo class.        (line   6)
9337
 
* .bamg bamg mesh <1>:                   iorheo class.        (line  90)
9338
 
* .bamg bamg mesh <2>:                   bamg2geo command.    (line   6)
9339
 
* .bamg bamg mesh:                       geo command.         (line 199)
9340
 
* .bb bamg field:                        field command.       (line  65)
9341
 
* .bb mmg3d field:                       field command.       (line  68)
9342
 
* .branch family of fields:              branch command.      (line   8)
9343
 
* .cad:                                  cad class.           (line   6)
9344
 
* .cemagref cemagref topographic mesh <1>: iorheo class.      (line 136)
9345
 
* .cemagref cemagref topographic mesh <2>: cemagref2field command.
9346
 
                                                              (line   6)
9347
 
* .cemagref cemagref topographic mesh <3>: field command.     (line  53)
9348
 
* .cemagref cemagref topographic mesh:   geo command.         (line 171)
9349
 
* .dmn domain names <1>:                 msh2geo command.     (line   6)
9350
 
* .dmn domain names <2>:                 qmg2geo command.     (line   6)
9351
 
* .dmn domain names <3>:                 mesh2geo command.    (line   6)
9352
 
* .dmn domain names <4>:                 bamg2geo command.    (line   6)
9353
 
* .dmn domain names <5>:                 geo command.         (line 261)
9354
 
* .dmn domain names <6>:                 tetgen2geo command.  (line   6)
9355
 
* .dmn domain names:                     grummp2geo command.  (line   6)
 
10441
* .bamg bamg mesh:                       iorheo class.        (line  90)
 
10442
* .cemagref cemagref topographic mesh:   iorheo class.        (line 136)
9356
10443
* .dvi device independent (latex):       Installing.          (line 389)
9357
 
* .ele tetgen mesh elements <1>:         iorheo class.        (line  90)
9358
 
* .ele tetgen mesh elements <2>:         geo command.         (line 213)
9359
 
* .ele tetgen mesh elements:             tetgen2geo command.  (line   6)
9360
 
* .face tetgen mesh boundary faces <1>:  iorheo class.        (line  90)
9361
 
* .face tetgen mesh boundary faces:      geo command.         (line 213)
9362
 
* .face tetgen mesh faces:               tetgen2geo command.  (line   6)
 
10444
* .ele tetgen mesh elements:             iorheo class.        (line  90)
 
10445
* .face tetgen mesh boundary faces:      iorheo class.        (line  90)
9363
10446
* .field field <1>:                      iorheo class.        (line   6)
9364
 
* .field field <2>:                      space class.         (line  18)
9365
 
* .field field <3>:                      branch command.      (line 116)
9366
 
* .field field <4>:                      cemagref2field command.
9367
 
                                                              (line   6)
9368
 
* .field field <5>:                      field command.       (line   6)
9369
 
* .field field:                          mfield command.      (line   6)
9370
 
* .fig Fig, xfig:                        geo command.         (line   6)
9371
 
* .g grummp mesh <1>:                    geo command.         (line 228)
9372
 
* .g grummp mesh:                        grummp2geo command.  (line   6)
 
10447
* .field field:                          field command.       (line   6)
9373
10448
* .gdat gnuplot data:                    iorheo class.        (line   6)
9374
10449
* .geo mesh <1>:                         iorheo class.        (line   6)
9375
 
* .geo mesh <2>:                         geo class.           (line   6)
9376
 
* .geo mesh <3>:                         msh2geo command.     (line   6)
9377
 
* .geo mesh <4>:                         qmg2geo command.     (line   6)
9378
 
* .geo mesh <5>:                         cemagref2field command.
9379
 
                                                              (line   6)
9380
 
* .geo mesh <6>:                         mesh2geo command.    (line   6)
9381
 
* .geo mesh <7>:                         bamg2geo command.    (line   6)
9382
 
* .geo mesh <8>:                         tetgen2geo command.  (line   6)
9383
 
* .geo mesh <9>:                         grummp2geo command.  (line   6)
9384
 
* .geo mesh:                             mkgeo_grid command.  (line   6)
9385
 
* .gz gzip <1>:                          rheostream class.    (line   6)
9386
 
* .gz gzip:                              geo class.           (line   6)
9387
 
* .hb Harwell-Boeing matrix <1>:         iorheo class.        (line   6)
9388
 
* .hb Harwell-Boeing matrix:             csr class.           (line   6)
 
10450
* .geo mesh:                             msh2geo command.     (line   6)
 
10451
* .gif image <1>:                        field command.       (line  40)
 
10452
* .gif image:                            geo command.         (line  79)
 
10453
* .gz gzip:                              rheostream class.    (line   6)
 
10454
* .hb Harwell-Boeing matrix:             iorheo class.        (line   6)
9389
10455
* .html hyper-text markup language:      Installing.          (line 389)
9390
10456
* .info GNU info:                        Installing.          (line  18)
 
10457
* .jpg image <1>:                        iorheo class.        (line 228)
 
10458
* .jpg image <2>:                        field command.       (line  40)
 
10459
* .jpg image:                            geo command.         (line  79)
9391
10460
* .m grummp bidimensionnal mesh:         iorheo class.        (line  90)
9392
 
* .m matlab matrix <1>:                  iorheo class.        (line  90)
9393
 
* .m matlab matrix:                      csr class.           (line   6)
9394
 
* .mesh mmg3d mesh <1>:                  iorheo class.        (line  90)
9395
 
* .mesh mmg3d mesh:                      mesh2geo command.    (line   6)
9396
 
* .mfield multi-field:                   mfield command.      (line   6)
 
10461
* .m matlab matrix:                      iorheo class.        (line  90)
 
10462
* .mesh mmg3d mesh:                      iorheo class.        (line  90)
9397
10463
* .mm Matrix-Market matrix:              iorheo class.        (line   6)
9398
 
* .mmg3d mmg3d mesh:                     geo command.         (line 221)
9399
10464
* .msh gmsh mesh <1>:                    iorheo class.        (line  90)
9400
 
* .msh gmsh mesh <2>:                    msh2geo command.     (line   6)
9401
 
* .msh gmsh mesh:                        geo command.         (line 206)
9402
 
* .mshdat gmsh field:                    field command.       (line  71)
 
10465
* .msh gmsh mesh:                        msh2geo command.     (line   6)
9403
10466
* .mtv plotmtv:                          iorheo class.        (line   6)
9404
 
* .node tetgen mesh nodes <1>:           iorheo class.        (line  90)
9405
 
* .node tetgen mesh nodes <2>:           geo command.         (line 213)
9406
 
* .node tetgen mesh nodes:               tetgen2geo command.  (line   6)
 
10467
* .node tetgen mesh nodes:               iorheo class.        (line  90)
9407
10468
* .off geomview data:                    iorheo class.        (line   6)
9408
10469
* .pdf acrobat:                          Installing.          (line 389)
 
10470
* .pdf image <1>:                        iorheo class.        (line 228)
 
10471
* .pdf image <2>:                        field command.       (line  40)
 
10472
* .pdf image:                            geo command.         (line  79)
9409
10473
* .plot gnuplot script:                  iorheo class.        (line   6)
 
10474
* .png image <1>:                        iorheo class.        (line 228)
 
10475
* .png image <2>:                        field command.       (line  40)
 
10476
* .png image:                            geo command.         (line  79)
 
10477
* .ps image <1>:                         field command.       (line  40)
 
10478
* .ps image:                             geo command.         (line  79)
9410
10479
* .ps postscript <1>:                    iorheo class.        (line  90)
9411
 
* .ps postscript <2>:                    csr class.           (line   6)
9412
 
* .ps postscript <3>:                    geo command.         (line   6)
9413
10480
* .ps postscript:                        Installing.          (line  18)
9414
10481
* .py python script file (for mayavi visualization tool): iorheo class.
9415
10482
                                                              (line 168)
9416
 
* .qmg qmg mesh <1>:                     qmg2geo command.     (line   6)
9417
 
* .qmg qmg mesh:                         geo command.         (line 253)
9418
 
* .qmgcad bamg mesh:                     cad command.         (line  64)
9419
 
* .space space:                          space class.         (line  58)
9420
10483
* .tcl tool command language:            iorheo class.        (line   6)
9421
 
* .template grummp mesh file format specification: geo command.
9422
 
                                                              (line 228)
9423
 
* .tex latex:                            geo command.         (line   6)
9424
10484
* .txt simple ascii text:                Installing.          (line 389)
9425
10485
* .v grummp tridimensionnal mesh:        iorheo class.        (line  90)
9426
10486
* .vtk visualization toolkit:            iorheo class.        (line   6)
9444
10504
                                                              (line 152)
9445
10505
* autoconf <1>:                          FAQ for developers.  (line  14)
9446
10506
* autoconf <2>:                          acinclude internal.  (line   6)
9447
 
* autoconf:                              Installing.          (line 482)
 
10507
* autoconf:                              Installing.          (line 477)
9448
10508
* automake <1>:                          FAQ for developers.  (line  14)
9449
 
* automake:                              Installing.          (line 482)
 
10509
* automake:                              Installing.          (line 477)
9450
10510
* bamg <1>:                              iorheo class.        (line  90)
9451
 
* bamg <2>:                              bamg2geo command.    (line   6)
9452
 
* bamg <3>:                              geo command.         (line 155)
 
10511
* bamg <2>:                              geo command.         (line  32)
9453
10512
* bamg:                                  Installing.          (line 242)
9454
10513
* bash:                                  Installing.          (line  46)
9455
 
* bison:                                 Installing.          (line 482)
 
10514
* bison:                                 Installing.          (line 477)
9456
10515
* blas, basic linear algebra subroutines: Installing.         (line 152)
9457
10516
* boost, generic dense/sparse matrix library: Installing.     (line 288)
9458
10517
* cln, arbitrary precision float library: Installing.         (line 265)
9463
10522
* csh:                                   Installing.          (line  46)
9464
10523
* cvs:                                   FAQ for developers.  (line 143)
9465
10524
* debian:                                Installing.          (line 284)
9466
 
* dmalloc, debug library:                Installing.          (line 434)
 
10525
* dmalloc, debug library:                Installing.          (line 429)
9467
10526
* dmalloc, debug runtime library <1>:    acinclude internal.  (line 125)
9468
10527
* dmalloc, debug runtime library:        Installing.          (line 293)
9469
 
* dot:                                   Installing.          (line 419)
 
10528
* dot:                                   Installing.          (line 414)
9470
10529
* doubledouble, quadruple precision library: Installing.      (line 278)
9471
 
* doxygen:                               Installing.          (line 419)
 
10530
* doxygen:                               Installing.          (line 414)
9472
10531
* dvips:                                 Installing.          (line 389)
9473
10532
* fig2dev:                               Installing.          (line 389)
9474
 
* flex:                                  Installing.          (line 482)
 
10533
* flex:                                  Installing.          (line 477)
9475
10534
* geomview <1>:                          iorheo class.        (line   6)
9476
 
* geomview <2>:                          cad command.         (line  76)
9477
10535
* geomview:                              Installing.          (line 242)
9478
10536
* ghostview:                             Installing.          (line  18)
9479
10537
* gmsh <1>:                              msh2geo command.     (line   6)
9480
 
* gmsh:                                  geo command.         (line 159)
 
10538
* gmsh:                                  geo command.         (line  32)
9481
10539
* gnu c++ compiler:                      Installing.          (line 176)
9482
10540
* gnuplot <1>:                           iorheo class.        (line   6)
9483
 
* gnuplot <2>:                           cad command.         (line  84)
9484
 
* gnuplot <3>:                           branch command.      (line  54)
9485
 
* gnuplot <4>:                           field command.       (line   6)
9486
 
* gnuplot <5>:                           geo command.         (line   6)
 
10541
* gnuplot <2>:                           field command.       (line  55)
 
10542
* gnuplot <3>:                           geo command.         (line  56)
9487
10543
* gnuplot:                               Installing.          (line 242)
9488
 
* gperf:                                 Installing.          (line 482)
9489
 
* grummp <1>:                            grummp2geo command.  (line   6)
 
10544
* gperf:                                 Installing.          (line 477)
9490
10545
* grummp:                                Installing.          (line 242)
9491
 
* gzip <1>:                              rheostream class.    (line   6)
9492
 
* gzip:                                  geo class.           (line   6)
 
10546
* gzip:                                  rheostream class.    (line   6)
9493
10547
* hpux, operating system <1>:            rheolef-config command.
9494
10548
                                                              (line  28)
9495
10549
* hpux, operating system:                Installing.          (line  64)
9499
10553
* lapack, linear algebra package:        Installing.          (line 152)
9500
10554
* latex:                                 Installing.          (line 389)
9501
10555
* latex2html:                            Installing.          (line 389)
9502
 
* libtool:                               Installing.          (line 482)
 
10556
* libtool:                               Installing.          (line 477)
9503
10557
* linux, operating system:               Installing.          (line 183)
9504
10558
* lynx:                                  Installing.          (line 389)
9505
 
* m4:                                    Installing.          (line 482)
 
10559
* m4:                                    Installing.          (line 477)
9506
10560
* mac os x, operating system:            Installing.          (line 183)
9507
10561
* make:                                  FAQ for developers.  (line 143)
9508
10562
* Makefile:                              Installing.          (line   6)
9509
10563
* makeinfo:                              Installing.          (line 389)
9510
10564
* man:                                   Installing.          (line  18)
9511
 
* mayavi <1>:                            iorheo class.        (line 168)
9512
 
* mayavi <2>:                            field command.       (line   6)
9513
 
* mayavi <3>:                            geo command.         (line   6)
9514
 
* mayavi:                                mfield command.      (line 114)
9515
 
* message passing interface (MPI) library: csr class.         (line   6)
 
10565
* mayavi:                                iorheo class.        (line 168)
9516
10566
* metis, computing fill-in ordering of sparse matrix: Installing.
9517
10567
                                                              (line 152)
9518
 
* mmg3d <1>:                             iorheo class.        (line  90)
9519
 
* mmg3d <2>:                             mesh2geo command.    (line   6)
9520
 
* mmg3d:                                 geo command.         (line 167)
9521
 
* mozilla:                               Installing.          (line 419)
9522
 
* octave:                                Installing.          (line 482)
9523
 
* paraview:                              branch command.      (line  54)
 
10568
* mmg3d:                                 iorheo class.        (line  90)
 
10569
* mozilla:                               Installing.          (line 414)
 
10570
* msh2geo:                               msh2geo command.     (line   6)
 
10571
* octave:                                Installing.          (line 477)
9524
10572
* parmetis, distributed mesh partitionner: Installing.        (line 318)
9525
10573
* pastix, distributed direct solver:     Installing.          (line 333)
9526
 
* PlotM <1>:                             iorheo class.        (line   6)
9527
 
* PlotM:                                 geo command.         (line   6)
 
10574
* pastix, multifrontal solver library:   solver class.        (line   6)
 
10575
* PlotM:                                 iorheo class.        (line   6)
9528
10576
* plotmtv <1>:                           iorheo class.        (line   6)
9529
 
* plotmtv <2>:                           branch command.      (line  54)
9530
 
* plotmtv <3>:                           field command.       (line   6)
9531
 
* plotmtv <4>:                           geo command.         (line   6)
9532
 
* plotmtv <5>:                           mfield command.      (line 114)
9533
10577
* plotmtv:                               Installing.          (line 242)
9534
 
* qmg <1>:                               cad command.         (line  64)
9535
 
* qmg <2>:                               qmg2geo command.     (line   6)
9536
 
* qmg <3>:                               geo command.         (line 253)
9537
10578
* qmg:                                   Installing.          (line 242)
9538
10579
* scotch, distributed mesh partitionner: Installing.          (line 310)
9539
10580
* sh:                                    Installing.          (line  46)
9540
 
* spooles, multifrontal solver library <1>: ssk class.        (line   6)
9541
10581
* spooles, multifrontal solver library:  Installing.          (line  77)
9542
10582
* sun solaris, operating system:         Installing.          (line 183)
9543
 
* taucs, out-of-core sparse solver library <1>: ssk class.    (line   6)
9544
10583
* taucs, out-of-core sparse solver library: Installing.       (line  77)
9545
 
* tegen:                                 geo command.         (line 163)
9546
 
* tetgen <1>:                            iorheo class.        (line  90)
9547
 
* tetgen <2>:                            geo command.         (line 213)
9548
 
* tetgen:                                tetgen2geo command.  (line   6)
9549
 
* tetra, grummp mesh generator:          geo command.         (line 228)
 
10584
* tetgen:                                iorheo class.        (line  90)
9550
10585
* tex:                                   Installing.          (line 389)
9551
10586
* texi2html:                             Installing.          (line 389)
9552
10587
* texinfo:                               Installing.          (line 389)
9553
 
* tri, grummp mesh generator:            geo command.         (line 228)
9554
 
* umfpack, multifrontal solver library:  ssk class.           (line   6)
9555
10588
* umfpack, sequential multifrontal solver library: Installing.
9556
10589
                                                              (line 343)
9557
10590
* vtk <1>:                               iorheo class.        (line   6)
9558
 
* vtk <2>:                               branch command.      (line  54)
9559
 
* vtk <3>:                               field command.       (line   6)
9560
 
* vtk <4>:                               geo command.         (line   6)
9561
 
* vtk <5>:                               mfield command.      (line 114)
9562
10591
* vtk:                                   Installing.          (line 242)
9563
10592
* x3d <1>:                               iorheo class.        (line  90)
9564
 
* x3d <2>:                               geo command.         (line   6)
9565
10593
* x3d:                                   Installing.          (line 242)
9566
10594
* xdvi:                                  Installing.          (line 389)
9567
 
* xfig:                                  geo command.         (line   6)
9568
10595
* xpdf:                                  Installing.          (line 389)
9569
10596
 
9570
10597
 
9573
10600
Node: Top784
9574
10601
Node: Abstract1662
9575
10602
Node: Installing2848
9576
 
Node: Problems21894
9577
 
Node: Commands22339
9578
 
Node: mkgeo_grid command22732
9579
 
Node: mfield command25472
9580
 
Node: grummp2geo command30284
9581
 
Node: tetgen2geo command30827
9582
 
Node: geo command31818
9583
 
Node: bamg2geo command44726
9584
 
Node: mesh2geo command46860
9585
 
Node: field command47820
9586
 
Node: cemagref2field command55741
9587
 
Node: qmg2geo command56573
9588
 
Node: space command57181
9589
 
Node: msh2geo command58028
9590
 
Node: branch command58566
9591
 
Node: cad command62745
9592
 
Node: rheolef-config command66235
9593
 
Node: Classes68823
9594
 
Node: cad class69295
9595
 
Node: geo class70986
9596
 
Node: form_diag_manip class83125
9597
 
Node: space class84768
9598
 
Node: form_diag class95678
9599
 
Node: form_manip class97485
9600
 
Node: field class98851
9601
 
Node: trace class100568
9602
 
Node: domain class101870
9603
 
Node: form class103892
9604
 
Node: branch class107434
9605
 
Node: tensor class109735
9606
 
Node: point class114302
9607
 
Node: ic0 class120657
9608
 
Node: permutation class121790
9609
 
Node: vec class122869
9610
 
Node: ssk class125390
9611
 
Node: csr class129095
9612
 
Node: diag class131883
9613
 
Node: iorheo class134288
9614
 
Node: Vector class141480
9615
 
Node: catchmark class144646
9616
 
Node: rheostream class145620
9617
 
Node: Algorithms150168
9618
 
Node: newton algorithm150486
9619
 
Node: damped-newton algorithm152113
9620
 
Node: riesz_representer algorithm153494
9621
 
Node: mixed_solver algorithm155230
9622
 
Node: pminres algorithm158055
9623
 
Node: qmr algorithm162624
9624
 
Node: pcg algorithm164954
9625
 
Node: bicgstab algorithm168032
9626
 
Node: puzawa algorithm169631
9627
 
Node: gmres algorithm172155
9628
 
Node: Forms178343
9629
 
Node: convect form178624
9630
 
Node: d_dx form179306
9631
 
Node: 2W form180629
9632
 
Node: curl form181651
9633
 
Node: 2D_D form182880
9634
 
Node: d_ds form183880
9635
 
Node: d2_ds2 form184349
9636
 
Node: div form184846
9637
 
Node: mass form185772
9638
 
Node: grad form189589
9639
 
Node: inv_mass form190527
9640
 
Node: grad_grad form191422
9641
 
Node: div_div form192293
9642
 
Node: 2D form193059
9643
 
Node: Internals194127
9644
 
Node: geomap internal194698
9645
 
Node: form_element internal203496
9646
 
Node: iofem internal205232
9647
 
Node: characteristic internal206263
9648
 
Node: point internal208630
9649
 
Node: basis internal209046
9650
 
Node: reference_element internal211789
9651
 
Node: quadrature internal214846
9652
 
Node: quadrangle internal217221
9653
 
Node: prism internal218125
9654
 
Node: hexa internal219752
9655
 
Node: triangle internal221474
9656
 
Node: geo_element internal222320
9657
 
Node: tetra internal226309
9658
 
Node: edge internal227748
9659
 
Node: numbering internal228236
9660
 
Node: smart_pointer internal230313
9661
 
Node: heap_allocator internal231932
9662
 
Node: stack_allocator internal235736
9663
 
Node: pretty_name internal242027
9664
 
Node: acinclude internal243528
9665
 
Node: FAQ for developers258289
9666
 
Node: Copying263013
9667
 
Node: Concept Index282082
9668
 
Node: Program Index297172
9669
 
Node: Class Index299938
9670
 
Node: Bilinear Form Index308237
9671
 
Node: Approximation Index309583
9672
 
Node: Function Index313429
9673
 
Node: File Format Index316465
9674
 
Node: Related Tool Index323558
 
10603
Node: Problems21664
 
10604
Node: Commands22109
 
10605
Node: geo command22272
 
10606
Node: field command25466
 
10607
Node: msh2geo command29329
 
10608
Node: rheolef-config command31531
 
10609
Node: Classes34196
 
10610
Node: geo class35260
 
10611
Node: geo_domain class47605
 
10612
Node: geo_domain_indirect class48329
 
10613
Node: space class49712
 
10614
Node: form_element class54913
 
10615
Node: domain_indirect class56932
 
10616
Node: rheolef class60929
 
10617
Node: field class62280
 
10618
Node: element class68036
 
10619
Node: form class69960
 
10620
Node: tensor class73493
 
10621
Node: point class78196
 
10622
Node: pcg class84620
 
10623
Node: index_set class87708
 
10624
Node: mpi_assembly_end class89480
 
10625
Node: msg_left_permutation_apply class94522
 
10626
Node: polymorphic_map class95629
 
10627
Node: mpi_polymorphic_assembly_begin class97243
 
10628
Node: polymorphic_array class98184
 
10629
Node: mpi_polymorphic_assembly_end class105392
 
10630
Node: distributor class112364
 
10631
Node: msg_from_context_indices class115064
 
10632
Node: msg_both_permutation_apply class117296
 
10633
Node: msg_right_permutation_apply class118536
 
10634
Node: mpi_assembly_begin class119770
 
10635
Node: solver class126992
 
10636
Node: array class129620
 
10637
Node: vec class142646
 
10638
Node: msg_local_optimize class144510
 
10639
Node: msg_to_context class146531
 
10640
Node: asr class149183
 
10641
Node: csr class152707
 
10642
Node: msg_from_context_pattern class160389
 
10643
Node: msg_local_context class162512
 
10644
Node: mpi_scatter_init class164767
 
10645
Node: eye class177621
 
10646
Node: mpi_scatter_begin class178700
 
10647
Node: mpi_scatter_end class185210
 
10648
Node: iorheo class188277
 
10649
Node: Vector class195644
 
10650
Node: catchmark class198810
 
10651
Node: rheostream class199784
 
10652
Node: Algorithms204424
 
10653
Node: msg_local_context algorithm205053
 
10654
Node: msg_left_permutation_apply algorithm207313
 
10655
Node: msg_local_optimize algorithm208425
 
10656
Node: mpi_polymorphic_assembly_end algorithm210451
 
10657
Node: mpi_polymorphic_assembly_begin algorithm217428
 
10658
Node: msg_right_permutation_apply algorithm218374
 
10659
Node: mpi_assembly_end algorithm219613
 
10660
Node: mpi_scatter_begin algorithm224660
 
10661
Node: msg_from_context_pattern algorithm231175
 
10662
Node: mpi_scatter_init algorithm233303
 
10663
Node: msg_both_permutation_apply algorithm246164
 
10664
Node: mpi_assembly_begin algorithm247411
 
10665
Node: msg_to_context algorithm254640
 
10666
Node: msg_from_context_indices algorithm257299
 
10667
Node: mpi_scatter_end algorithm259538
 
10668
Node: Forms262612
 
10669
Node: mass form262718
 
10670
Node: grad_grad form266536
 
10671
Node: Internals267406
 
10672
Node: basis internal268007
 
10673
Node: numbering internal270723
 
10674
Node: tetrahedron internal272789
 
10675
Node: point internal275716
 
10676
Node: scratch_array internal276138
 
10677
Node: hexa internal288512
 
10678
Node: tetra internal291389
 
10679
Node: hexahedron internal294290
 
10680
Node: hack_array internal297196
 
10681
Node: reference_element internal309496
 
10682
Node: quadrature internal314536
 
10683
Node: quadrangle internal316922
 
10684
Node: prism internal318559
 
10685
Node: triangle internal320192
 
10686
Node: geo_element internal321849
 
10687
Node: edge internal323628
 
10688
Node: index_set internal324343
 
10689
Node: smart_pointer internal326120
 
10690
Node: heap_allocator internal327739
 
10691
Node: stack_allocator internal331543
 
10692
Node: pretty_name internal337834
 
10693
Node: acinclude internal339335
 
10694
Node: FAQ for developers354096
 
10695
Node: Copying358820
 
10696
Node: Concept Index377889
 
10697
Node: Program Index384971
 
10698
Node: Class Index386581
 
10699
Node: Bilinear Form Index390686
 
10700
Node: Approximation Index391010
 
10701
Node: Function Index391717
 
10702
Node: File Format Index392774
 
10703
Node: Related Tool Index396686
9675
10704
 
9676
10705
End Tag Table