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

Last change on this file since 14981 was 14975, checked in by Eric.Larour, 12 years ago

CHG: cleanup the shared/Numerics directory. Took out the IsInputConverged, ToolkitsOptionsFromAnalysis and OptionsFromAnalysis
and put them into the Container/ Inputs and Parameters files. This uncovered a bunch of cyclical dependencies that needed fixing.

File size: 856 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#ifdef HAVE_CONFIG_H
12 #include <config.h>
13#else
14#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
15#endif
16
17#if !defined(_HAVE_ADOLC_) || defined(_WRAPPERS_)
18
19template<class To, class From> To reCast(const From& from) {
20 return (To)from;
21}
22
23#else
24#include "./types.h"
25
26template<class To, class From> struct ForPartialSpecialization {
27 static To reCast(const From& from ) { return (To) from;}
28};
29
30template<class To, class From> To reCast(const From& from) {
31 return ForPartialSpecialization<To,From>::reCast(from);
32}
33/**
34 * partial specialization
35 */
36template<class To> struct ForPartialSpecialization<To,adouble> {
37 static To reCast(const adouble& from ) { return (To) (from.getValue());}
38};
39
40#endif
41
42#endif
Note: See TracBrowser for help on using the repository browser.