Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
CGoGN
CGoGN
Commits
2b452e36
Commit
2b452e36
authored
Nov 13, 2012
by
Kenneth Vanhoey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add method for completing a Tensor that is partially filled and supposed
to be symmetric.
parent
92e95d00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
include/Geometry/tensor.h
include/Geometry/tensor.h
+12
-0
include/Geometry/tensor.hpp
include/Geometry/tensor.hpp
+15
-0
No files found.
include/Geometry/tensor.h
View file @
2b452e36
...
@@ -29,6 +29,9 @@
...
@@ -29,6 +29,9 @@
* \file tensor.h
* \file tensor.h
*/
*/
#define CONST_VAL -5212368.54127 // random value
namespace
CGoGN
namespace
CGoGN
{
{
...
@@ -192,6 +195,15 @@ class Tensor
...
@@ -192,6 +195,15 @@ class Tensor
*/
*/
static
bool
incremIndex
(
std
::
vector
<
unsigned
int
>&
p
)
;
static
bool
incremIndex
(
std
::
vector
<
unsigned
int
>&
p
)
;
/*!
* \brief method to complete a symmetric tensor that was
* only filled in its first half (defined by an index that
* is order ascendantly)
*
* \param T the tensor to fill
*/
void
completeSymmetricTensor
()
;
/**********************************************/
/**********************************************/
/* STREAM OPERATORS */
/* STREAM OPERATORS */
/**********************************************/
/**********************************************/
...
...
include/Geometry/tensor.hpp
View file @
2b452e36
...
@@ -134,6 +134,21 @@ Tensor<SIZE, REAL>::getIndex(std::vector<unsigned int> p) const
...
@@ -134,6 +134,21 @@ Tensor<SIZE, REAL>::getIndex(std::vector<unsigned int> p) const
return
res
;
return
res
;
}
}
template
<
unsigned
int
SIZE
,
typename
REAL
>
void
Tensor
<
SIZE
,
REAL
>::
completeSymmetricTensor
()
{
std
::
vector
<
unsigned
int
>
p
;
p
.
resize
(
order
(),
0
)
;
do
{
std
::
vector
<
unsigned
int
>
sorted_p
=
p
;
std
::
sort
(
sorted_p
.
begin
(),
sorted_p
.
begin
()
+
(
*
this
).
order
())
;
(
*
this
)(
p
)
=
(
*
this
)(
sorted_p
)
;
}
while
(
incremIndex
(
p
))
;
}
template
<
unsigned
int
SIZE
,
typename
REAL
>
template
<
unsigned
int
SIZE
,
typename
REAL
>
const
unsigned
int
&
const
unsigned
int
&
Tensor
<
SIZE
,
REAL
>::
order
()
const
Tensor
<
SIZE
,
REAL
>::
order
()
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