GRINS-0.8.0
Functions
composite_function.C File Reference
#include "libmesh/composite_function.h"
#include "libmesh/const_function.h"
#include "libmesh/dense_vector.h"
Include dependency graph for composite_function.C:

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( )

Definition at line 35 of file composite_function.C.

36 {
37  std::vector<std::vector<unsigned int> > index_sets(4);
38  index_sets[0].resize(2);
39  index_sets[0][0] = 3;
40  index_sets[0][1] = 4;
41  index_sets[1].resize(3);
42  index_sets[1][0] = 0;
43  index_sets[1][1] = 1;
44  index_sets[1][2] = 2;
45  index_sets[2].resize(3);
46  index_sets[2][0] = 0;
47  index_sets[2][1] = 2;
48  index_sets[2][2] = 4;
49  index_sets[3].resize(5);
50  index_sets[3][0] = 5;
51  index_sets[3][1] = 1;
52  index_sets[3][2] = 3;
53  index_sets[3][3] = 6;
54  index_sets[3][4] = 7;
55 
56  CompositeFunction<libMesh::Real> composite_outer;
57 
58  {
59  CompositeFunction<libMesh::Real> composite_inner;
60  composite_inner.attach_subfunction
61  (ConstFunction<libMesh::Real>(1), index_sets[0]);
62  composite_inner.attach_subfunction
63  (ConstFunction<libMesh::Real>(2), index_sets[1]);
64  composite_outer.attach_subfunction
65  (composite_inner, index_sets[3]);
66 
67  libMesh::DenseVector<libMesh::Real> test_one(5);
68 
69  composite_inner(libMesh::Point(0), 0, test_one);
70 
71  if (test_one(0) != 2)
72  return 1;
73  if (test_one(1) != 2)
74  return 1;
75  if (test_one(2) != 2)
76  return 1;
77  if (test_one(3) != 1)
78  return 1;
79  if (test_one(4) != 1)
80  return 1;
81  }
82  composite_outer.attach_subfunction
83  (ConstFunction<libMesh::Real>(3), index_sets[2]);
84 
85  libMesh::DenseVector<libMesh::Real> test_two(8);
86  composite_outer(libMesh::Point(0), 0, test_two);
87 
88  if (test_two(0) != 3)
89  return 1;
90  if (test_two(2) != 3)
91  return 1;
92  if (test_two(4) != 3)
93  return 1;
94  if (test_two(5) != 2)
95  return 1;
96  if (test_two(1) != 2)
97  return 1;
98  if (test_two(3) != 2)
99  return 1;
100  if (test_two(6) != 1)
101  return 1;
102  if (test_two(7) != 1)
103  return 1;
104 
105  return 0;
106 }

Generated on Tue Dec 19 2017 12:47:29 for GRINS-0.8.0 by  doxygen 1.8.9.1