Commits

BarryFSmith committed 3a2046d

fixes for single precision and complex mostly in Fortran code which did not handle single precision properly at all

Comments (0)

Files changed (23)

include/finclude/petscsys.h

       PetscInt  PETSC_DEFAULT_INTEGER
       parameter (PETSC_DEFAULT_INTEGER = -2)
 
-      PetscFortranDouble PETSC_DEFAULT_DOUBLE_PRECISION
-      parameter (PETSC_DEFAULT_DOUBLE_PRECISION=-2.0d0)
+      PetscReal PETSC_DEFAULT_REAL_PRECISION
+      parameter (PETSC_DEFAULT_REAL_PRECISION=-2.0d0)
 
       PetscEnum PETSC_FP_TRAP_OFF
       PetscEnum PETSC_FP_TRAP_ON
 !
 !     Basic constants
 !
-      PetscFortranDouble PETSC_PI
-      PetscFortranDouble PETSC_MAX_REAL
-      PetscFortranDouble PETSC_MIN_REAL
+      PetscReal PETSC_PI
+      PetscReal PETSC_MAX_REAL
+      PetscReal PETSC_MIN_REAL
 
+#if defined(PETSC_USE_REAL_SINGLE)
+      parameter (PETSC_PI = 3.1415926)
+      parameter (PETSC_MAX_REAL = 3.40282346638528860e+38)
+      parameter (PETSC_MIN_REAL = -3.40282346638528860e+38)
+#else
       parameter (PETSC_PI = 3.14159265358979323846264d0)
-      parameter (PETSC_MAX_REAL = 1.d300,PETSC_MIN_REAL = -1.d300)
+      parameter (PETSC_MAX_REAL = 1.7976931348623157d308)
+      parameter (PETSC_MIN_REAL = -1.7976931348623157d308)
+#endif
 
-      PetscFortranDouble PETSC_MACHINE_EPSILON
-      PetscFortranDouble PETSC_SQRT_MACHINE_EPSILON
-      PetscFortranDouble PETSC_SMALL
+      PetscReal PETSC_MACHINE_EPSILON
+      PetscReal PETSC_SQRT_MACHINE_EPSILON
+      PetscReal PETSC_SMALL
 
 #if defined(PETSC_USE_REAL_SINGLE)
       parameter (PETSC_MACHINE_EPSILON = 1.e-7)

include/petscsys.h

 
    Level: beginner
 
-   Fortran Notes: You need to use PETSC_DEFAULT_INTEGER or PETSC_DEFAULT_DOUBLE_PRECISION.
+   Fortran Notes: You need to use PETSC_DEFAULT_INTEGER or PETSC_DEFAULT_REAL_PRECISION.
 
 .seealso: PETSC_DECIDE, PETSC_IGNORE, PETSC_DETERMINE
 

src/ksp/ksp/examples/tutorials/ex11f.F

       Mat              A
       Vec              x,b,u
       PetscRandom      rctx
-      double precision norm,h2,sigma1
+      PetscReal norm,h2,sigma1
       PetscScalar  none,sigma2,v,pfive,czero
       PetscScalar  cone
       PetscInt dim,its,n,Istart

src/ksp/ksp/examples/tutorials/ex13f90.F

       PetscScalar,ALLOCATABLE :: solution(:,:)
       PetscScalar,ALLOCATABLE :: rho(:,:)
 
-      double precision hx2,hy2
+      PetscReal hx2,hy2
       common /param/ hx2,hy2
 
       tmax = 2
       PetscFortranAddr userctx(*)
 
       common /param/ hx2,hy2
-      double precision hx2,hy2
+      PetscReal hx2,hy2
 
 !  Local variable declararions
       Mat     A
 
 
       common /param/ hx2,hy2
-      double precision hx2,hy2
+      PetscReal hx2,hy2
 
       PC   pc
       KSP ksp

src/ksp/ksp/examples/tutorials/ex14f.F

       external mymult
 
 !     --------------- Data to define nonlinear solver --------------
-      double precision   rtol,ttol
-      double precision   fnorm,ynorm,xnorm
+      PetscReal   rtol,ttol
+      PetscReal   fnorm,ynorm,xnorm
       PetscInt            max_nonlin_its,one
       PetscInt            lin_its
       PetscInt           i,m
       PetscInt  i,j,row,mx
       PetscInt  my, xs,ys,xm
       PetscInt  ym,gxm,gym,gxs,gys
-      double precision one,lambda,temp1,temp,hx,hy
+      PetscReal one,lambda,temp1,temp,hx,hy
       PetscScalar      xx(1)
       DM               da
       Mat              B
       PetscOffset      idx,idf
       PetscErrorCode ierr
       PetscInt i,j,row,mx,my,xs,ys,xm,ym,gxs
-      double precision two,one,lambda,hx
-      double precision hy,hxdhy,hydhx,sc
+      PetscReal two,one,lambda,hx
+      PetscReal hy,hxdhy,hydhx,sc
       PetscScalar      u,uxx,uyy,xx(1),ff(1)
       DM               da
       Mat              B

src/ksp/ksp/examples/tutorials/ex15f.F

       PC               pc
       KSP              ksp
       PetscScalar      v,one,neg_one
-      double precision norm,tol
+      PetscReal norm,tol
       PetscErrorCode ierr
       PetscInt   i,j,II,JJ,Istart
       PetscInt   Iend,m,n,i1,its,five
 
       call KSPGetPC(ksp,pc,ierr)
       tol = 1.e-7
-      call KSPSetTolerances(ksp,tol,PETSC_DEFAULT_DOUBLE_PRECISION,     &
-     &     PETSC_DEFAULT_DOUBLE_PRECISION,PETSC_DEFAULT_INTEGER,ierr)
+      call KSPSetTolerances(ksp,tol,PETSC_DEFAULT_REAL_PRECISION,            &
+     &     PETSC_DEFAULT_REAL_PRECISION,PETSC_DEFAULT_INTEGER,ierr)
 
 !
 !  Set a user-defined shell preconditioner if desired

src/ksp/ksp/examples/tutorials/ex1f.F

       call KSPGetPC(ksp,pc,ierr)
       call PCSetType(pc,PCJACOBI,ierr)
       tol = 1.d-7
-      call KSPSetTolerances(ksp,tol,PETSC_DEFAULT_DOUBLE_PRECISION,     &
-     &     PETSC_DEFAULT_DOUBLE_PRECISION,PETSC_DEFAULT_INTEGER,ierr)
+      call KSPSetTolerances(ksp,tol,PETSC_DEFAULT_REAL_PRECISION,               &
+     &     PETSC_DEFAULT_REAL_PRECISION,PETSC_DEFAULT_INTEGER,ierr)
 
 !  Set runtime options, e.g.,
 !      -ksp_type <type> -pc_type <type> -ksp_monitor -ksp_rtol <rtol>

src/ksp/ksp/examples/tutorials/ex21f.F

       PC               pc
       KSP              ksp
       PetscScalar      v,one,neg_one
