Wolfgang et al;

Some good work going on petsc complex, which is really nice to see   :-)

My current compile error with r19485 with:

PETSC: ./config/configure.py --with-mpi=1 --with-shared=1
--with-clanguage=C++ --with-scalar-type=complex --with-mpi-dir=/usr
--with-x=0

DEALII: ./configure '--prefix=/home/tyoung/research.code/deal.II
CC=mpicc' 'CXX=mpicxx
--with-petsc=/home/tyoung/research.code/petsc-3.0.0-p3
--with-petsc-arch=linux-gnu-c-debug
--with-slepc=/home/tyoung/research.code/slepc-3.0.0-p2
--with-metis=/home/tyoung/research.code/metis-4.0 --disable-threads
--cache-file=/dev/null 

gives:

=====lac==============debug========== constraint_matrix.cc
/home/tyoung/research.code/petsc-3.0.0-p3/include/petsc.hh:22: error:
extra
';' /home/tyoung/research.code/petsc-3.0.0-p3/include/petsc.hh:28:
error: extra
';' /home/tyoung/research.code/petsc-3.0.0-p3/include/petsc.hh:44:
error: extra
';' 
/home/tyoung/research.code/deal.II/lac/include/lac/constraint_matrix.templates.h:
In member function 'void
dealii::ConstraintMatrix::distribute_local_to_global(const
dealii::Vector<double>&, const std::vector<unsigned int,
std::allocator<unsigned int> >&, VectorType&, const
dealii::FullMatrix<double>&) const [with VectorType =
dealii::PETScWrappers::Vector]': source/constraint_matrix.cc:2150:
instantiated from
here 
/home/tyoung/research.code/deal.II/lac/include/lac/constraint_matrix.templates.h:749:
error: no matching function for call to
'dealii::PETScWrappers::Vector::add(const std::vector<unsigned int,
std::allocator<unsigned int> >&, const
dealii::Vector<double>&)' 
/home/tyoung/research.code/deal.II/lac/include/lac/petsc_vector_base.h:385:
note: candidates are: void dealii::PETScWrappers::VectorBase::add(const
std::vector<unsigned int, std::allocator<unsigned int> >&, const
std::vector<std::complex<double>, std::allocator<std::complex<double> >

Which I hope is up-to-date and correct!! I am concerned about the first
three lines concerning petsc.hh

> - the DoF iterators have functions get_dof_values that can take all
> kinds of vectors as inputs and are instantiated for real and double
> output vectors, allowing for example to extract values from a double
> vector into a float vector. But this fails if we try, for example, to
> extract double values from a complex PETSc vector.
> 
> In some of these cases it's not quite clear what to do, or it will be
> a lot of work. Any suggestions?

Attached is a debug patch which autodetects complex configuration
of petsc for 2.3.* and 3.*.*. (Debug in the sense that nothing really
happens except autodetection). I have no clean ideas how to make this
work correctly for 2.2.1, and in this case (unfortunately) dealii
reports "not found". It would be quite straightforward (and probably
adventageous) to support 3.*.*+ for complex petsc only, like the
SlepcWrappers do.

My previous idea was to use this patch to define the macro
"DEAL_II_USE_PETSC_COMPLEX" (#if DEAL_II_USE_PETSC=true) which can
be used to surround "real only" instantiations for a start, by 
#ifndef DEALII_USE_PETSC_COMPLEX 
   [code] 
#endif. 

I haven't figured out if this will help out here though. I can protect
deal.ii from compiling for petsc complex for != 3.0.0+ for a start...

What can I do to help out? What are the ideas for the way forward?

Best,
        Toby


-- 

Toby D. Young
Philosphy-Physics
Assitant Professor (Adiunkt)
Polish Academy of Sciences
Warszawa, Polska

www:   http://www.ippt.gov.pl/~tyoung
skype: stenografia
Index: aclocal.m4
===================================================================
--- aclocal.m4	(revision 19484)
+++ aclocal.m4	(working copy)
@@ -5701,6 +5701,7 @@
     DEAL_II_CONFIGURE_PETSC_VERSION
     DEAL_II_CONFIGURE_PETSC_ARCH
     DEAL_II_CONFIGURE_PETSC_MPIUNI_LIB
+    DEAL_II_CONFIGURE_PETSC_SCALAR_COMPLEX
 
     DEAL_II_EXPAND_PETSC_VECTOR="PETScWrappers::Vector"
     DEAL_II_EXPAND_PETSC_BLOCKVECTOR="PETScWrappers::BlockVector"
@@ -5852,6 +5853,44 @@
 
 
 dnl ------------------------------------------------------------
+dnl Figure out PETSc was compiled with scalar-type = complex.
+dnl To do this we need to scan the PETSc configuration file.
+dnl
+dnl Usage: DEAL_II_CONFIGURE_PETSC_SCALAR_COMPLEX
+dnl
+dnl ------------------------------------------------------------
+AC_DEFUN(DEAL_II_CONFIGURE_PETSC_SCALAR_COMPLEX, dnl
+[
+  AC_MSG_CHECKING(for PETSc scalar complex)
+
+  case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in
+    2.2*)
+      DEAL_II_PETSC_SCALAR_COMPLEX=`cat $DEAL_II_PETSC_DIR/bmake/$DEAL_II_PETSC_ARCH/petscconf.h \
+                               | grep "#define PETSC_USE_COMPLEX" \
+                               | perl -pi -e 's/.*COMPLEX\s+//g;'`
+      PETSC_SCALAR_COMPLEX="$DEAL_II_PETSC_SCALAR_COMPLEX"
+    ;;
+    3.*)
+      DEAL_II_PETSC_SCALAR_COMPLEX=`cat $DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/include/petscconf.h \
+                               | grep "#define PETSC_USE_COMPLEX" \
+                               | perl -pi -e 's/.*COMPLEX\s+//g;'`      
+      PETSC_SCALAR_COMPLEX="$DEAL_II_PETSC_SCALAR_COMPLEX"
+    ;;
+    *)
+      AC_MSG_ERROR([Unknown PETSc version])
+    ;;
+  esac
+
+  if test "$DEAL_II_PETSC_SCALAR_COMPLEX" = "" ; then
+     AC_MSG_RESULT(not found)
+  else
+     AC_MSG_RESULT(yes)
+  fi
+])
+
+
+
+dnl ------------------------------------------------------------
 dnl Check whether SLEPc is installed, and if so store the
 dnl respective links.
 dnl
