Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F82253002
compute.hh
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
Tue, Sep 10, 10:04
Size
6 KB
Mime Type
text/x-c++
Expires
Thu, Sep 12, 10:04 (2 d)
Engine
blob
Format
Raw Data
Handle
20671519
Attached To
rLIBMULTISCALE LibMultiScale
compute.hh
View Options
/**
* @file compute.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
* @author Jaehyun Cho <jaehyun.cho@epfl.ch>
* @author Moseley Philip Arthur <philip.moseley@epfl.ch>
*
* @date Wed Jul 09 21:59:47 2014
*
* @brief This is the mother class of all computes
*
* @section LICENSE
*
* Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* LibMultiScale is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* LibMultiScale is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with LibMultiScale. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __LIBMULTISCALE_COMPUTE_HH__
#define __LIBMULTISCALE_COMPUTE_HH__
/* -------------------------------------------------------------------------- */
#include "container_array.hh"
#include "filter_interface.hh"
#include "compute_interface.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
class
ComputeOutput
:
public
ComponentLMOutContainer
<
ComputeInterface
,
OUTPUT_REAL
>
{
public
:
ComputeOutput
(
UInt
dim
)
:
ComponentLMOutContainer
<
ComputeInterface
,
OUTPUT_REAL
>
(
dim
)
{};
ComputeOutput
(
ComponentLMInterface
&
input
)
:
ComponentLMOutContainer
<
ComputeInterface
,
OUTPUT_REAL
>
(
input
)
{};
ComputeOutput
(
ComponentLMInterface
&
input
,
UInt
dim
)
:
ComponentLMOutContainer
<
ComputeInterface
,
OUTPUT_REAL
>
(
input
,
dim
){};
};
/* -------------------------------------------------------------------------- */
template
<
typename
_Input
>
class
Compute
:
public
ComponentLMTemplate
<
ComponentLMIn
<
_Input
>
,
ComputeOutput
>
,
public
virtual
FilterInterface
{
/* ------------------------------------------------------------------------ */
/* Typedefs */
/* ------------------------------------------------------------------------ */
public
:
typedef
ContainerArray
<
Real
>
ContainerSubset
;
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
protected
:
Compute
(
const
std
::
string
&
name
,
ComponentLMInterface
&
d
);
Compute
(
const
std
::
string
&
name
,
ComponentLMInterface
&
d
,
UInt
dim
);
Compute
(
const
std
::
string
&
name
,
UInt
dim
);
virtual
~
Compute
();
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
//! function to print the contain of the class
virtual
void
printself
(
std
::
ostream
&
stream
,
int
indent
=
0
)
const
{};
//! connect and build the adapted object
virtual
void
connect
(
FilterManager
&
f
);
//! connect and build the adapted object
virtual
void
connect
(
ActionManager
&
f
);
public
:
//! function to call for maunal build
virtual
void
manualBuild
(
_Input
&
obj
);
//! build the compute content
virtual
void
build
();
private
:
//! the real build function that will be called
virtual
void
build
(
_Input
&
cont
)
=
0
;
//! do visit the _Input obj
virtual
void
visit
(
ComponentLMOut
<
_Input
>
&
obj
);
};
/* -------------------------------------------------------------------------- */
#include <boost/preprocessor.hpp>
#define BOOST_INSTANCIATE_COMPUTE_REF_TEMPLATE(r,data,x) \
template class data<BOOST_PP_TUPLE_ELEM(3,0,x)::ContainerPoints>; \
template class data<BOOST_PP_TUPLE_ELEM(3,0,x)::ContainerSubset>;
#define COMPUTE_REF_TEMPLATE_TOIMPLEMENT(data,type) \
template <> void data<type>::build \
(type & cont) \
{ \
LM_TOIMPLEMENT; \
}; \
template <> void data<type>::declareParams() \
{LM_TOIMPLEMENT;};
#define BOOST_INSTANCIATE_COMPUTE_REF_TEMPLATE_TOIMPLEMENT(r,data,x) \
COMPUTE_REF_TEMPLATE_TOIMPLEMENT(data, \
BOOST_PP_TUPLE_ELEM(3,0,x)::ContainerPoints) \
COMPUTE_REF_TEMPLATE_TOIMPLEMENT(data, \
BOOST_PP_TUPLE_ELEM(3,0,x)::ContainerSubset)
#define DECLARE_COMPUTE_REF(obj,list) \
BOOST_PP_SEQ_FOR_EACH(BOOST_INSTANCIATE_COMPUTE_REF_TEMPLATE,obj,list)
#define DECLARE_COMPUTE_REF_TOIMPLEMENT(obj,list) \
BOOST_PP_SEQ_FOR_EACH(BOOST_INSTANCIATE_COMPUTE_REF_TEMPLATE_TOIMPLEMENT,obj,list)
#define DECLARE_COMPUTE_REAL(data) \
template class data<ComputeInterface>;
#define DECLARE_COMPUTE_GENERIC_MESH(data) \
template class data<ContainerGenericMesh>;
#define DECLARE_COMPUTE_GENERIC_MESH_TOIMPLEMENT(data) \
template <> void data<ContainerGenericMesh>::build \
(ContainerGenericMesh & cont) {LM_TOIMPLEMENT;} \
template <> void data<ContainerGenericMesh>::declareParams() \
{LM_TOIMPLEMENT;};
#define DECLARE_COMPUTE_REFPOINT(data) \
template class data<ContainerArray<RefPointData> >; \
#define DECLARE_COMPUTE_REFPOINT_TOIMPLEMENT(data) \
template <> void data<ContainerArray<RefPointData> >::build \
(ContainerArray<RefPointData> & cont) {LM_TOIMPLEMENT;} \
template <> void data<ContainerArray<RefPointData> >::declareParams() \
{LM_TOIMPLEMENT;};
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif
/* __LIBMULTISCALE_COMPUTE_HH__ */
Event Timeline
Log In to Comment