-      double precision norm,tol
+      PetscReal norm,tol
       PetscInt i,j,II,JJ,Istart
       PetscInt Iend,m,n,its,ione
       PetscMPIInt rank
 
       call KSPGetPC(ksp,pc,ierr)
       tol = 1.e-7
-      call KSPSetTolerances(ksp,tol,PETSC_DEFAULT_DOUBLE_PRECISION,     &
-     &     PETSC_DEFAULT_DOUBLE_PRECISION,PETSC_DEFAULT_INTEGER,ierr)
+      call KSPSetTolerances(ksp,tol,PETSC_DEFAULT_REAL_PRECISION,               &
+     &     PETSC_DEFAULT_REAL_PRECISION,PETSC_DEFAULT_INTEGER,ierr)
 
 !
 !  Set a user-defined shell preconditioner

src/ksp/ksp/examples/tutorials/ex2f.F

 !  However, local vector data can be easily accessed via VecGetArray().
 !  See the Fortran section of the PETSc users manual for details.
 !
-      double precision  norm
+      PetscReal  norm
       PetscInt  i,j,II,JJ,m,n,its
       PetscInt  Istart,Iend,ione
       PetscErrorCode ierr
 !  These variables are not currently used.
 !      PC          pc
 !      PCType      ptype
-!      double precision tol
+!      PetscReal tol
 
 
 !  Note: Any user-defined Fortran routines (such as MyKSPMonitor)
 !      ptype = PCJACOBI
 !      call PCSetType(pc,ptype,ierr)
 !      tol = 1.e-7
-!      call KSPSetTolerances(ksp,tol,PETSC_DEFAULT_DOUBLE_PRECISION,
-!     &     PETSC_DEFAULT_DOUBLE_PRECISION,PETSC_DEFAULT_INTEGER,ierr)
+!      call KSPSetTolerances(ksp,tol,PETSC_DEFAULT_REAL_PRECISION,
+!     &     PETSC_DEFAULT_REAL_PRECISION,PETSC_DEFAULT_INTEGER,ierr)
 
 !  Set user-defined monitoring routine if desired
 
       PetscErrorCode ierr
       PetscInt n,dummy
       PetscMPIInt rank
-      double precision rnorm
+      PetscReal rnorm
 
 !  Build the solution vector
 
       PetscErrorCode ierr
       PetscInt n,dummy
       KSPConvergedReason flag
-      double precision rnorm
+      PetscReal rnorm
 
       if (rnorm .le. .05) then
         flag = 1

