Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F86990398
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
Wed, Oct 9, 20:38
Size
1 KB
Mime Type
text/x-c++
Expires
Fri, Oct 11, 20:38 (2 d)
Engine
blob
Format
Raw Data
Handle
21518998
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
:
Field
(
T
&
cont
)
:
cont
(
cont
){};
UInt
getDim
()
{
if
(
not
cont
.
size
())
return
0
;
auto
&
ref
=
cont
.
get
(
0
);
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