|
Last change
on this file since 13767 was 13767, checked in by Eric.Larour, 13 years ago |
|
CHG: made necessary changes to repair the broken adolc compile. Had to introduce _WRAPPER_ symbol
for the matlab and python wrapper compile, as they were calling on AD specific capabilities!
|
|
File size:
835 bytes
|
| Rev | Line | |
|---|
| [12546] | 1 | /*
|
|---|
| 2 | * recast.h
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Jun 26, 2012
|
|---|
| 5 | * Author: utke
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #ifndef _RECAST_H_
|
|---|
| 9 | #define _RECAST_H_
|
|---|
| 10 |
|
|---|
| [13767] | 11 | #ifdef HAVE_CONFIG_H
|
|---|
| 12 | #include <config.h>
|
|---|
| 13 | #else
|
|---|
| 14 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
|---|
| 15 | #endif
|
|---|
| [12546] | 16 |
|
|---|
| [13767] | 17 | #if !defined(_HAVE_ADOLC_) || defined(_WRAPPERS_)
|
|---|
| 18 |
|
|---|
| [12546] | 19 | template<class To, class From>
|
|---|
| 20 | To reCast(const From& from) {
|
|---|
| 21 | return (To)from;
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | #else
|
|---|
| 25 |
|
|---|
| 26 | template<class To, class From>
|
|---|
| 27 | struct ForPartialSpecialization {
|
|---|
| 28 | static To reCast(const From& from ) { return (To) from;}
|
|---|
| 29 | };
|
|---|
| 30 |
|
|---|
| 31 | template<class To, class From>
|
|---|
| 32 | To reCast(const From& from) {
|
|---|
| 33 | return ForPartialSpecialization<To,From>::reCast(from);
|
|---|
| 34 | }
|
|---|
| 35 | /**
|
|---|
| 36 | * partial specialization
|
|---|
| 37 | */
|
|---|
| 38 | template<class To>
|
|---|
| 39 | struct ForPartialSpecialization<To,adouble> {
|
|---|
| 40 | static To reCast(const adouble& from ) { return (To) (from.getValue());}
|
|---|
| 41 | };
|
|---|
| 42 |
|
|---|
| 43 | #endif
|
|---|
| 44 |
|
|---|
| 45 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.