Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
4b50f19b
Commit
4b50f19b
authored
Jun 02, 2015
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testing templates...
parent
6018ea78
Changes
53
Hide whitespace changes
Inline
Side-by-side
Showing
53 changed files
with
1075 additions
and
3429 deletions
+1075
-3429
Apps/Tests/Algo/CMakeLists.txt
Apps/Tests/Algo/CMakeLists.txt
+3
-3
Apps/Tests/Algo/LinearSolving/CMakeLists.txt
Apps/Tests/Algo/LinearSolving/CMakeLists.txt
+12
-0
Apps/Tests/Algo/LinearSolving/algo_linearSolving.cpp
Apps/Tests/Algo/LinearSolving/algo_linearSolving.cpp
+11
-0
Apps/Tests/Algo/LinearSolving/basic.cpp
Apps/Tests/Algo/LinearSolving/basic.cpp
+176
-412
Apps/Tests/Algo/MovingObjects/CMakeLists.txt
Apps/Tests/Algo/MovingObjects/CMakeLists.txt
+16
-0
Apps/Tests/Algo/MovingObjects/algo_movingObjects.cpp
Apps/Tests/Algo/MovingObjects/algo_movingObjects.cpp
+20
-0
Apps/Tests/Algo/MovingObjects/particle_base.cpp
Apps/Tests/Algo/MovingObjects/particle_base.cpp
+0
-87
Apps/Tests/Algo/MovingObjects/particle_cell_2D.cpp
Apps/Tests/Algo/MovingObjects/particle_cell_2D.cpp
+25
-114
Apps/Tests/Algo/MovingObjects/particle_cell_2D_memo.cpp
Apps/Tests/Algo/MovingObjects/particle_cell_2D_memo.cpp
+25
-58
Apps/Tests/Algo/MovingObjects/particle_cell_2D_secured.cpp
Apps/Tests/Algo/MovingObjects/particle_cell_2D_secured.cpp
+25
-59
Apps/Tests/Algo/MovingObjects/particle_cell_2DandHalf.cpp
Apps/Tests/Algo/MovingObjects/particle_cell_2DandHalf.cpp
+24
-108
Apps/Tests/Algo/MovingObjects/particle_cell_2DandHalf_memo.cpp
...Tests/Algo/MovingObjects/particle_cell_2DandHalf_memo.cpp
+25
-52
Apps/Tests/Algo/MovingObjects/particle_cell_3D.cpp
Apps/Tests/Algo/MovingObjects/particle_cell_3D.cpp
+20
-118
Apps/Tests/Algo/Render/CMakeLists.txt
Apps/Tests/Algo/Render/CMakeLists.txt
+23
-0
Apps/Tests/Algo/Render/GL2/colorPerEdgeRender.cpp
Apps/Tests/Algo/Render/GL2/colorPerEdgeRender.cpp
+21
-76
Apps/Tests/Algo/Render/GL2/colorPerFaceRender.cpp
Apps/Tests/Algo/Render/GL2/colorPerFaceRender.cpp
+88
-94
Apps/Tests/Algo/Render/GL2/dataPerFaceRender.cpp
Apps/Tests/Algo/Render/GL2/dataPerFaceRender.cpp
+47
-80
Apps/Tests/Algo/Render/GL2/drawerCells.cpp
Apps/Tests/Algo/Render/GL2/drawerCells.cpp
+96
-197
Apps/Tests/Algo/Render/GL2/explodeVolumeRender.cpp
Apps/Tests/Algo/Render/GL2/explodeVolumeRender.cpp
+25
-223
Apps/Tests/Algo/Render/GL2/mapRender.cpp
Apps/Tests/Algo/Render/GL2/mapRender.cpp
+29
-248
Apps/Tests/Algo/Render/GL2/topo3PrimalRender.cpp
Apps/Tests/Algo/Render/GL2/topo3PrimalRender.cpp
+17
-302
Apps/Tests/Algo/Render/GL2/topo3Render.cpp
Apps/Tests/Algo/Render/GL2/topo3Render.cpp
+24
-346
Apps/Tests/Algo/Render/GL2/topoPrimalRender.cpp
Apps/Tests/Algo/Render/GL2/topoPrimalRender.cpp
+15
-278
Apps/Tests/Algo/Render/GL2/topoRender.cpp
Apps/Tests/Algo/Render/GL2/topoRender.cpp
+72
-375
Apps/Tests/Algo/Render/SVG/mapSVGRender.cpp
Apps/Tests/Algo/Render/SVG/mapSVGRender.cpp
+58
-69
Apps/Tests/Algo/Render/algo_render.cpp
Apps/Tests/Algo/Render/algo_render.cpp
+29
-0
CGoGN/include/Algo/LinearSolving/basic.h
CGoGN/include/Algo/LinearSolving/basic.h
+8
-2
CGoGN/include/Algo/MovingObjects/particle_cell_2D.h
CGoGN/include/Algo/MovingObjects/particle_cell_2D.h
+3
-2
CGoGN/include/Algo/MovingObjects/particle_cell_2D.hpp
CGoGN/include/Algo/MovingObjects/particle_cell_2D.hpp
+5
-4
CGoGN/include/Algo/MovingObjects/particle_cell_2D_memo.h
CGoGN/include/Algo/MovingObjects/particle_cell_2D_memo.h
+4
-4
CGoGN/include/Algo/MovingObjects/particle_cell_2D_memo.hpp
CGoGN/include/Algo/MovingObjects/particle_cell_2D_memo.hpp
+2
-2
CGoGN/include/Algo/MovingObjects/particle_cell_2D_secured.h
CGoGN/include/Algo/MovingObjects/particle_cell_2D_secured.h
+7
-7
CGoGN/include/Algo/MovingObjects/particle_cell_2D_secured.hpp
...N/include/Algo/MovingObjects/particle_cell_2D_secured.hpp
+1
-1
CGoGN/include/Algo/MovingObjects/particle_cell_2DandHalf.h
CGoGN/include/Algo/MovingObjects/particle_cell_2DandHalf.h
+7
-6
CGoGN/include/Algo/MovingObjects/particle_cell_2DandHalf.hpp
CGoGN/include/Algo/MovingObjects/particle_cell_2DandHalf.hpp
+3
-3
CGoGN/include/Algo/MovingObjects/particle_cell_2DandHalf_memo.h
...include/Algo/MovingObjects/particle_cell_2DandHalf_memo.h
+2
-2
CGoGN/include/Algo/MovingObjects/particle_cell_2DandHalf_memo.hpp
...clude/Algo/MovingObjects/particle_cell_2DandHalf_memo.hpp
+3
-3
CGoGN/include/Algo/MovingObjects/particle_cell_3D.h
CGoGN/include/Algo/MovingObjects/particle_cell_3D.h
+3
-2
CGoGN/include/Algo/MovingObjects/particle_cell_3D.hpp
CGoGN/include/Algo/MovingObjects/particle_cell_3D.hpp
+2
-2
CGoGN/include/Algo/ProgressiveMesh/pmesh.hpp
CGoGN/include/Algo/ProgressiveMesh/pmesh.hpp
+51
-48
CGoGN/include/Algo/Render/GL2/colorPerEdgeRender.h
CGoGN/include/Algo/Render/GL2/colorPerEdgeRender.h
+1
-1
CGoGN/include/Algo/Render/GL2/colorPerEdgeRender.hpp
CGoGN/include/Algo/Render/GL2/colorPerEdgeRender.hpp
+5
-5
CGoGN/include/Algo/Render/GL2/colorPerFaceRender.hpp
CGoGN/include/Algo/Render/GL2/colorPerFaceRender.hpp
+7
-7
CGoGN/include/Algo/Render/GL2/dataPerFaceRender.hpp
CGoGN/include/Algo/Render/GL2/dataPerFaceRender.hpp
+3
-3
CGoGN/include/Algo/Render/GL2/drawerCells.hpp
CGoGN/include/Algo/Render/GL2/drawerCells.hpp
+2
-0
CGoGN/include/Algo/Render/GL2/explodeVolumeRender.hpp
CGoGN/include/Algo/Render/GL2/explodeVolumeRender.hpp
+16
-14
CGoGN/include/Algo/Render/GL2/mapRender.h
CGoGN/include/Algo/Render/GL2/mapRender.h
+1
-0
CGoGN/include/Algo/Render/GL2/mapRender.hpp
CGoGN/include/Algo/Render/GL2/mapRender.hpp
+5
-4
CGoGN/include/Algo/Render/GL2/topo3PrimalRender.hpp
CGoGN/include/Algo/Render/GL2/topo3PrimalRender.hpp
+1
-1
CGoGN/include/Algo/Render/GL2/topoPrimalRender.h
CGoGN/include/Algo/Render/GL2/topoPrimalRender.h
+1
-1
CGoGN/include/Algo/Render/GL2/topoPrimalRender.hpp
CGoGN/include/Algo/Render/GL2/topoPrimalRender.hpp
+4
-4
CGoGN/include/Topology/generic/traversor/traversor3.h
CGoGN/include/Topology/generic/traversor/traversor3.h
+1
-1
CGoGN/include/Topology/map/map2.hpp
CGoGN/include/Topology/map/map2.hpp
+1
-1
No files found.
Apps/Tests/Algo/CMakeLists.txt
View file @
4b50f19b
...
...
@@ -10,14 +10,14 @@ add_subdirectory(Geometry)
#add_subdirectory(Histogram)
#add_subdirectory(ImplicitHierarchicalMesh)
add_subdirectory
(
Import
)
#
add_subdirectory(LinearSolving)
add_subdirectory
(
LinearSolving
)
add_subdirectory
(
MC
)
add_subdirectory
(
Modelisation
)
#
add_subdirectory(MovingObjects)
add_subdirectory
(
MovingObjects
)
#add_subdirectory(Multiresolution)
add_subdirectory
(
ProgressiveMesh
)
add_subdirectory
(
Remeshing
)
#
add_subdirectory(Render)
add_subdirectory
(
Render
)
add_subdirectory
(
Selection
)
add_subdirectory
(
Simulation
)
add_subdirectory
(
Tiling
)
...
...
Apps/Tests/Algo/LinearSolving/CMakeLists.txt
0 → 100644
View file @
4b50f19b
cmake_minimum_required
(
VERSION 2.6
)
project
(
testing_algo_linearSolving
)
add_executable
(
test_algo_linearSolving
algo_linearSolving.cpp
basic.cpp
)
target_link_libraries
(
test_algo_linearSolving
${
CGoGN_LIBS
}
${
CGoGN_EXT_LIBS
}
)
Apps/Tests/Algo/LinearSolving/algo_linearSolving.cpp
0 → 100644
View file @
4b50f19b
#include <iostream>
extern
int
test_basic
();
int
main
()
{
test_basic
();
return
0
;
}
Apps/Tests/Algo/LinearSolving/basic.cpp
View file @
4b50f19b
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library 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 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library 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 this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __LINEAR_SOLVING_BASIC__
#define __LINEAR_SOLVING_BASIC__
#include "NL/nl.h"
#include "Topology/generic/traversor/traversorCell.h"
namespace
CGoGN
{
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
#include "Topology/map/embeddedMap3.h"
#include "Topology/gmap/embeddedGMap2.h"
namespace
LinearSolving
{
template
<
typename
CoeffType
>
struct
Coeff
{
unsigned
int
index
;
CoeffType
value
;
Coeff
(
unsigned
int
i
,
CoeffType
v
)
:
index
(
i
),
value
(
v
)
{}
}
;
/*******************************************************************************
* VARIABLES SETUP
*******************************************************************************/
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
setupVariables
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
typename
PFP
::
MAP
>&
index
,
const
CellMarker
<
typename
PFP
::
MAP
,
VERTEX
>&
freeMarker
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
>&
attr
)
{
foreach_cell
<
VERTEX
>
(
m
,
[
&
]
(
Dart
d
)
{
nlSetVariable
(
index
[
d
],
attr
[
d
]);
if
(
!
freeMarker
.
isMarked
(
d
))
nlLockVariable
(
index
[
d
]);
});
}
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
setupVariables
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
typename
PFP
::
MAP
>&
index
,
const
CellMarker
<
typename
PFP
::
MAP
,
VERTEX
>&
freeMarker
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
>&
attr
,
unsigned
int
coord
)
{
foreach_cell
<
VERTEX
>
(
m
,
[
&
]
(
Dart
d
)
{
nlSetVariable
(
index
[
d
],
(
attr
[
d
])[
coord
]);
if
(
!
freeMarker
.
isMarked
(
d
))
nlLockVariable
(
index
[
d
]);
});
}
/*******************************************************************************
* MATRIX SETUP : EQUALITY
*******************************************************************************/
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
addRowsRHS_Equality
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
typename
PFP
::
MAP
>&
index
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
>&
attr
,
const
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
weight
)
{
nlEnable
(
NL_NORMALIZE_ROWS
)
;
foreach_cell
<
VERTEX
>
(
m
,
[
&
]
(
Dart
d
)
{
nlRowParameterd
(
NL_RIGHT_HAND_SIDE
,
attr
[
d
])
;
nlRowParameterd
(
NL_ROW_SCALING
,
weight
[
d
])
;
nlBegin
(
NL_ROW
)
;
nlCoefficient
(
index
[
d
],
1
)
;
nlEnd
(
NL_ROW
)
;
});
nlDisable
(
NL_NORMALIZE_ROWS
)
;
}
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
addRowsRHS_Equality
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
typename
PFP
::
MAP
>&
index
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
>&
attr
,
float
weight
)
{
nlEnable
(
NL_NORMALIZE_ROWS
)
;
foreach_cell
<
VERTEX
>
(
m
,
[
&
]
(
Dart
d
)
{
nlRowParameterd
(
NL_RIGHT_HAND_SIDE
,
attr
[
d
])
;
nlRowParameterd
(
NL_ROW_SCALING
,
weight
)
;
nlBegin
(
NL_ROW
)
;
nlCoefficient
(
index
[
d
],
1
)
;
nlEnd
(
NL_ROW
)
;
});
nlDisable
(
NL_NORMALIZE_ROWS
)
;
}
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
addRowsRHS_Equality
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
typename
PFP
::
MAP
>&
index
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
>&
attr
,
const
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
weight
,
unsigned
int
coord
)
#include "Algo/LinearSolving/basic.h"
using
namespace
CGoGN
;
template
Algo
::
LinearSolving
::
Coeff
<
float
>;
template
Algo
::
LinearSolving
::
Coeff
<
double
>;
// Vec3 ?
struct
PFP1
:
public
PFP_DOUBLE
{
nlEnable
(
NL_NORMALIZE_ROWS
)
;
foreach_cell
<
VERTEX
>
(
m
,
[
&
]
(
Dart
d
)
{
nlRowParameterd
(
NL_RIGHT_HAND_SIDE
,
(
attr
[
d
])[
coord
])
;
nlRowParameterd
(
NL_ROW_SCALING
,
weight
[
d
])
;
nlBegin
(
NL_ROW
)
;
nlCoefficient
(
index
[
d
],
1
)
;
nlEnd
(
NL_ROW
)
;
});
nlDisable
(
NL_NORMALIZE_ROWS
)
;
}
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
addRowsRHS_Equality
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
typename
PFP
::
MAP
>&
index
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
>&
attr
,
typedef
EmbeddedMap2
MAP
;
};
typedef
float
SCAL_1
;
typedef
Geom
::
Vec3f
VEC_1
;
template
void
Algo
::
LinearSolving
::
setupVariables
<
PFP1
,
SCAL_1
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
CellMarker
<
PFP1
::
MAP
,
VERTEX
>&
freeMarker
,
const
VertexAttribute
<
SCAL_1
,
PFP1
::
MAP
>&
attr
);
template
void
Algo
::
LinearSolving
::
setupVariables
<
PFP1
,
VEC_1
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
CellMarker
<
PFP1
::
MAP
,
VERTEX
>&
freeMarker
,
const
VertexAttribute
<
VEC_1
,
PFP1
::
MAP
>&
attr
,
unsigned
int
coord
);
template
void
Algo
::
LinearSolving
::
addRowsRHS_Equality
<
PFP1
,
SCAL_1
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
VertexAttribute
<
SCAL_1
,
PFP1
::
MAP
>&
attr
,
const
VertexAttribute
<
PFP1
::
REAL
,
PFP1
::
MAP
>&
weight
);
template
void
Algo
::
LinearSolving
::
addRowsRHS_Equality
<
PFP1
,
SCAL_1
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
VertexAttribute
<
SCAL_1
,
PFP1
::
MAP
>&
attr
,
float
weight
);
template
void
Algo
::
LinearSolving
::
addRowsRHS_Equality
<
PFP1
,
VEC_1
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
VertexAttribute
<
VEC_1
,
PFP1
::
MAP
>&
attr
,
const
VertexAttribute
<
PFP1
::
REAL
,
PFP1
::
MAP
>&
weight
,
unsigned
int
coord
);
template
void
Algo
::
LinearSolving
::
addRowsRHS_Equality
<
PFP1
,
VEC_1
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
VertexAttribute
<
VEC_1
,
PFP1
::
MAP
>&
attr
,
float
weight
,
unsigned
int
coord
)
{
nlEnable
(
NL_NORMALIZE_ROWS
)
;
foreach_cell
<
VERTEX
>
(
m
,
[
&
]
(
Dart
d
)
{
nlRowParameterd
(
NL_RIGHT_HAND_SIDE
,
(
attr
[
d
])[
coord
])
;
nlRowParameterd
(
NL_ROW_SCALING
,
weight
)
;
nlBegin
(
NL_ROW
)
;
nlCoefficient
(
index
[
d
],
1
)
;
nlEnd
(
NL_ROW
)
;
});
nlDisable
(
NL_NORMALIZE_ROWS
)
;
}
/*******************************************************************************
* MATRIX SETUP : LAPLACIAN TOPO
*******************************************************************************/
template
<
typename
PFP
>
void
addRows_Laplacian_Topo
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
typename
PFP
::
MAP
>&
index
)
{
nlEnable
(
NL_NORMALIZE_ROWS
)
;
foreach_cell
<
VERTEX
>
(
m
,
[
&
]
(
Dart
d
)
{
nlRowParameterd
(
NL_RIGHT_HAND_SIDE
,
0
)
;
nlBegin
(
NL_ROW
);
typename
PFP
::
REAL
aii
=
0
;
Traversor2VE
<
typename
PFP
::
MAP
>
t
(
m
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
{
typename
PFP
::
REAL
aij
=
1
;
aii
+=
aij
;
nlCoefficient
(
index
[
m
.
phi1
(
it
)],
aij
)
;
}
nlCoefficient
(
index
[
d
],
-
aii
)
;
nlEnd
(
NL_ROW
)
;
});
nlDisable
(
NL_NORMALIZE_ROWS
)
;
}
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
addRowsRHS_Laplacian_Topo
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
typename
PFP
::
MAP
>&
index
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
>&
attr
)
{
nlEnable
(
NL_NORMALIZE_ROWS
)
;
foreach_cell
<
VERTEX
>
(
m
,
[
&
]
(
Dart
d
)
{
std
::
vector
<
Coeff
<
typename
PFP
::
REAL
>
>
coeffs
;
coeffs
.
reserve
(
12
)
;
typename
PFP
::
REAL
norm2
=
0
;
typename
PFP
::
REAL
aii
=
0
;
Traversor2VE
<
typename
PFP
::
MAP
>
t
(
m
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
{
typename
PFP
::
REAL
aij
=
1
;
aii
+=
aij
;
coeffs
.
push_back
(
Coeff
<
typename
PFP
::
REAL
>
(
index
[
m
.
phi1
(
it
)],
aij
))
;
norm2
+=
aij
*
aij
;
}
coeffs
.
push_back
(
Coeff
<
typename
PFP
::
REAL
>
(
index
[
d
],
-
aii
))
;
norm2
+=
aii
*
aii
;
nlRowParameterd
(
NL_RIGHT_HAND_SIDE
,
attr
[
d
]
*
sqrt
(
norm2
))
;
nlBegin
(
NL_ROW
);
for
(
unsigned
int
i
=
0
;
i
<
coeffs
.
size
();
++
i
)
nlCoefficient
(
coeffs
[
i
].
index
,
coeffs
[
i
].
value
)
;
nlEnd
(
NL_ROW
)
;
});
nlDisable
(
NL_NORMALIZE_ROWS
)
;
}
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
addRowsRHS_Laplacian_Topo
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
typename
PFP
::
MAP
>&
index
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
>&
attr
,
unsigned
int
coord
)
{
nlEnable
(
NL_NORMALIZE_ROWS
)
;
foreach_cell
<
VERTEX
>
(
m
,
[
&
]
(
Dart
d
)
{
std
::
vector
<
Coeff
<
typename
PFP
::
REAL
>
>
coeffs
;
coeffs
.
reserve
(
12
)
;
typename
PFP
::
REAL
norm2
=
0
;
typename
PFP
::
REAL
aii
=
0
;
Traversor2VE
<
typename
PFP
::
MAP
>
t
(
m
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
{
typename
PFP
::
REAL
aij
=
1
;
aii
+=
aij
;
coeffs
.
push_back
(
Coeff
<
typename
PFP
::
REAL
>
(
index
[
m
.
phi1
(
it
)],
aij
))
;
norm2
+=
aij
*
aij
;
}
coeffs
.
push_back
(
Coeff
<
typename
PFP
::
REAL
>
(
index
[
d
],
-
aii
))
;
norm2
+=
aii
*
aii
;
nlRowParameterd
(
NL_RIGHT_HAND_SIDE
,
(
attr
[
d
])[
coord
]
*
sqrt
(
norm2
))
;
nlBegin
(
NL_ROW
);
for
(
unsigned
int
i
=
0
;
i
<
coeffs
.
size
();
++
i
)
nlCoefficient
(
coeffs
[
i
].
index
,
coeffs
[
i
].
value
)
;
nlEnd
(
NL_ROW
)
;
});
nlDisable
(
NL_NORMALIZE_ROWS
)
;
}
/*******************************************************************************
* MATRIX SETUP : LAPLACIAN COTAN
*******************************************************************************/
template
<
typename
PFP
>
void
addRows_Laplacian_Cotan
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
typename
PFP
::
MAP
>&
index
,
const
EdgeAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
edgeWeight
,
const
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
vertexArea
)
{
nlEnable
(
NL_NORMALIZE_ROWS
)
;
foreach_cell
<
VERTEX
>
(
m
,
[
&
]
(
Dart
d
)
{
nlRowParameterd
(
NL_RIGHT_HAND_SIDE
,
0
)
;
nlBegin
(
NL_ROW
);
typename
PFP
::
REAL
vArea
=
vertexArea
[
d
]
;
typename
PFP
::
REAL
aii
=
0
;
Traversor2VE
<
typename
PFP
::
MAP
>
t
(
m
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
{
typename
PFP
::
REAL
aij
=
edgeWeight
[
it
]
/
vArea
;
aii
+=
aij
;
nlCoefficient
(
index
[
m
.
phi1
(
it
)],
aij
)
;
}
nlCoefficient
(
index
[
d
],
-
aii
)
;
nlEnd
(
NL_ROW
)
;
});
nlDisable
(
NL_NORMALIZE_ROWS
)
;
}
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
addRowsRHS_Laplacian_Cotan
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
typename
PFP
::
MAP
>&
index
,
const
EdgeAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
edgeWeight
,
const
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
vertexArea
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
>&
attr
)
{
nlEnable
(
NL_NORMALIZE_ROWS
)
;
foreach_cell
<
VERTEX
>
(
m
,
[
&
]
(
Dart
d
)
{
std
::
vector
<
Coeff
<
typename
PFP
::
REAL
>
>
coeffs
;
coeffs
.
reserve
(
12
)
;
typename
PFP
::
REAL
vArea
=
vertexArea
[
d
]
;
typename
PFP
::
REAL
norm2
=
0
;
typename
PFP
::
REAL
aii
=
0
;
Traversor2VE
<
typename
PFP
::
MAP
>
t
(
m
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
{
typename
PFP
::
REAL
aij
=
edgeWeight
[
it
]
/
vArea
;
aii
+=
aij
;
coeffs
.
push_back
(
Coeff
<
typename
PFP
::
REAL
>
(
index
[
m
.
phi1
(
it
)],
aij
))
;
norm2
+=
aij
*
aij
;
}
coeffs
.
push_back
(
Coeff
<
typename
PFP
::
REAL
>
(
index
[
d
],
-
aii
))
;
norm2
+=
aii
*
aii
;
nlRowParameterd
(
NL_RIGHT_HAND_SIDE
,
attr
[
d
]
*
sqrt
(
norm2
))
;
nlBegin
(
NL_ROW
);
for
(
unsigned
int
i
=
0
;
i
<
coeffs
.
size
();
++
i
)
nlCoefficient
(
coeffs
[
i
].
index
,
coeffs
[
i
].
value
)
;
nlEnd
(
NL_ROW
)
;
});
nlDisable
(
NL_NORMALIZE_ROWS
)
;
}
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
addRowsRHS_Laplacian_Cotan
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
typename
PFP
::
MAP
>&
index
,
const
EdgeAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
edgeWeight
,
const
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
vertexArea
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
>&
attr
,
unsigned
int
coord
)
{
nlEnable
(
NL_NORMALIZE_ROWS
)
;
foreach_cell
<
VERTEX
>
(
m
,
[
&
]
(
Dart
d
)
{
std
::
vector
<
Coeff
<
typename
PFP
::
REAL
>
>
coeffs
;
coeffs
.
reserve
(
12
)
;
typename
PFP
::
REAL
vArea
=
vertexArea
[
d
]
;
typename
PFP
::
REAL
norm2
=
0
;
typename
PFP
::
REAL
aii
=
0
;
Traversor2VE
<
typename
PFP
::
MAP
>
t
(
m
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
{
typename
PFP
::
REAL
aij
=
edgeWeight
[
it
]
/
vArea
;
aii
+=
aij
;
coeffs
.
push_back
(
Coeff
<
typename
PFP
::
REAL
>
(
index
[
m
.
phi1
(
it
)],
aij
))
;
norm2
+=
aij
*
aij
;
}
coeffs
.
push_back
(
Coeff
<
typename
PFP
::
REAL
>
(
index
[
d
],
-
aii
))
;
norm2
+=
aii
*
aii
;
nlRowParameterd
(
NL_RIGHT_HAND_SIDE
,
(
attr
[
d
])[
coord
]
*
sqrt
(
norm2
))
;
nlBegin
(
NL_ROW
);
for
(
unsigned
int
i
=
0
;
i
<
coeffs
.
size
();
++
i
)
nlCoefficient
(
coeffs
[
i
].
index
,
coeffs
[
i
].
value
)
;
nlEnd
(
NL_ROW
)
;
});
nlDisable
(
NL_NORMALIZE_ROWS
)
;
}
/*******************************************************************************
* GET RESULTS
*******************************************************************************/
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
getResult
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
typename
PFP
::
MAP
>&
index
,
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
>&
attr
)
{
foreach_cell
<
VERTEX
>
(
m
,
[
&
]
(
Dart
d
)
{
attr
[
d
]
=
nlGetVariable
(
index
[
d
])
;
});
}
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
getResult
(
typename
PFP
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
typename
PFP
::
MAP
>&
index
,
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
>&
attr
,
unsigned
int
coord
)
{
foreach_cell
<
VERTEX
>
(
m
,
[
&
]
(
Dart
d
)
{
(
attr
[
d
])[
coord
]
=
nlGetVariable
(
index
[
d
])
;
});
}
unsigned
int
coord
);
template
void
Algo
::
LinearSolving
::
addRows_Laplacian_Topo
<
PFP1
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
);
template
void
Algo
::
LinearSolving
::
addRowsRHS_Laplacian_Topo
<
PFP1
,
SCAL_1
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
VertexAttribute
<
SCAL_1
,
PFP1
::
MAP
>&
attr
);
template
void
Algo
::
LinearSolving
::
addRowsRHS_Laplacian_Topo
<
PFP1
,
VEC_1
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
VertexAttribute
<
VEC_1
,
PFP1
::
MAP
>&
attr
,
unsigned
int
coord
);
template
void
Algo
::
LinearSolving
::
addRows_Laplacian_Cotan
<
PFP1
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
EdgeAttribute
<
PFP1
::
REAL
,
PFP1
::
MAP
>&
edgeWeight
,
const
VertexAttribute
<
PFP1
::
REAL
,
PFP1
::
MAP
>&
vertexArea
);
template
void
Algo
::
LinearSolving
::
addRowsRHS_Laplacian_Cotan
<
PFP1
,
SCAL_1
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
EdgeAttribute
<
PFP1
::
REAL
,
PFP1
::
MAP
>&
edgeWeight
,
const
VertexAttribute
<
PFP1
::
REAL
,
PFP1
::
MAP
>&
vertexArea
,
const
VertexAttribute
<
SCAL_1
,
PFP1
::
MAP
>&
attr
);
template
void
Algo
::
LinearSolving
::
addRowsRHS_Laplacian_Cotan
<
PFP1
,
VEC_1
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
EdgeAttribute
<
PFP1
::
REAL
,
PFP1
::
MAP
>&
edgeWeight
,
const
VertexAttribute
<
PFP1
::
REAL
,
PFP1
::
MAP
>&
vertexArea
,
const
VertexAttribute
<
VEC_1
,
PFP1
::
MAP
>&
attr
,
unsigned
int
coord
);
template
void
Algo
::
LinearSolving
::
getResult
<
PFP1
,
SCAL_1
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
VertexAttribute
<
SCAL_1
,
PFP1
::
MAP
>&
attr
);
template
void
Algo
::
LinearSolving
::
getResult
<
PFP1
,
VEC_1
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
VertexAttribute
<
VEC_1
,
PFP1
::
MAP
>&
attr
,
unsigned
int
coord
);
//struct PFP1 : public PFP_DOUBLE
//{
// typedef EmbeddedMap2 MAP;
//};
typedef
double
SCAL_2
;
typedef
Geom
::
Vec3d
VEC_2
;
template
void
Algo
::
LinearSolving
::
setupVariables
<
PFP1
,
SCAL_2
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
CellMarker
<
PFP1
::
MAP
,
VERTEX
>&
freeMarker
,
const
VertexAttribute
<
SCAL_2
,
PFP1
::
MAP
>&
attr
);
template
void
Algo
::
LinearSolving
::
setupVariables
<
PFP1
,
VEC_2
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
CellMarker
<
PFP1
::
MAP
,
VERTEX
>&
freeMarker
,
const
VertexAttribute
<
VEC_2
,
PFP1
::
MAP
>&
attr
,
unsigned
int
coord
);
template
void
Algo
::
LinearSolving
::
addRowsRHS_Equality
<
PFP1
,
SCAL_2
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
VertexAttribute
<
SCAL_2
,
PFP1
::
MAP
>&
attr
,
const
VertexAttribute
<
PFP1
::
REAL
,
PFP1
::
MAP
>&
weight
);
template
void
Algo
::
LinearSolving
::
addRowsRHS_Equality
<
PFP1
,
SCAL_2
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
VertexAttribute
<
SCAL_2
,
PFP1
::
MAP
>&
attr
,
float
weight
);
template
void
Algo
::
LinearSolving
::
addRowsRHS_Equality
<
PFP1
,
VEC_2
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
VertexAttribute
<
VEC_2
,
PFP1
::
MAP
>&
attr
,
const
VertexAttribute
<
PFP1
::
REAL
,
PFP1
::
MAP
>&
weight
,
unsigned
int
coord
);
template
void
Algo
::
LinearSolving
::
addRowsRHS_Equality
<
PFP1
,
VEC_2
>(
PFP1
::
MAP
&
m
,
const
VertexAttribute
<
unsigned
int
,
PFP1
::
MAP
>&
index
,
const
VertexAttribute
<
VEC_2
,
PFP1
::
MAP
>&
attr
,
float
weight
,
unsigned
int
coord
);