Index: configure.in
===================================================================
--- configure.in	(revision 19484)
+++ configure.in	(working copy)
@@ -406,6 +406,7 @@
 AC_SUBST(DEAL_II_PETSC_VERSION_MINOR)
 AC_SUBST(DEAL_II_PETSC_VERSION_SUBMINOR)
 AC_SUBST(DEAL_II_PETSC_MPIUNI_LIB)
+AC_SUBST(DEAL_II_PETSC_SCALAR_COMPLEX)
 AC_SUBST(DEAL_II_DEFINE_DEAL_II_USE_PETSC)
 
 DEAL_II_CONFIGURE_SLEPC
Index: common/Make.global_options.in
===================================================================
--- common/Make.global_options.in	(revision 19484)
+++ common/Make.global_options.in	(working copy)
@@ -52,6 +52,7 @@
 DEAL_II_PETSC_VERSION_MINOR    = @DEAL_II_PETSC_VERSION_MINOR@
 DEAL_II_PETSC_VERSION_SUBMINOR = @DEAL_II_PETSC_VERSION_SUBMINOR@
 DEAL_II_PETSC_MPIUNI_LIB = @DEAL_II_PETSC_MPIUNI_LIB@
+DEAL_II_PETSC_SCALAR_COMPLEX   = @DEAL_II_PETSC_PETSC_SCALAR_COMPLEX@
 
 USE_CONTRIB_SLEPC    = @USE_CONTRIB_SLEPC@
 DEAL_II_SLEPC_DIR    = @DEAL_II_SLEPC_DIR@
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to