src/ksp/ksp/examples/tutorials/ex43-solcx.h

 
-static void evaluate_solCx(double pos[],double _eta_A,double _eta_B,   /* Input parameters: density, viscosity A, viscosity B */
-                           double _x_c, int _n,                        /* Input parameters: viscosity jump location, wavenumber in z */
-                           double vel[], double *presssure,double total_stress[], double strain_rate[])
+static void evaluate_solCx(PetscReal pos[],PetscReal _eta_A,PetscReal _eta_B,   /* Input parameters: density, viscosity A, viscosity B */
+                           PetscReal _x_c, int _n,                        /* Input parameters: viscosity jump location, wavenumber in z */
+                           PetscReal vel[], PetscReal *presssure,PetscReal total_stress[], PetscReal strain_rate[])
 {
-  double Z,u1,u2,u3,u4,u5,u6,ZA,ZB;
-  double sum1,sum2,sum3,sum4,sum5,sum6,mag,x,z,xc;
-  double _C1A,_C2A,_C3A,_C4A,_C1B,_C2B,_C3B,_C4B,_C1,_C2,_C3,_C4;
+  PetscReal Z,u1,u2,u3,u4,u5,u6,ZA,ZB;
+  PetscReal sum1,sum2,sum3,sum4,sum5,sum6,mag,x,z,xc;
+  PetscReal _C1A,_C2A,_C3A,_C4A,_C1B,_C2B,_C3B,_C4B,_C1,_C2,_C3,_C4;
   int    n,nx;
 
-  double t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40;
-  double t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80;
-  double t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t115,t116,t117,t118,t119,t120;
-  double t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160;
-  double t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199;
-  double t201,t202,t203,t204,t206,t207,t208,t209,t210,t211,t212,t213,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240;
-  double t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t258,t259,t260,t261,t262,t263,t264,t265,t267,t268,t269,t270,t272,t273,t274,t275,t276,t277,t278,t279,t280;
-  double t281,t282,t283,t284,t285,t286,t288,t289,t290,t291,t292,t295,t296,t297,t298,t299,t300,t301,t303,t304,t305,t307,t308,t310,t311,t312,t313,t314,t315,t316,t317,t318,t319,t320;
-  double t321,t322,t323,t324,t325,t326,t327,t328,t329,t330,t331,t332,t334,t335,t336,t337,t338,t339,t340,t341,t342,t344,t345,t346,t347,t348,t349,t350,t351,t352,t353,t354,t355,t356,t358,t359,t360;
-  double t361,t362,t363,t364,t365,t366,t367,t368,t369,t370,t371,t372,t373,t374,t375,t376,t377,t378,t379,t380,t381,t382,t383,t384,t385,t386,t387,t389,t390,t391,t393,t394,t395,t396,t397,t398;
-  double t401,t402,t403,t404,t405,t406,t407,t408,t409,t410,t411,t412,t413,t414,t415,t416,t417,t418,t419,t421,t422,t423,t424,t425,t426,t427,t428,t429,t430,t431,t432,t433,t434,t436,t437,t438,t439,t440;
-  double t441,t442,t443,t444,t445,t446,t447,t448,t450,t451,t453,t454,t455,t456,t457,t458,t459,t461,t462,t463,t464,t465,t466,t468,t469,t470,t471,t474,t475,t478,t480;
-  double t482,t483,t484,t485,t488,t489,t490,t492,t493,t495,t497,t498,t499,t501,t502,t503,t504,t505,t507,t508,t509,t510,t511,t512,t513,t515,t518,t520;
-  double t522,t525,t527,t528,t529,t530,t532,t533,t534,t535,t536,t538,t539,t541,t542,t544,t545,t546,t547,t548,t549,t550,t551,t552,t553,t554,t555,t556,t557,t560;
-  double t561,t562,t563,t564,t567,t568,t571,t573,t575,t576,t578,t579,t583,t590,t591,t594,t595,t596,t597,t598,t600;
-  double t601,t602,t604,t606,t607,t608,t611,t613,t615,t616,t617,t619,t621,t623,t624,t625,t626,t627,t629,t630,t632,t633,t634,t638,t639,t640;
-  double t641,t642,t643,t644,t645,t647,t648,t649,t650,t651,t652,t653,t654,t655,t656,t657,t658,t659,t660,t662,t663,t665,t666,t667,t668,t670,t671,t672,t673,t674,t675,t676,t679,t680;
-  double t682,t683,t684,t685,t686,t688,t689,t690,t691,t693,t694,t695,t696,t697,t698,t699,t700,t701,t702,t704,t705,t708,t709,t711,t712,t713,t714,t717,t718,t719;
-  double t721,t722,t723,t726,t727,t728,t730,t733,t734,t735,t736,t737,t738,t739,t740,t741,t744,t745,t746,t749,t750,t752,t753,t754,t755,t757,t758,t759,t760;
-  double t761,t762,t763,t764,t766,t767,t768,t770,t771,t772,t773,t774,t775,t776,t777,t778,t780,t781,t782,t785,t786,t789,t790,t791,t792,t793,t794,t795,t796,t797,t798,t800;
-  double t801,t806,t807,t808,t809,t811,t812,t817,t818,t819,t821,t822,t824,t827,t828,t830,t834,t835,t837,t840;
-  double t842,t843,t844,t845,t846,t849,t850,t853,t854,t855,t857,t858,t859,t860,t863,t864,t867,t868,t869,t873,t874,t877,t878,t879,t880;
-  double t884,t888,t891,t894,t900,t901,t903,t904,t907,t908,t909,t911,t914,t915,t916,t919,t920;
-  double t923,t924,t925,t926,t927,t929,t932,t935,t937,t939,t942,t943,t944,t945,t947,t948,t949,t950,t952,t953,t954,t955,t956,t957;
-  double t961,t964,t965,t966,t967,t968,t969,t971,t972,t974,t977,t978,t981,t983,t987,t988,t992,t993,t994,t997,t998;
-  double t1001,t1003,t1005,t1006,t1009,t1010,t1012,t1013,t1015,t1016,t1017,t1018,t1020,t1021,t1029,t1031,t1032,t1033,t1040;
-  double t1041,t1042,t1044,t1047,t1050,t1054,t1055,t1057,t1058,t1063,t1068,t1069,t1070,t1079,t1080;
-  double t1088,t1089,t1091,t1092,t1094,t1096,t1101,t1102,t1103,t1104,t1105,t1108,t1112,t1113,t1118,t1119,t1120;
-  double t1121,t1122,t1123,t1124,t1125,t1126,t1127,t1128,t1129,t1130,t1132,t1133,t1134,t1135,t1138,t1139,t1140,t1141,t1142,t1145,t1146,t1148,t1149,t1150,t1153,t1154,t1156,t1157,t1158,t1159;
-  double t1161,t1162,t1165,t1166,t1170,t1171,t1172,t1173,t1175,t1176,t1178,t1180,t1181,t1182,t1185,t1189,t1192,t1193,t1195,t1196,t1199;
-  double t1201,t1203,t1209,t1210,t1211,t1213,t1214,t1218,t1221,t1224,t1225,t1226,t1228,t1233,t1234,t1235,t1236,t1237,t1240;
-  double t1241,t1242,t1243,t1244,t1245,t1248,t1251,t1252,t1257,t1258,t1259,t1260,t1263,t1268,t1269,t1272,t1280;
-  double t1282,t1283,t1284,t1285,t1287,t1288,t1289,t1292,t1293,t1296,t1297,t1300,t1304,t1307,t1310,t1311,t1312,t1316,t1317,t1320;
-  double t1321,t1323,t1328,t1330,t1331,t1332,t1333,t1336,t1338,t1343,t1344,t1346,t1349,t1350,t1354;
-  double t1366,t1369,t1370,t1371,t1376,t1378,t1380,t1383,t1386,t1387,t1388,t1391,t1393,t1399;
-  double t1411,t1412,t1420,t1427;
-  double t1450,t1456,t1468,t1472,t1474,t1478;
-  double t1504,t1511;
-  double t1545;
-  double t1564,t1583;
+  PetscReal t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40;
+  PetscReal t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80;
+  PetscReal t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t115,t116,t117,t118,t119,t120;
+  PetscReal t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160;
+  PetscReal t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199;
+  PetscReal t201,t202,t203,t204,t206,t207,t208,t209,t210,t211,t212,t213,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240;
+  PetscReal t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t258,t259,t260,t261,t262,t263,t264,t265,t267,t268,t269,t270,t272,t273,t274,t275,t276,t277,t278,t279,t280;
+  PetscReal t281,t282,t283,t284,t285,t286,t288,t289,t290,t291,t292,t295,t296,t297,t298,t299,t300,t301,t303,t304,t305,t307,t308,t310,t311,t312,t313,t314,t315,t316,t317,t318,t319,t320;
+  PetscReal t321,t322,t323,t324,t325,t326,t327,t328,t329,t330,t331,t332,t334,t335,t336,t337,t338,t339,t340,t341,t342,t344,t345,t346,t347,t348,t349,t350,t351,t352,t353,t354,t355,t356,t358,t359,t360;
+  PetscReal t361,t362,t363,t364,t365,t366,t367,t368,t369,t370,t371,t372,t373,t374,t375,t376,t377,t378,t379,t380,t381,t382,t383,t384,t385,t386,t387,t389,t390,t391,t393,t394,t395,t396,t397,t398;
+  PetscReal t401,t402,t403,t404,t405,t406,t407,t408,t409,t410,t411,t412,t413,t414,t415,t416,t417,t418,t419,t421,t422,t423,t424,t425,t426,t427,t428,t429,t430,t431,t432,t433,t434,t436,t437,t438,t439,t440;
+  PetscReal t441,t442,t443,t444,t445,t446,t447,t448,t450,t451,t453,t454,t455,t456,t457,t458,t459,t461,t462,t463,t464,t465,t466,t468,t469,t470,t471,t474,t475,t478,t480;
+  PetscReal t482,t483,t484,t485,t488,t489,t490,t492,t493,t495,t497,t498,t499,t501,t502,t503,t504,t505,t507,t508,t509,t510,t511,t512,t513,t515,t518,t520;
+  PetscReal t522,t525,t527,t528,t529,t530,t532,t533,t534,t535,t536,t538,t539,t541,t542,t544,t545,t546,t547,t548,t549,t550,t551,t552,t553,t554,t555,t556,t557,t560;
+  PetscReal t561,t562,t563,t564,t567,t568,t571,t573,t575,t576,t578,t579,t583,t590,t591,t594,t595,t596,t597,t598,t600;
+  PetscReal t601,t602,t604,t606,t607,t608,t611,t613,t615,t616,t617,t619,t621,t623,t624,t625,t626,t627,t629,t630,t632,t633,t634,t638,t639,t640;
+  PetscReal t641,t642,t643,t644,t645,t647,t648,t649,t650,t651,t652,t653,t654,t655,t656,t657,t658,t659,t660,t662,t663,t665,t666,t667,t668,t670,t671,t672,t673,t674,t675,t676,t679,t680;
+  PetscReal t682,t683,t684,t685,t686,t688,t689,t690,t691,t693,t694,t695,t696,t697,t698,t699,t700,t701,t702,t704,t705,t708,t709,t711,t712,t713,t714,t717,t718,t719;
+  PetscReal t721,t722,t723,t726,t727,t728,t730,t733,t734,t735,t736,t737,t738,t739,t740,t741,t744,t745,t746,t749,t750,t752,t753,t754,t755,t757,t758,t759,t760;
+  PetscReal t761,t762,t763,t764,t766,t767,t768,t770,t771,t772,t773,t774,t775,t776,t777,t778,t780,t781,t782,t785,t786,t789,t790,t791,t792,t793,t794,t795,t796,t797,t798,t800;
+  PetscReal t801,t806,t807,t808,t809,t811,t812,t817,t818,t819,t821,t822,t824,t827,t828,t830,t834,t835,t837,t840;
+  PetscReal t842,t843,t844,t845,t846,t849,t850,t853,t854,t855,t857,t858,t859,t860,t863,t864,t867,t868,t869,t873,t874,t877,t878,t879,t880;
+  PetscReal t884,t888,t891,t894,t900,t901,t903,t904,t907,t908,t909,t911,t914,t915,t916,t919,t920;
+  PetscReal t923,t924,t925,t926,t927,t929,t932,t935,t937,t939,t942,t943,t944,t945,t947,t948,t949,t950,t952,t953,t954,t955,t956,t957;
+  PetscReal t961,t964,t965,t966,t967,t968,t969,t971,t972,t974,t977,t978,t981,t983,t987,t988,t992,t993,t994,t997,t998;
+  PetscReal t1001,t1003,t1005,t1006,t1009,t1010,t1012,t1013,t1015,t1016,t1017,t1018,t1020,t1021,t1029,t1031,t1032,t1033,t1040;
+  PetscReal t1041,t1042,t1044,t1047,t1050,t1054,t1055,t1057,t1058,t1063,t1068,t1069,t1070,t1079,t1080;
+  PetscReal t1088,t1089,t1091,t1092,t1094,t1096,t1101,t1102,t1103,t1104,t1105,t1108,t1112,t1113,t1118,t1119,t1120;
+  PetscReal t1121,t1122,t1123,t1124,t1125,t1126,t1127,t1128,t1129,t1130,t1132,t1133,t1134,t1135,t1138,t1139,t1140,t1141,t1142,t1145,t1146,t1148,t1149,t1150,t1153,t1154,t1156,t1157,t1158,t1159;
+  PetscReal t1161,t1162,t1165,t1166,t1170,t1171,t1172,t1173,t1175,t1176,t1178,t1180,t1181,t1182,t1185,t1189,t1192,t1193,t1195,t1196,t1199;
+  PetscReal t1201,t1203,t1209,t1210,t1211,t1213,t1214,t1218,t1221,t1224,t1225,t1226,t1228,t1233,t1234,t1235,t1236,t1237,t1240;
+  PetscReal t1241,t1242,t1243,t1244,t1245,t1248,t1251,t1252,t1257,t1258,t1259,t1260,t1263,t1268,t1269,t1272,t1280;
+  PetscReal t1282,t1283,t1284,t1285,t1287,t1288,t1289,t1292,t1293,t1296,t1297,t1300,t1304,t1307,t1310,t1311,t1312,t1316,t1317,t1320;
+  PetscReal t1321,t1323,t1328,t1330,t1331,t1332,t1333,t1336,t1338,t1343,t1344,t1346,t1349,t1350,t1354;
+  PetscReal t1366,t1369,t1370,t1371,t1376,t1378,t1380,t1383,t1386,t1387,t1388,t1391,t1393,t1399;
+  PetscReal t1411,t1412,t1420,t1427;
+  PetscReal t1450,t1456,t1468,t1472,t1474,t1478;
+  PetscReal t1504,t1511;
+  PetscReal t1545;
+  PetscReal t1564,t1583;
 
 
   /* del_rho = sin(n*Pi*z)*cos(nx*Pi*x)  n=nx gives only non-zero terms*/
   _C1A = 0;
   /****************************************************************************************/
   t1    = nx * 0.3141592654e1;
-  t2    = sin(t1);
+  t2    = PetscSinReal(t1);
   t3    = nx * t2;
   t4    = n * n;
   t5    = t4 * t4;
   t6    = 0.3141592654e1 * 0.3141592654e1;
   t8    = t3 * t5 * t6;
   t9    = ZA * xc;
-  t12   = exp(xc * n * 0.3141592654e1);
+  t12   = PetscExpReal(xc * n * 0.3141592654e1);
   t13   = t12 * t12;
   t15   = n * 0.3141592654e1;
-  t16   = exp(t15);
+  t16   = PetscExpReal(t15);
   t17   = t16 * t16;
   t18   = t17 * t16;
   t19   = ZB * t13 * t18;
   t29   = t28 * t13;
   t33   = nx * ZB;
   t34   = t1 * xc;
-  t35   = sin(t34);
+  t35   = PetscSinReal(t34);
   t36   = t4 * n;
   t37   = t35 * t36;
   t38   = t33 * t37;
   t53   = xc * xc;
   t54   = t36 * t53;
   t56   = t54 * t6 * t45;
-  t57   = cos(t34);
+  t57   = PetscCosReal(t34);
   t58   = t57 * t24;
   t59   = t28 * t12;
   t60   = t17 * t59;
   t3   = t2 * 0.3141592654e1;
   t4   = t3 * xc;
   t5   = ZB * ZB;
-  t7   = exp(n * 0.3141592654e1);
+  t7   = PetscExpReal(n * 0.3141592654e1);
   t8   = t7 * t7;
   t9   = t5 * t8;
-  t12  = exp(xc * n * 0.3141592654e1);
+  t12  = PetscExpReal(xc * n * 0.3141592654e1);
   t13  = t12 * t12;
   t14  = t13 * t13;
   t15  = t14 * t13;
   t19  = nx * nx;
   t21  = nx * 0.3141592654e1;
-  t22  = sin(t21);
+  t22  = PetscSinReal(t21);
   t23  = t19 * nx * t22;
   t24  = t23 * 0.3141592654e1;
   t25  = ZA * ZB;
   t26  = t7 * t15;
   t27  = t25 * t26;
   t30  = t21 * xc;
-  t31  = sin(t30);
+  t31  = PetscSinReal(t30);
   t32  = t31 * nx;
   t33  = t32 * n;
   t34  = ZA * ZA;
   t81  = t80 * t34;
   t83  = t61 * t14;
   t87  = t1 * t19;
-  t88  = cos(t30);
+  t88  = PetscCosReal(t30);
   t90  = t87 * t88 * t61;
   t91  = t5 * t64;
   t92  = t13 * t12;
   /****************************************************************************************/
   t1    = nx * 0.3141592654e1;
   t2    = t1 * xc;
-  t3    = cos(t2);
+  t3    = PetscCosReal(t2);
   t4    = nx * nx;
   t6    = n * 0.3141592654e1;
   t7    = t3 * t4 * t6;
   t8    = ZA * ZB;
-  t9    = exp(t6);
+  t9    = PetscExpReal(t6);
   t10   = t9 * t9;
   t11   = xc * n;
-  t13   = exp(t11 * 0.3141592654e1);
+  t13   = PetscExpReal(t11 * 0.3141592654e1);
   t14   = t13 * t13;
   t15   = t14 * t13;
   t16   = t14 * t14;
   t17   = t16 * t15;
   t18   = t10 * t17;
   t19   = t8 * t18;
-  t22   = sin(t2);
+  t22   = PetscSinReal(t2);
   t23   = nx * t22;
   t24   = t23 * n;
   t25   = ZB * ZB;
   t38   = t16 * t13;
   t39   = t10 * t38;
   t40   = t37 * t39;
-  t43   = sin(t1);
+  t43   = PetscSinReal(t1);
   t44   = nx * t43;
   t45   = t30 * 0.3141592654e1;
   t46   = t44 * t45;
   t5    = t3 * t4;
   t6    = nx * 0.3141592654e1;
   t7    = t6 * xc;
-  t8    = sin(t7);
+  t8    = PetscSinReal(t7);
   t9    = t8 * ZB;
   t10   = n * 0.3141592654e1;
-  t11   = exp(t10);
+  t11   = PetscExpReal(t10);
   t12   = t11 * t11;
-  t15   = exp(xc * n * 0.3141592654e1);
+  t15   = PetscExpReal(xc * n * 0.3141592654e1);
   t16   = t15 * t15;
   t17   = t16 * t16;
   t18   = t17 * t15;
   t34   = t1 * xc;
   t35   = 0.3141592654e1 * ZB;
   t36   = t34 * t35;
-  t37   = cos(t7);
+  t37   = PetscCosReal(t7);
   t38   = ZA * t37;
   t39   = nx * nx;
   t40   = t39 * t12;
   t46   = t25 * n;
   t47   = t46 * 0.3141592654e1;
   t48   = t39 * nx;
-  t49   = sin(t6);
+  t49   = PetscSinReal(t6);
   t50   = t48 * t49;
   t51   = t12 * t11;
   t52   = t51 * t17;
   t3    = t2 * nx;
   t4    = nx * 0.3141592654e1;
   t5    = t4 * xc;
-  t6    = sin(t5);
+  t6    = PetscSinReal(t5);
   t7    = 0.3141592654e1 * 0.3141592654e1;
   t9    = t3 * t6 * t7;
   t10   = xc * xc;
   t11   = ZA * ZA;
   t12   = t10 * t11;
   t13   = n * 0.3141592654e1;
-  t14   = exp(t13);
+  t14   = PetscExpReal(t13);
   t15   = t14 * t14;
   t16   = xc * n;
-  t18   = exp(t16 * 0.3141592654e1);
+  t18   = PetscExpReal(t16 * 0.3141592654e1);
   t19   = t18 * t18;
   t20   = t19 * t18;
   t21   = t15 * t20;
   t49   = t7 * xc;
   t50   = t35 * t15;
   t51   = t49 * t50;
-  t55   = sin(t4);
+  t55   = PetscSinReal(t4);
   t56   = t46 * nx * t55;
   t58   = t56 * n * t7;
   t59   = ZB * ZB;
   t66   = t19 * t14;
   t67   = t60 * t66;
   t70   = t28 * t42;
-  t73   = cos(t5);
+  t73   = PetscCosReal(t5);
   t74   = t47 * t73;
   t75   = t7 * t11;
   t77   = t75 * t10 * t36;
   t5    = t2 * 0.3141592654e1 * t3;
   t6    = nx * 0.3141592654e1;
   t7    = t6 * xc;
-  t8    = cos(t7);
+  t8    = PetscCosReal(t7);
   t9    = nx * nx;
   t10   = t8 * t9;
   t11   = n * 0.3141592654e1;
-  t12   = exp(t11);
+  t12   = PetscExpReal(t11);
   t13   = t12 * t12;
-  t16   = exp(xc * n * 0.3141592654e1);
+  t16   = PetscExpReal(xc * n * 0.3141592654e1);
   t17   = t16 * t16;
   t18   = t17 * t16;
   t19   = t17 * t17;
   t31   = t29 * t30;
   t35   = t9 * nx;
   t36   = t3 * t35;
-  t37   = sin(t6);
+  t37   = PetscSinReal(t6);
   t38   = t13 * t12;
   t39   = t37 * t38;
   t40   = t39 * t19;
   t80   = t77 * t79;
   t82   = t3 * t38;
   t84   = t54 * t37;
-  t87   = sin(t7);
+  t87   = PetscSinReal(t7);
   t88   = t29 * t87;
   t89   = t47 * t44;
   t93   = nx * t25;
   t13  = nx * nx;
   t14  = t13 * t13;
   t15  = t12 * t14;
-  t19  = exp(t12 * 0.3141592654e1);
+  t19  = PetscExpReal(t12 * 0.3141592654e1);
   t20  = t19 * t19;
   t21  = t4 * t20;
   t24  = _C1 * t5;
   t90  = -0.4e1 * t11 * t33 - 0.4e1 * t58 * t59 * t13 - 0.4e1 * t58 * t51 * t63 - 0.2e1 * t67 * t51 * t68 + 0.4e1 * t32 * t45 * t13 - 0.2e1 * t67 * t59 * t14 - 0.2e1 * t30 * t21 + t1 + 0.2e1 * t24 * t25 * t2 + 0.2e1 * t12 * t45 * t14 + 0.4e1 * t24 * Z * t87;
   t106 = _C3 * t5;
   t120 = -0.4e1 * t30 * t32 * t63 + t63 + 0.4e1 * t24 * Z * t1 * t13 + 0.2e1 * t29 * Z * x * t3 - 0.4e1 * t58 * t51 * t13 - 0.2e1 * t106 * t2 + t32 * 0.3141592654e1 - 0.2e1 * t106 * t14 - 0.2e1 * t30 * t12 * t68 - 0.2e1 * t67 * t51 * t14 + 0.4e1 * t106 * t87;
-  t129 = sin(nx * 0.3141592654e1 * x);
+  t129 = PetscSinReal(nx * 0.3141592654e1 * x);
   t155 = 0.2e1 * t30 * t15 + x * 0.3141592654e1 * t41 * t13 - 0.4e1 * t19 * nx * t129 * n + t32 * 0.3141592654e1 * t20 + 0.2e1 * t106 * t68 + 0.2e1 * t106 * t20 * t2 - 0.4e1 * t106 * t1 * t13 - 0.2e1 * t11 * t4 + 0.2e1 * t4 * t45 + 0.2e1 * t24 * Z * t2 + 0.2e1 * t24 * Z * t14 + t12 * 0.3141592654e1 * t13;
   t158 = t5 * Z;
 
   t14  = x * t13;
   t15  = t5 * _C4;
   t16  = x * n;
-  t18  = exp(t16 * 0.3141592654e1);
+  t18  = PetscExpReal(t16 * 0.3141592654e1);
   t19  = t18 * t18;
   t23  = t16 * t5;
   t24  = t8 * t8;
   t91  = 0.4e1 * t58 * t60 + 0.2e1 * t33 * t16 * t63 + 0.4e1 * t33 * t67 + 0.2e1 * t33 * t29 - x * 0.3141592654e1 * t73 * t8 - 0.2e1 * t53 + 0.2e1 * t32 * Z * x * t13 - 0.2e1 * t58 * t12 - 0.2e1 * t58 * t24 + t3 * 0.3141592654e1 + 0.4e1 * t86 * t2 * t19 * t8;
   t94  = Z * t12;
   t121 = -0.2e1 * t8 + 0.2e1 * t45 * t94 * t19 + 0.2e1 * t14 * t5 * t7 * t19 + 0.4e1 * t6 * t7 * t53 + 0.2e1 * t23 * t7 * t63 - 0.4e1 * t28 * t67 + 0.2e1 * t45 * t94 + 0.2e1 * t58 * t12 * t19 + t16 * 0.3141592654e1 * t8 + 0.2e1 * t14 * t15 - 0.2e1 * t28 * t14;
-  t146 = cos(nx * 0.3141592654e1 * x);
+  t146 = PetscCosReal(nx * 0.3141592654e1 * x);
   t156 = -t3 * 0.3141592654e1 * t19 + 0.2e1 * t58 * t63 - 0.4e1 * t58 * t1 * t8 + 0.4e1 * t45 * Z * t1 * t8 - 0.2e1 * t28 * t34 + 0.2e1 * t86 * t73 * t24 + 0.4e1 * t3 * t15 * t8 + 0.4e1 * t45 * Z * t60 + 0.4e1 * t18 * t146 * t8 + 0.2e1 * t45 * Z * t24 + 0.2e1 * t16 * t15 * t24;
   t159 = t4 * Z;
 
   t7   = t6 * n;
   t8   = x * t7;
   t9   = x * n;
-  t11  = exp(t9 * 0.3141592654e1);
+  t11  = PetscExpReal(t9 * 0.3141592654e1);
   t12  = t11 * t11;
   t13  = t8 * t12;
   t16  = t5 * n;
   t78  = _C1 * t1;
   t90  = Z * t12;
   t94  = 0.2e1 * t28 * t58 + 0.2e1 * t61 * t62 + 0.2e1 * t61 * t12 * t6 - 0.4e1 * t4 * t17 * t48 + 0.2e1 * t28 * t8 + 0.4e1 * t61 * t73 - 0.2e1 * t8 * t24 - 0.2e1 * t78 * Z * t6 - 0.2e1 * t44 * t40 * t62 - 0.2e1 * t78 * Z * t31 - t9 * 0.3141592654e1 * t20 + 0.2e1 * t78 * t90 * t6;
-  t101 = cos(nx * 0.3141592654e1 * x);
+  t101 = PetscCosReal(nx * 0.3141592654e1 * x);
   t102 = t11 * t101;
   t109 = t12 * t5;
   t110 = t109 * t20;
   t8   = t3 * t6 * x;
   t11  = x * t4;
   t12  = t11 * t3;
-  t15  = exp(x * n * 0.3141592654e1);
+  t15  = PetscExpReal(x * n * 0.3141592654e1);
   t16  = t15 * t15;
   t17  = _C3 * t16;
   t18  = nx * nx;
   t33  = _C4 * t3;
   t34  = t5 * x;
   t35  = t34 * t18;
-  t41  = sin(nx * 0.3141592654e1 * x);
+  t41  = PetscSinReal(nx * 0.3141592654e1 * x);
   t47  = t11 * t19;
   t54  = t3 * _C3;
   t57  = 0.2e1 * t1 * t8 + 0.2e1 * t12 * t17 * t19 + 0.2e1 * t1 * t24 * t16 + 0.2e1 * t28 * t30 - 0.4e1 * t33 * t35 + 0.2e1 * t15 * nx * t41 * t4 + 0.4e1 * t28 * t35 - 0.2e1 * t33 * t47 - 0.2e1 * t1 * t24 - 0.2e1 * t33 * t29 + 0.2e1 * t29 * t54;
   /****************************************************************************************/
 
 
-  u5 = (double)(-2*Z*n*PETSC_PI*u2-u3*2*n*PETSC_PI)*cos(n*PETSC_PI*z); /* pressure */
+  u5 = (PetscReal)(-2*Z*n*PETSC_PI*u2-u3*2*n*PETSC_PI)*PetscCosReal(n*PETSC_PI*z); /* pressure */
 
-  u6    = (double)(u3*2*n*PETSC_PI + 4*Z*n*PETSC_PI*u2)*cos(n*PETSC_PI*z); /* zz stress */
+  u6    = (PetscReal)(u3*2*n*PETSC_PI + 4*Z*n*PETSC_PI*u2)*PetscCosReal(n*PETSC_PI*z); /* zz stress */
   sum5 +=u5;
   sum6 +=u6;
 
-  u1   *= cos(n*PETSC_PI*z); /* x velocity */
+  u1   *= PetscCosReal(n*PETSC_PI*z); /* x velocity */
   sum1 += u1;
-  u2   *= sin(n*PETSC_PI*z); /* z velocity */
+  u2   *= PetscSinReal(n*PETSC_PI*z); /* z velocity */
   sum2 += u2;
-  u3   *= 2*n*PETSC_PI*cos(n*PETSC_PI *z); /* xx stress */
+  u3   *= 2*n*PETSC_PI*PetscCosReal(n*PETSC_PI *z); /* xx stress */
   sum3 += u3;
-  u4   *= 2*n*PETSC_PI*sin(n*PETSC_PI *z); /* zx stress */
+  u4   *= 2*n*PETSC_PI*PetscSinReal(n*PETSC_PI *z); /* zx stress */
   sum4 += u4;
 
 
   if (0) {
-    mag=sqrt(sum1*sum1+sum2*sum2);
+    mag=PetscSqrtReal(sum1*sum1+sum2*sum2);
     printf("%0.7f %0.7f %0.7f %0.7f %0.7f %0.7f %0.7f %0.7f %0.7f\n",x,z,sum1,sum2,sum3,sum4,sum5,sum6,mag);
   }
 

src/ksp/ksp/examples/tutorials/ex43.c

   ierr = DMDAGetGhostCorners(da,&si,&sj,0,&ei,&ej,0);CHKERRQ(ierr);
   for (j = sj; j < sj+ej; j++) {
     for (i = si; i < si+ei; i++) {
-      double pos[2],pressure,vel[2],total_stress[3],strain_rate[3];
+      PetscReal pos[2],pressure,vel[2],total_stress[3],strain_rate[3];
 
       pos[0] = PetscRealPart(_coords[j][i].x);
       pos[1] = PetscRealPart(_coords[j][i].y);
   ierr = DMDAGetInfo(stokes_da,0,&M,0,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
   ierr = DMDAGetBoundingBox(stokes_da,xymin,xymax);CHKERRQ(ierr);
 
-  h = (xymax[0]-xymin[0])/((double)M);
+  h = (xymax[0]-xymin[0])/((PetscReal)M);
 
   tp_L2 = tu_L2 = tu_H1 = 0.0;
 
           if (coord_x > opts_xc) element_props[j][i].eta[p] = opts_eta1;
 
           element_props[j][i].fx[p] = 0.0;
-          element_props[j][i].fy[p] = sin((double)opts_nz*PETSC_PI*coord_y)*cos(1.0*PETSC_PI*coord_x);
+          element_props[j][i].fy[p] = PetscSinReal(opts_nz*PETSC_PI*coord_y)*PetscCosReal(1.0*PETSC_PI*coord_x);
         }
       } else if (coefficient_structure == 1) { /* square sinker */
         PetscReal opts_eta0,opts_eta1,opts_dx,opts_dy;
 
           radius2 = PetscSqr(coord_x - opts_c0x) + PetscSqr(coord_y - opts_c0y);
           if (radius2 < opts_r*opts_r
-              || (PetscAbs(+(coord_x - opts_s0x)*cos(opts_phi) + (coord_y - opts_s0y)*sin(opts_phi)) < opts_dx/2
-                  && PetscAbs(-(coord_x - opts_s0x)*sin(opts_phi) + (coord_y - opts_s0y)*cos(opts_phi)) < opts_dy/2)) {
+              || (PetscAbs(+(coord_x - opts_s0x)*PetscCosReal(opts_phi) + (coord_y - opts_s0y)*PetscSinReal(opts_phi)) < opts_dx/2
+                  && PetscAbs(-(coord_x - opts_s0x)*PetscSinReal(opts_phi) + (coord_y - opts_s0y)*PetscCosReal(opts_phi)) < opts_dy/2)) {
             element_props[j][i].eta[p] =  opts_eta1;
             element_props[j][i].fx[p]  =  0.0;
             element_props[j][i].fy[p]  = -1.0;

src/ksp/ksp/examples/tutorials/ex57f.F

 !  See the Fortran section of the PETSc users manual for details.
 !
       PetscReal       norm
-      PetscInt        i,j,II,JJ,m,n,its,icntl,ival
-      PetscInt        Istart,Iend,ione
+      PetscInt i,j,II,JJ,m,n,its,icntl,ival
+      PetscInt Istart,Iend,ione
       PetscErrorCode  ierr
       PetscMPIInt     rank,size
       PetscBool       flg
 !   Check if A is symmetric
       if (size == 1) then
         call MatIsSymmetric(A,0.0,flg,ierr)
-        if (flg .eq. PETSC_FALSE) then
+        if (flg .eqv. PETSC_FALSE) then
           write(6,120)
         endif
       endif
       PetscErrorCode ierr
       PetscInt n,dummy
       PetscMPIInt rank
-      double precision rnorm
+      PetscReal rnorm
 
 !  Build the solution vector
 
       PetscErrorCode ierr
       PetscInt n,dummy
       KSPConvergedReason flag
-      double precision rnorm
+      PetscReal rnorm
 
       if (rnorm .le. .05) then
         flag = 1

src/ksp/ksp/interface/itcreate.c

   ksp->max_it  = 10000;
   ksp->pc_side = PC_SIDE_DEFAULT;
   ksp->rtol    = 1.e-5;
+#if defined(PETSC_USE_REAL_SINGLE)
+  ksp->abstol  = 1.e-25;
+#else
   ksp->abstol  = 1.e-50;
+#endif
   ksp->divtol  = 1.e4;
 
   ksp->chknorm        = -1;

src/snes/examples/tests/ex14f.F

 
 ! Setup nonlinear solver, and call SNESSolve() for first few iterations, which calls SNESSetUp() :-(
 !--------------------------------------------------------------------------------------------------
-      call SNESSetTolerances(snes,PETSC_DEFAULT_DOUBLE_PRECISION,
-     &                            PETSC_DEFAULT_DOUBLE_PRECISION,
-     &                            PETSC_DEFAULT_DOUBLE_PRECISION,
+      call SNESSetTolerances(snes,PETSC_DEFAULT_REAL_PRECISION,                &
+     &                            PETSC_DEFAULT_REAL_PRECISION,                &
+     &                            PETSC_DEFAULT_REAL_PRECISION,                &
      &                          3,PETSC_DEFAULT_INTEGER,ierr)
       call SNESSolve(snes,PETSC_NULL_OBJECT,x,ierr)
 
 #endif
 
 ! Solve nonlinear system
-       call SNESSetTolerances(snes,PETSC_DEFAULT_DOUBLE_PRECISION,
-     &                            PETSC_DEFAULT_DOUBLE_PRECISION,
-     &                            PETSC_DEFAULT_DOUBLE_PRECISION,
+       call SNESSetTolerances(snes,PETSC_DEFAULT_REAL_PRECISION,               &
+     &                            PETSC_DEFAULT_REAL_PRECISION,                &
+     &                            PETSC_DEFAULT_REAL_PRECISION,                &
      &      1000,PETSC_DEFAULT_INTEGER,ierr)
 
 ! Call SNESSolve() for next few iterations

src/snes/examples/tests/ex1f.F

       call PetscDrawSetFromOptions(draw,ierr)
 
       call VecGetArray(x,lx_v,lx_i,ierr)
-      call PetscDrawTensorContour(draw,mx,my,PETSC_NULL_DOUBLE,              &
-     &     PETSC_NULL_DOUBLE,lx_v(lx_i+1),ierr)
+      call PetscDrawTensorContour(draw,mx,my,PETSC_NULL_REAL,              &
+     &     PETSC_NULL_REAL,lx_v(lx_i+1),ierr)
       call VecRestoreArray(x,lx_v,lx_i,ierr)
 
 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

src/snes/examples/tutorials/ex1f.F

       PetscInt its,i2,i20
       PetscMPIInt size,rank
       PetscScalar   pfive
-      double precision   tol
+      PetscReal   tol
       PetscBool   setls
 
 !  Note: Any user-defined Fortran routines (such as FormJacobian)
       call KSPGetPC(ksp,pc,ierr)
       call PCSetType(pc,PCNONE,ierr)
       tol = 1.e-4
-      call KSPSetTolerances(ksp,tol,PETSC_DEFAULT_DOUBLE_PRECISION,     &
-     &                      PETSC_DEFAULT_DOUBLE_PRECISION,i20,ierr)
+      call KSPSetTolerances(ksp,tol,PETSC_DEFAULT_REAL_PRECISION,        &
+     &                      PETSC_DEFAULT_REAL_PRECISION,i20,ierr)
 
 !  Set SNES/KSP/KSP/PC runtime options, e.g.,
 !      -snes_view -snes_monitor -ksp_type <ksp> -pc_type <pc>

src/snes/examples/tutorials/ex5f90.F

         PetscInt ys,ye,ym,gys,gye,gym
         PetscInt mx,my
         PetscMPIInt rank
-        double precision lambda
+        PetscReal lambda
       end type userctx
 
       contains
       PetscInt         its
       PetscBool        flg,matrix_free
       PetscInt         ione,nfour
-      double precision lambda_max,lambda_min
+      PetscReal lambda_max,lambda_min
       type (userctx)   user
       DM               da
 

src/snes/examples/tutorials/ex5f90t.F

         PetscInt ys,ye,ym,gys,gye,gym
         PetscInt mx,my
         PetscMPIInt rank
-        double precision lambda
+        PetscReal lambda
       end type userctx
 
       contains
       PetscInt         its
       PetscBool        flg,matrix_free
       PetscInt         ione,nfour
-      double precision lambda_max,lambda_min
+      PetscReal lambda_max,lambda_min
       type(userctx)    user
       type(userctx), pointer:: puser
 

src/snes/examples/tutorials/ex73f90t.F90

 !     temp A block stuff 
         PetscInt mx,my
         PetscMPIInt rank
-        double precision lambda
+        PetscReal lambda
 !     Mats
         type(Mat) Amat,AmatLin,Bmat,CMat,Dmat
         type(IS)  isPhi,isLambda
       PetscInt         its,N1,N2,i,j,row,low,high,lamlow,lamhigh
       PetscBool        flg
       PetscInt         ione,nfour,itwo,nloc,nloclam
-      double precision lambda_max,lambda_min
+      PetscReal lambda_max,lambda_min
       type(petsc_kkt_solver)  solver
       PetscScalar      bval,cval,one
 

src/snes/interface/snes.c

   snes->norm              = 0.0;
   snes->normschedule      = SNES_NORM_ALWAYS;
   snes->functype          = SNES_FUNCTION_DEFAULT;
+#if defined(PETSC_USE_REAL_SINGLE)
+  snes->rtol              = 1.e-5;
+#else
   snes->rtol              = 1.e-8;
+#endif
   snes->ttol              = 0.0;
+#if defined(PETSC_USE_REAL_SINGLE)
+  snes->abstol            = 1.e-25;
+#else
   snes->abstol            = 1.e-50;
+#endif
   snes->stol              = 1.e-8;
+#if defined(PETSC_USE_REAL_SINGLE)
+  snes->deltatol          = 1.e-6;
+#else
   snes->deltatol          = 1.e-12;
+#endif
   snes->nfuncs            = 0;
   snes->numFailures       = 0;
   snes->maxFailures       = 1;

src/sys/classes/draw/interface/ftn-custom/zdtrif.c

 
 PETSC_EXTERN void PETSC_STDCALL petscdrawtensorcontour_(PetscDraw *win,int *m,int *n,PetscReal *x,PetscReal *y,PetscReal *V,PetscErrorCode *ierr)
 {
-  CHKFORTRANNULLDOUBLE(x);
-  CHKFORTRANNULLDOUBLE(y);
+  CHKFORTRANNULLREAL(x);
+  CHKFORTRANNULLREAL(y);
   *ierr = PetscDrawTensorContour(*win,*m,*n,x,y,V);
 }
 

src/ts/examples/tutorials/ex1f.F

 !  FormFunction(). We use a double precision array with three
 !  entries indexed by param, lmx, lmy.
 !
-      double precision user(3)
+      PetscReal user(3)
       PetscInt          param,lmx,lmy,i5
       parameter (param = 1,lmx = 2,lmy = 3)
 !
       PetscInt           its,N,i1000
       PetscBool  flg
       PetscErrorCode      ierr
-      double precision  param_max,param_min,dt,tmax,zero
-      double precision  ftime
+      PetscReal  param_max,param_min,dt
+      PetscReal  tmax,zero
+      PetscReal  ftime
       TSConvergedReason reason
 
       i5 = 5
 #include <finclude/petscpc.h>
 #include <finclude/petscts.h>
       Vec              X
-      double precision user(3)
+      PetscReal user(3)
       PetscInt  i,j,row,mx,my
       PetscErrorCode ierr
       PetscOffset      xidx
-      double precision one,lambda
-      double precision temp1,temp,hx,hy
+      PetscReal one,lambda
+      PetscReal temp1,temp,hx,hy
       PetscScalar      xx(1)
       PetscInt          param,lmx,lmy
       parameter (param = 1,lmx = 2,lmy = 3)
       call VecGetArray(X,xx,xidx,ierr)
       temp1 = lambda/(lambda + one)
       do 10, j=1,my
-        temp = dble(min(j-1,my-j))*hy
+        temp = min(j-1,my-j)*hy
         do 20 i=1,mx
           row = i + (j-1)*mx
           if (i .eq. 1 .or. j .eq. 1 .or.                               &
             xx(row+xidx) = 0.0
           else
             xx(row+xidx) =                                              &
-     &        temp1*sqrt(min(dble(min(i-1,mx-i))*hx,temp))
+     &        temp1*sqrt(min(min(i-1,mx-i)*hx,temp))
           endif
  20     continue
  10   continue
 #include <finclude/petscpc.h>
 #include <finclude/petscts.h>
       TS       ts
-      double precision  t
+      PetscReal  t
       Vec               X,F
-      double precision  user(3)
+      PetscReal  user(3)
       PetscErrorCode     ierr
       PetscInt         i,j,row,mx,my
       PetscOffset       xidx,fidx
-      double precision  two,lambda
-      double precision  hx,hy,hxdhy,hydhx
+      PetscReal  two,lambda
+      PetscReal  hx,hy,hxdhy,hydhx
       PetscScalar  ut,ub,ul,ur,u
       PetscScalar  uxx,uyy,sc
       PetscScalar  xx(1),ff(1)
       my     = int(user(lmy))
       lambda = user(param)
 
-      hx    = 1.0 / dble(mx-1)
-      hy    = 1.0 / dble(my-1)
+      hx    = 1.0 / (mx-1)
+      hy    = 1.0 / (my-1)
       sc    = hx*hy
       hxdhy = hx/hy
       hydhx = hy/hx
       Vec              X
       Mat              JJ,B
       MatStructure     flag
-      double precision user(3),ctime
+      PetscReal user(3),ctime
       PetscErrorCode   ierr
       Mat              jac
       PetscOffset xidx
       PetscInt    col(5),i1,i5
       PetscScalar two,one,lambda
       PetscScalar v(5),sc,xx(1)
-      double precision hx,hy,hxdhy,hydhx
+      PetscReal hx,hy,hxdhy,hydhx
 
       PetscInt  param,lmx,lmy
       parameter (param = 1,lmx = 2,lmy = 3)
       my     = int(user(lmy))
       lambda = user(param)
 
-      hx    = 1.0 / dble(mx-1)
-      hy    = 1.0 / dble(my-1)
+      hx    = 1.0 / (mx-1)
+      hy    = 1.0 / (my-1)
       sc    = hx*hy
       hxdhy = hx/hy
       hydhx = hy/hx

src/vec/vec/examples/tutorials/ex1f90.F

 !
       Vec              x,y,w
       Vec, pointer :: z(:)
-      double precision norm,v,v1,v2
+      PetscReal norm,v,v1,v2
       PetscInt         n,ithree
       PetscErrorCode   ierr
       PetscMPIInt      rank