Teko
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Teko_RequestHandler_impl.hpp
1
// @HEADER
2
// *****************************************************************************
3
// Teko: A package for block and physics based preconditioning
4
//
5
// Copyright 2010 NTESS and the Teko contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef __Teko_RequestHandler_impl_hpp__
11
#define __Teko_RequestHandler_impl_hpp__
12
13
template
<
typename
DataT>
14
DataT RequestHandler::request(
const
RequestMesg& rd)
const
{
15
using
Teuchos::RCP;
16
using
Teuchos::rcp_dynamic_cast;
17
18
// type of call back to use
19
typedef
RequestCallback<DataT> CallbackT;
20
21
// distribute message over all callbacks
22
std::vector<RCP<RequestCallbackBase> >::iterator itr;
23
for
(itr = callbacks_.begin(); itr != callbacks_.end(); ++itr) {
24
RCP<CallbackT> cb = rcp_dynamic_cast<CallbackT>(*itr);
25
26
// call back not right type
27
if
(cb == Teuchos::null)
continue
;
28
29
// does call back handle this request?
30
if
(cb->handlesRequest(rd))
return
cb->request(rd);
31
}
32
33
TEUCHOS_TEST_FOR_EXCEPTION(
true
, std::runtime_error,
34
"RequestHandler::request could not find appropriate callback: "
<< rd);
35
}
36
37
template
<
typename
DataT>
38
void
RequestHandler::preRequest(
const
RequestMesg& rd)
const
{
39
using
Teuchos::RCP;
40
using
Teuchos::rcp_dynamic_cast;
41
42
// type of call back to use
43
typedef
RequestCallback<DataT> CallbackT;
44
45
// distribute message over all callbacks
46
std::vector<RCP<RequestCallbackBase> >::iterator itr;
47
for
(itr = callbacks_.begin(); itr != callbacks_.end(); ++itr) {
48
RCP<CallbackT> cb = rcp_dynamic_cast<CallbackT>(*itr);
49
50
// call back not right type
51
if
(cb == Teuchos::null)
continue
;
52
53
// does call back handle this request?
54
if
(cb->handlesRequest(rd))
return
cb->preRequest(rd);
55
}
56
57
TEUCHOS_TEST_FOR_EXCEPTION(
58
true
, std::runtime_error,
59
"RequestHandler::preRequest could not find appropriate callback: "
<< rd);
60
}
61
62
#endif
Generated by
1.17.0