source: issm/trunk-jpl/src/c/shared/Numerics/recast.h@ 12583

Last change on this file since 12583 was 12546, checked in by utke, 13 years ago

add casting mechanism that makes the switch from double to adouble for IssmDouble transparent

File size: 676 bytes
Line 
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
11#ifndef _HAVE_ADOLC_
12
13template<class To, class From>
14To reCast(const From& from) {
15 return (To)from;
16}
17
18#else
19
20template<class To, class From>
21struct ForPartialSpecialization {
22 static To reCast(const From& from ) { return (To) from;}
23};
24
25template<class To, class From>
26To reCast(const From& from) {
27 return ForPartialSpecialization<To,From>::reCast(from);
28}
29/**
30 * partial specialization
31 */
32template<class To>
33struct ForPartialSpecialization<To,adouble> {
34 static To reCast(const adouble& from ) { return (To) (from.getValue());}
35};
36
37#endif
38
39#endif
Note: See TracBrowser for help on using the repository browser.