Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kirill Terekhov
INMOST
Commits
f68544bc
Commit
f68544bc
authored
Jun 02, 2017
by
Kirill Terekhov
Browse files
Features
operator () that return data in matrix form for TagRealArray and TagVariableArray
parent
9689e3ce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Source/Headers/inmost_data.h
View file @
f68544bc
...
...
@@ -5,7 +5,7 @@
#if defined(USE_AUTODIFF)
#include "inmost_expression.h"
#endif
#include "inmost_dense.h"
#if defined(USE_MESH)
...
...
@@ -673,6 +673,13 @@ namespace INMOST
TagRealArray
&
operator
=
(
Tag
const
&
b
)
{
Tag
::
operator
=
(
b
);
return
*
this
;}
__INLINE
Storage
::
real_array
operator
[](
const
Storage
&
arg
)
const
{
return
arg
.
RealArray
(
*
static_cast
<
const
Tag
*>
(
this
));}
__INLINE
Storage
::
real_array
operator
[](
HandleType
h
)
const
;
__INLINE
Matrix
<
Storage
::
real
,
Storage
::
real_array
>
operator
()(
const
Storage
&
arg
,
int
n
,
int
m
)
const
{
Storage
::
real_array
data
=
arg
.
RealArray
(
*
static_cast
<
const
Tag
*>
(
this
));
assert
(
data
.
size
()
==
n
*
m
);
return
Matrix
<
Storage
::
real
,
Storage
::
real_array
>
(
data
,
n
,
m
);
}
__INLINE
Matrix
<
Storage
::
real
,
Storage
::
real_array
>
operator
()(
HandleType
h
,
int
n
,
int
m
)
const
;
};
class
TagIntegerArray
:
public
Tag
...
...
@@ -734,6 +741,13 @@ namespace INMOST
TagVariableArray
&
operator
=
(
Tag
const
&
b
)
{
Tag
::
operator
=
(
b
);
return
*
this
;}
__INLINE
Storage
::
var_array
operator
[](
const
Storage
&
arg
)
const
{
return
arg
.
VariableArray
(
*
static_cast
<
const
Tag
*>
(
this
));}
__INLINE
Storage
::
var_array
operator
[](
HandleType
h
)
const
;
__INLINE
Matrix
<
Storage
::
var
,
Storage
::
var_array
>
operator
()(
const
Storage
&
arg
,
int
n
,
int
m
)
const
{
Storage
::
var_array
data
=
arg
.
VariableArray
(
*
static_cast
<
const
Tag
*>
(
this
));
assert
(
data
.
size
()
==
n
*
m
);
return
Matrix
<
Storage
::
var
,
Storage
::
var_array
>
(
data
,
n
,
m
);
}
__INLINE
Matrix
<
Storage
::
var
,
Storage
::
var_array
>
operator
()(
HandleType
h
,
int
n
,
int
m
)
const
;
};
#endif //USE_AUTODIFF
...
...
Source/Headers/inmost_dense.h
View file @
f68544bc
...
...
@@ -553,9 +553,9 @@ namespace INMOST
for
(
enumerator
l
=
0
;
l
<
Cols
();
++
l
)
{
if
(
fabs
(
get_value
((
*
this
)(
k
,
l
)))
>
threshold
)
std
::
cout
<<
std
::
setw
(
1
0
)
<<
get_value
((
*
this
)(
k
,
l
));
std
::
cout
<<
std
::
setw
(
1
2
)
<<
get_value
((
*
this
)(
k
,
l
));
else
std
::
cout
<<
std
::
setw
(
1
0
)
<<
0
;
std
::
cout
<<
std
::
setw
(
1
2
)
<<
0
;
std
::
cout
<<
" "
;
}
std
::
cout
<<
std
::
endl
;
...
...
@@ -815,10 +815,10 @@ namespace INMOST
Matrix
(
enumerator
pn
,
enumerator
pm
)
:
space
(
pn
*
pm
),
n
(
pn
),
m
(
pm
)
{}
/// Copy matrix.
/// @param other Another matrix of the same type.
Matrix
(
const
Matrix
&
other
)
:
space
(
other
.
n
*
other
.
m
),
n
(
other
.
n
),
m
(
other
.
m
)
Matrix
(
const
Matrix
&
other
)
:
space
(
other
.
space
),
n
(
other
.
n
),
m
(
other
.
m
)
{
for
(
enumerator
i
=
0
;
i
<
n
*
m
;
++
i
)
space
[
i
]
=
other
.
space
[
i
];
//
for(enumerator i = 0; i < n*m; ++i)
//
space[i] = other.space[i];
}
/// Construct matrix from matrix of different type.
/// Uses assign function declared in inmost_expression.h.
...
...
Source/Headers/inmost_mesh.h
View file @
f68544bc
...
...
@@ -3470,6 +3470,12 @@ namespace INMOST
{
return
GetMeshLink
()
->
RealArray
(
h
,
*
static_cast
<
const
Tag
*>
(
this
));
}
__INLINE
Matrix
<
Storage
::
real
,
Storage
::
real_array
>
TagRealArray
::
operator
()(
HandleType
h
,
int
n
,
int
m
)
const
{
Storage
::
real_array
data
=
GetMeshLink
()
->
RealArray
(
h
,
*
static_cast
<
const
Tag
*>
(
this
));
assert
(
data
.
size
()
==
n
*
m
);
return
Matrix
<
Storage
::
real
,
Storage
::
real_array
>
(
data
,
n
,
m
);
}
__INLINE
Storage
::
integer_array
TagIntegerArray
::
operator
[](
HandleType
h
)
const
{
return
GetMeshLink
()
->
IntegerArray
(
h
,
*
static_cast
<
const
Tag
*>
(
this
));
...
...
@@ -3515,6 +3521,13 @@ namespace INMOST
{
return
GetMeshLink
()
->
VariableArray
(
h
,
*
static_cast
<
const
Tag
*>
(
this
));
}
__INLINE
Matrix
<
Storage
::
var
,
Storage
::
var_array
>
TagVariableArray
::
operator
()(
HandleType
h
,
int
n
,
int
m
)
const
{
Storage
::
var_array
data
=
GetMeshLink
()
->
VariableArray
(
h
,
*
static_cast
<
const
Tag
*>
(
this
));
assert
(
data
.
size
()
==
n
*
m
);
return
Matrix
<
Storage
::
var
,
Storage
::
var_array
>
(
data
,
n
,
m
);
}
#endif
__INLINE
bool
Storage
::
HaveData
(
const
Tag
&
tag
)
const
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment