[petsc-dev] more issues

Lisandro Dalcin dalcinl at gmail.com
Thu Jun 2 08:14:20 CDT 2011


Barry, I'm trying to build like below:

$ ./configure PETSC_ARCH=arch-test --with-shared-libraries=1
--with-64-bit-indices=1 --with-clanguage=C++ --with-precision=single
--with-scalar-type=complex

and of course it fails. I'm working on a patch, fixed a few things,
but I got to this:

[ 39%] Building CXX object CMakeFiles/petsc.dir/src/vec/vec/impls/seq/dvec2.c.o
/home/devel/petsc/dev/src/vec/vec/impls/seq/bvec1.c: In function
‘PetscErrorCode VecScale_Seq(_p_Vec*, PetscScalar)’:
/home/devel/petsc/dev/src/vec/vec/impls/seq/bvec1.c:89: error: no
match for ‘operator==’ in ‘alpha == 0.0’
/home/devel/petsc/dev/src/vec/vec/impls/seq/bvec1.c:91: error: no
match for ‘operator!=’ in ‘alpha != 1.0e+0’

How do you want this fixed? Should I use casts like (PetscScalar)0.0
and (PetscScalar)1.0 ??

BTW, is the fix below fine for you?:

diff -r 364ba0cc565f src/sys/random/impls/rand48/rand48.c
--- a/src/sys/random/impls/rand48/rand48.c	Wed Jun 01 15:49:23 2011 -0300
+++ b/src/sys/random/impls/rand48/rand48.c	Thu Jun 02 10:13:48 2011 -0300
@@ -17,14 +17,19 @@
 #define __FUNCT__ "PetscRandomGetValue_Rand48"
 PetscErrorCode  PetscRandomGetValue_Rand48(PetscRandom r,PetscScalar *val)
 {
+#if defined(PETSC_USE_COMPLEX)
+  PetscReal re,im;
+#endif
   PetscFunctionBegin;
-#if defined(PETSC_USE_COMPLEX)
+#if defined(PETSC_USE_COMPLEX)
+  re = drand48();
+  im = drand48();
   if (r->iset) {
-    *val = PetscRealPart(r->width)*drand48() + PetscRealPart(r->low) +
-      (PetscImaginaryPart(r->width)*drand48() +
PetscImaginaryPart(r->low)) * PETSC_i;
+    *val = PetscRealPart(r->width)*re + PetscRealPart(r->low) +
+      (PetscImaginaryPart(r->width)*im + PetscImaginaryPart(r->low)) * PETSC_i;
   } else {
-    *val = drand48() + drand48()*PETSC_i;
-  }
+    *val = re + im * PETSC_i;
+  }
 #else
   if (r->iset) *val = r->width * drand48() + r->low;
   else         *val = drand48();


-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169



More information about the petsc-dev mailing list