Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F76777014
runner.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Aug 10, 08:24
Size
4 KB
Mime Type
text/x-c++
Expires
Mon, Aug 12, 08:24 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
19763574
Attached To
rSPECMICP SpecMiCP / ReactMiCP
runner.hpp
View Options
/* =============================================================================
Copyright (c) 2014 - 2016
F. Georget <fabieng@princeton.edu> Princeton University
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
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.
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.
* 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. *
============================================================================= */
#ifndef SPECMICP_REACTMICP_SOLVER_RUNNER_HPP
#define SPECMICP_REACTMICP_SOLVER_RUNNER_HPP
#include "reactive_transport_solver.hpp"
#include "timestepper.hpp"
#include <string>
#include <functional>
namespace
specmicp
{
namespace
reactmicp
{
namespace
solver
{
//! \struct SimulationInformation
//! \brief Information about the simulation
struct
SPECMICP_DLL_PUBLIC
SimulationInformation
{
std
::
string
name
;
//!< Name of the simulation
std
::
string
output_prefix
;
//!< prefix for the output files
bool
print_iter_info
{
true
};
//!< If true, print the iteration informations
scalar_t
output_step
;
//!< output step
SimulationInformation
(
std
::
string
name_simul
,
scalar_t
outputstep
)
:
name
(
name_simul
),
output_prefix
(
name_simul
+
"_"
),
output_step
(
outputstep
)
{}
std
::
string
complete_filepath
(
const
std
::
string
&
name
,
const
std
::
string
&
suffix
)
const
{
return
output_prefix
+
name
+
"."
+
suffix
;
}
std
::
string
complete_filepath
(
std
::
string
&&
name
,
std
::
string
&&
suffix
)
const
{
return
output_prefix
+
name
+
"."
+
suffix
;
}
};
using
output_f
=
std
::
function
<
void
(
scalar_t
time
,
VariablesBasePtr
variables
)
>
;
inline
void
dummy_output
(
scalar_t
_
,
VariablesBasePtr
__
)
{}
class
SPECMICP_DLL_PUBLIC
ReactiveTransportRunner
{
public
:
ReactiveTransportRunner
(
ReactiveTransportSolver
&
solver
,
scalar_t
lower_dt_bound
,
scalar_t
upper_dt_bound
,
const
SimulationInformation
&
info
)
:
m_solver
(
solver
),
m_timestepper
(
lower_dt_bound
,
upper_dt_bound
,
0
,
2.0
),
m_simulinfo
(
info
)
{
}
void
run_until
(
scalar_t
target
,
VariablesBasePtr
variables
);
void
set_output_policy
(
output_f
output_policy
)
{
m_output_function
=
output_policy
;
}
ReactiveTransportOptions
&
get_options
()
{
return
m_solver
.
get_options
();
}
TimestepperOptions
&
get_timestepper_options
()
{
return
m_timestepper
.
get_options
();
}
ReactiveTransportPerformance
&
get_perfs
()
{
return
m_solver
.
get_perfs
();
}
ReactiveTransportTimer
&
get_timer
()
{
return
m_solver
.
get_timer
();
}
private
:
index_t
m_cnt
{
0
};
ReactiveTransportSolver
&
m_solver
;
Timestepper
m_timestepper
;
const
SimulationInformation
&
m_simulinfo
;
output_f
m_output_function
{
dummy_output
};
scalar_t
m_output_target
;
};
}
// end namespace solver
}
// end namespace reactmicp
}
// end namespace specmicp
#endif
// SPECMICP_REACTMICP_SOLVER_RUNNER_HPP
Event Timeline
Log In to Comment