Commit 0b944888 authored by Pierre Kraemer's avatar Pierre Kraemer

update LinearSolving algo to lambdas

parent 7a132517
......@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8)
project(SCHNApps)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -std=c++11")
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/.. CACHE STRING "CGoGN root dir")
......
This diff is collapsed.
This diff is collapsed.
/*******************************************************************************
* 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_VARIABLES_SETUP__
#define __LINEAR_SOLVING_VARIABLES_SETUP__
namespace CGoGN
{
namespace LinearSolving
{
template <typename PFP, typename ATTR_TYPE>
class FunctorMeshToSolver_Scalar : public FunctorType
{
typedef typename PFP::MAP MAP;
typedef typename PFP::MAP::IMPL MAP_IMPL;
protected:
const VertexAttribute<unsigned int, MAP_IMPL>& indexTable ;
const CellMarker<MAP, VERTEX>& freeMarker ;
const VertexAttribute<ATTR_TYPE, MAP_IMPL>& attrTable ;
bool lockedVertices ;
public:
FunctorMeshToSolver_Scalar(
const VertexAttribute<unsigned int, MAP_IMPL>& index,
const CellMarker<MAP, VERTEX>& fm,
const VertexAttribute<ATTR_TYPE, MAP_IMPL>& attr
) : indexTable(index), freeMarker(fm), attrTable(attr), lockedVertices(false)
{}
bool operator()(Dart d)
{
nlSetVariable(indexTable[d], attrTable[d]);
if(!freeMarker.isMarked(d))
{
nlLockVariable(indexTable[d]);
lockedVertices = true ;
}
return false ;
}
bool hasLockedVertices() { return lockedVertices ; }
} ;
template <typename PFP, typename ATTR_TYPE>
class FunctorMeshToSolver_Vector : public FunctorType
{
typedef typename PFP::MAP MAP;
typedef typename PFP::MAP::IMPL MAP_IMPL;
protected:
const VertexAttribute<unsigned int, MAP_IMPL>& indexTable ;
const CellMarker<MAP, VERTEX>& freeMarker ;
const VertexAttribute<ATTR_TYPE, MAP_IMPL>& attrTable ;
unsigned int coord ;
bool lockedVertices ;
public:
FunctorMeshToSolver_Vector(
const VertexAttribute<unsigned int, MAP_IMPL>& index,
const CellMarker<MAP, VERTEX>& fm,
const VertexAttribute<ATTR_TYPE, MAP_IMPL>& attr,
unsigned int c
) : indexTable(index), freeMarker(fm), attrTable(attr), coord(c), lockedVertices(false)
{}
bool operator()(Dart d)
{
nlSetVariable(indexTable[d], (attrTable[d])[coord]);
if(!freeMarker.isMarked(d))
{
nlLockVariable(indexTable[d]);
lockedVertices = true ;
}
return false ;
}
bool hasLockedVertices() { return lockedVertices ; }
} ;
template <typename PFP, typename ATTR_TYPE>
class FunctorSolverToMesh_Scalar : public FunctorType
{
typedef typename PFP::MAP MAP;
typedef typename PFP::MAP::IMPL MAP_IMPL;
protected:
const VertexAttribute<unsigned int, MAP_IMPL>& indexTable ;
VertexAttribute<ATTR_TYPE, MAP_IMPL>& attrTable ;
public:
FunctorSolverToMesh_Scalar(
const VertexAttribute<unsigned int, MAP_IMPL>& index,
VertexAttribute<ATTR_TYPE, MAP_IMPL>& attr
) : indexTable(index), attrTable(attr)
{}
bool operator()(Dart d)
{
attrTable[d] = nlGetVariable(indexTable[d]) ;
return false ;
}
} ;
template <typename PFP, typename ATTR_TYPE>
class FunctorSolverToMesh_Vector : public FunctorType
{
typedef typename PFP::MAP MAP;
typedef typename PFP::MAP::IMPL MAP_IMPL;
protected:
const VertexAttribute<unsigned int, MAP_IMPL>& indexTable ;
VertexAttribute<ATTR_TYPE, MAP_IMPL>& attrTable ;
unsigned int coord ;
public:
FunctorSolverToMesh_Vector(
const VertexAttribute<unsigned int, MAP_IMPL>& index,
VertexAttribute<ATTR_TYPE, MAP_IMPL>& attr,
unsigned int c
) : indexTable(index), attrTable(attr), coord(c)
{}
bool operator()(Dart d)
{
(attrTable[d])[coord] = nlGetVariable(indexTable[d]) ;
return false ;
}
} ;
} // namespace LinearSolving
} // namespace CGoGN
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment