source: colin/trunk/test/test2.cpp @ 1475

Revision 1475, 2.1 KB checked in by wehart, 8 years ago (diff)

Many changes to enable the Solaris CC build.

NOTE: the SOLARIS macro is now deprecated. However, I have created the
SOLARIS_CC macro for a variety of contexts where (a) I think we might
need to add an autoconf test variable or (b) there is an OS-compiler
dependency that needs to be captured (e.g. the structure of the
STL Allocator object).

( Links to Acro-related mail archives at  http://software.sandia.gov/Acro/ )

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1//
2// OptProblem test
3//
4
5#include <acro_config.h>
6#include <vector>
7#include <algorithm>
8#include <utilib/stl_auxillary.h>
9#include <colin/colin.h>
10
11using namespace std;
12using namespace colin;
13
14class A {
15public:
16  vector<double> vec;
17};
18
19ostream& operator<<(ostream& os, const A& a)
20{ os << a.vec; return os; }
21
22istream& operator>>(istream& is, A& a)
23{ is >> a.vec; return is; }
24
25namespace colin {
26
27template<>
28void map_domain(A& a, const A& b)
29{ a.vec &= b.vec; }
30
31}
32
33void func1(const A& x, AppResponse<>& response) {}
34void func2(A& x, AppResponse<>& response) {}
35
36void func9(const A& x, AppResponse<>& response) {}
37void func10(A& x, AppResponse<>& response) {}
38
39void func3(const vector<double>& x, AppResponse<>& response) {}
40void func4(vector<double>& x, AppResponse<>& response) {}
41
42void func7(const vector<double>& x, const vector<int>& asv,
43                AppResponse<>& response) {}
44void func8(vector<double>& x, vector<int>& asv,
45                AppResponse<>& response) {}
46
47void func13(A&, UserResponse<vector<real > >& response) {}
48void func14(const A&, UserResponse<vector<real > >& response) {}
49
50void fooA()
51{
52OptProblem<A> opt;
53OptSetup(opt,&func1);
54OptSetup(opt,&func2);
55OptSetup(opt,&func9);
56OptSetup(opt,&func10);
57#ifdef ACRO_HAVE_TEMPLATES_AS_TEMPLATE_ARGUMENTS
58OptSetup(opt,&func13);
59OptSetup(opt,&func14);
60#endif
61
62A a;
63real value;
64opt.EvalF(a,value);
65}
66
67
68double func5(const double*, int n) {return -1.0;}
69double func6(double*, int n) {return -1.0;}
70
71
72double func11(const vector<double>& x) {return -1.0;}
73double func12(vector<double>& x) {return -1.0;}
74
75void func15(vector<double>&, UserResponse<vector<real > >& response) {}
76void func16(const vector<double>&, UserResponse<vector<real > >& response) {}
77
78void fooVec()
79{
80OptProblem<vector<double> > opt;
81OptSetup(opt,&func3);
82OptSetup(opt,&func4);
83OptSetup(opt,&func5);
84OptSetup(opt,&func6);
85OptSetup(opt,&func7);
86OptSetup(opt,&func8);
87OptSetup(opt,&func11);
88OptSetup(opt,&func12);
89#ifdef ACRO_HAVE_TEMPLATES_AS_TEMPLATE_ARGUMENTS
90OptSetup(opt,&func15);
91OptSetup(opt,&func16);
92#endif
93string str;
94OptSetup(opt,str,str,str);
95
96vector<double> a;
97real value;
98opt.EvalF(a,value);
99}
100
101int main()
102{return 0;}
Note: See TracBrowser for help on using the repository browser.