[petsc-dev] tao and complex numbers

Lisandro Dalcin dalcinl at gmail.com
Sun Feb 8 13:09:18 CST 2015


>
>    Maybe tao.h can signal an error on complex only when used for anything BUT the tao/interface. Then you can build your part but users trying to use it will get a very helpful error message.
>

IOW, are you proposing to add a preprocessor define to control the
erroring of #include <tao.h> ? That should definitely work. We can
silent the error to build tao/interface and petsc4py by #defining
something, but in user code you get an #error, something like

// file: include/petsctao.h
#ifndef __TAO_H
#define __TAO_H

#if defined(PETSC_USE_COMPLEX)
#if !defined(PETSC_TAO_INTERFACE) /*or whatever name you like */
# error "TAO not supported for complex scalars"
#endif
#endif

.... rest of tao.h

#endif


This way, we build tao/interface and petsc4py sources with

#include "petsc.h"
#define PETSC_TAO_INTERFACE
#include "tao.h"

PS: Of course, you need to fix petsc.h to not include petsctao.h for
complex builds.

I'm fine with an approach like this one, so go ahead.


-- 
Lisandro Dalcin
============
Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Numerical Porous Media Center (NumPor)
King Abdullah University of Science and Technology (KAUST)
http://numpor.kaust.edu.sa/

4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 4332
Thuwal 23955-6900, Kingdom of Saudi Arabia
http://www.kaust.edu.sa

Office Phone: +966 12 808-0459



More information about the petsc-dev mailing list