Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F86362121
field.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
Sun, Oct 6, 01:29
Size
1 KB
Mime Type
text/x-c++
Expires
Tue, Oct 8, 01:29 (2 d)
Engine
blob
Format
Raw Data
Handle
21409890
Attached To
rLIBMULTISCALE LibMultiScale
field.hh
View Options
#ifndef __LIBMULTISCALE_FIELD_HH__
#define __LIBMULTISCALE_FIELD_HH__
/* -------------------------------------------------------------------------- */
#include "lm_common.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
template
<
FieldType
fieldtype
,
typename
T
>
class
Field
{
public
:
static
constexpr
FieldType
type
=
fieldtype
;
Field
(
T
&
cont
)
:
cont
(
cont
){};
UInt
getDim
()
{
if
(
not
cont
.
size
())
return
0
;
auto
&&
ref
=
*
this
->
cont
.
begin
();
auto
f
=
ref
.
template
field
<
fieldtype
>
();
return
f
.
size
();
};
std
::
string
getName
()
{
std
::
stringstream
sstr
;
sstr
<<
fieldtype
;
return
sstr
.
str
();
};
template
<
typename
it_type
>
struct
iterator
{
iterator
(
it_type
it
)
:
it
(
std
::
move
(
it
))
{}
bool
operator
!=
(
const
iterator
&
it
)
const
{
return
this
->
it
!=
it
.
it
;
};
void
operator
++
()
{
++
this
->
it
;
};
auto
operator
*
()
{
return
(
*
it
).
template
field
<
fieldtype
>
();
};
it_type
it
;
};
decltype
(
auto
)
begin
()
{
return
iterator
<
decltype
(
cont
.
begin
())
>
(
cont
.
begin
());
};
decltype
(
auto
)
end
()
{
return
iterator
<
decltype
(
cont
.
begin
())
>
(
cont
.
end
());
};
T
&
cont
;
};
template
<
FieldType
fieldtype
,
typename
T
>
Field
<
fieldtype
,
T
>
make_field
(
T
&
cont
)
{
return
Field
<
fieldtype
,
T
>
(
cont
);
}
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
#endif
//__LIBMULTISCALE_FIELD_HH__
Event Timeline
Log In to Comment