mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-24 09:11:23 -06:00
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:
parent
89e39e3895
commit
2ae2672ee9
1095 changed files with 181 additions and 5 deletions
78
src/libigl/igl/for_each.h
Normal file
78
src/libigl/igl/for_each.h
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
#ifndef IGL_FOR_EACH_H
|
||||
#define IGL_FOR_EACH_H
|
||||
#include "igl_inline.h"
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Sparse>
|
||||
namespace igl
|
||||
{
|
||||
// FOR_EACH Call a given function for each non-zero (i.e., explicit value
|
||||
// might actually be ==0) in a Sparse Matrix A _in order (of storage)_. This is
|
||||
// useless unless func has _side-effects_.
|
||||
//
|
||||
// Inputs:
|
||||
// A m by n SparseMatrix
|
||||
// func function handle with prototype "compatible with" `void (Index i,
|
||||
// Index j, Scalar & v)`. Return values will be ignored.
|
||||
//
|
||||
// See also: std::for_each
|
||||
template <typename AType, typename Func>
|
||||
inline void for_each(
|
||||
const Eigen::SparseMatrix<AType> & A,
|
||||
const Func & func);
|
||||
template <typename DerivedA, typename Func>
|
||||
inline void for_each(
|
||||
const Eigen::DenseBase<DerivedA> & A,
|
||||
const Func & func);
|
||||
}
|
||||
|
||||
// Implementation
|
||||
|
||||
template <typename AType, typename Func>
|
||||
inline void igl::for_each(
|
||||
const Eigen::SparseMatrix<AType> & A,
|
||||
const Func & func)
|
||||
{
|
||||
// Can **not** use parallel for because this must be _in order_
|
||||
// Iterate over outside
|
||||
for(int k=0; k<A.outerSize(); ++k)
|
||||
{
|
||||
// Iterate over inside
|
||||
for(typename Eigen::SparseMatrix<AType>::InnerIterator it (A,k); it; ++it)
|
||||
{
|
||||
func(it.row(),it.col(),it.value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename DerivedA, typename Func>
|
||||
inline void igl::for_each(
|
||||
const Eigen::DenseBase<DerivedA> & A,
|
||||
const Func & func)
|
||||
{
|
||||
// Can **not** use parallel for because this must be _in order_
|
||||
if(A.IsRowMajor)
|
||||
{
|
||||
for(typename DerivedA::Index i = 0;i<A.rows();i++)
|
||||
{
|
||||
for(typename DerivedA::Index j = 0;j<A.cols();j++)
|
||||
{
|
||||
func(i,j,A(i,j));
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
for(typename DerivedA::Index j = 0;j<A.cols();j++)
|
||||
{
|
||||
for(typename DerivedA::Index i = 0;i<A.rows();i++)
|
||||
{
|
||||
func(i,j,A(i,j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//#ifndef IGL_STATIC_LIBRARY
|
||||
//# include "for_each.cpp"
|
||||
//#endif
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue