Building igl statically and moving to the dep scripts

Fixing dep build script on Windows and removing some warnings.

Use bundled igl by default.

Not building with the dependency scripts if not explicitly stated. This way, it will stay in
Fix the libigl patch to include C source files in header only mode.
This commit is contained in:
tamasmeszaros 2019-06-19 14:52:55 +02:00
parent 89e39e3895
commit 2ae2672ee9
1095 changed files with 181 additions and 5 deletions

93
src/libigl/igl/bfs.cpp Normal file
View file

@ -0,0 +1,93 @@
#include "bfs.h"
#include "list_to_matrix.h"
#include <vector>
#include <queue>
template <
typename AType,
typename DerivedD,
typename DerivedP>
IGL_INLINE void igl::bfs(
const AType & A,
const size_t s,
Eigen::PlainObjectBase<DerivedD> & D,
Eigen::PlainObjectBase<DerivedP> & P)
{
std::vector<typename DerivedD::Scalar> vD;
std::vector<typename DerivedP::Scalar> vP;
bfs(A,s,vD,vP);
list_to_matrix(vD,D);
list_to_matrix(vP,P);
}
template <
typename AType,
typename DType,
typename PType>
IGL_INLINE void igl::bfs(
const std::vector<std::vector<AType> > & A,
const size_t s,
std::vector<DType> & D,
std::vector<PType> & P)
{
// number of nodes
int N = s+1;
for(const auto & Ai : A) for(const auto & a : Ai) N = std::max(N,a+1);
std::vector<bool> seen(N,false);
P.resize(N,-1);
std::queue<std::pair<int,int> > Q;
Q.push({s,-1});
while(!Q.empty())
{
const int f = Q.front().first;
const int p = Q.front().second;
Q.pop();
if(seen[f])
{
continue;
}
D.push_back(f);
P[f] = p;
seen[f] = true;
for(const auto & n : A[f]) Q.push({n,f});
}
}
template <
typename AType,
typename DType,
typename PType>
IGL_INLINE void igl::bfs(
const Eigen::SparseMatrix<AType> & A,
const size_t s,
std::vector<DType> & D,
std::vector<PType> & P)
{
// number of nodes
int N = A.rows();
assert(A.rows() == A.cols());
std::vector<bool> seen(N,false);
P.resize(N,-1);
std::queue<std::pair<int,int> > Q;
Q.push({s,-1});
while(!Q.empty())
{
const int f = Q.front().first;
const int p = Q.front().second;
Q.pop();
if(seen[f])
{
continue;
}
D.push_back(f);
P[f] = p;
seen[f] = true;
for(typename Eigen::SparseMatrix<AType>::InnerIterator it (A,f); it; ++it)
{
if(it.value()) Q.push({it.index(),f});
}
}
}