LILAC
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
example_integrator.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2014, Sam Schetterer, Nathan Kutz, University of Washington
3 Authors: Sam Schetterer
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 
8 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9 
10 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11 
12 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15 
16 */
17 #include "example_integrator.h"
18 #include "types/type_register.hpp"
20 #include "item_heads.hpp"
22 #include "comp_funcs.hpp"
23 //Note that this function serves as a proxy for the actual version, the template class
24 int example_integrator::integrate(ptr_passer u, double t0, double tf){
25  return actual_int->integrate(u, t0, tf);
26 }
27 
29  //note that it does not return the template type,
30  //just example_integrator so it can be instantiated
31  return "example_integrator";
32 }
33 
34 std::vector<std::string> example_integrator::dependencies() const{
35  //rules for dependencies:
36  //A name preceded with a ! is optional
37  //A name preceded with a # isn't optional, but it doesn't need to be initialized
38  //for postprocess to work
39  std::string deps[] = {"rval1", "!rval2", "#test_class", "unsigned_var", "something"};
40  //always call the dependencies of the parent class
41  return make_append(deps, integrator::dependencies());
42 }
43 
45  //always do the base class processing first
47  //create the actual integrator with the type_constructor class
48  //see type_constructor.hpp for details on this
50  //rh_val is the rhs pointer that is retrieved by the base class
51  //construct the actual_int class
52  actual_int->holder = holder;
53  actual_int->postprocess(dat);
54 }
55 
56 //simply return actual_int
57 const std::type_info& example_integrator::vtype() const{
58  return actual_int->vtype();
59 }
60