Commit b4bccbf5 authored by unknown's avatar unknown

compil visual 2010

parent 5cc5a623
...@@ -17,6 +17,7 @@ ENDIF (${CMAKE_CURRENT_BINARY_DIR} MATCHES "(.*)Debug") ...@@ -17,6 +17,7 @@ ENDIF (${CMAKE_CURRENT_BINARY_DIR} MATCHES "(.*)Debug")
IF(WIN32) IF(WIN32)
SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib) #release added by visual SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib) #release added by visual
INCLUDE_DIRECTORIES(${CGoGN_ROOT_DIR}/windows_dependencies/include/) INCLUDE_DIRECTORIES(${CGoGN_ROOT_DIR}/windows_dependencies/include/)
INCLUDE_DIRECTORIES(${CGoGN_ROOT_DIR}/windows_dependencies/include/suitesparse)
ELSE(WIN32) ELSE(WIN32)
SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE}) SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE})
ENDIF(WIN32) ENDIF(WIN32)
......
...@@ -66,8 +66,9 @@ SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/OpenNL/CMakeModules) ...@@ -66,8 +66,9 @@ SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/OpenNL/CMakeModules)
# CHOLMOD # CHOLMOD
########### ###########
SET(USE_CHOLMOD TRUE) SET(USE_CHOLMOD TRUE)
find_package(SuiteSparse REQUIRED) IF (NOT WIN32)
find_package(SuiteSparse REQUIRED)
ENDIF (NOT WIN32)
########### ###########
# CNC # CNC
########### ###########
......
...@@ -65,23 +65,34 @@ typedef struct { ...@@ -65,23 +65,34 @@ typedef struct {
NLboolean nlFactorize_CHOLMOD() { NLboolean nlFactorize_CHOLMOD() {
NLSparseMatrix* M;
NLuint n;
NLuint nnz;
cholmod_sparse* cA;
NLRowColumn* Ci;
cholmod_context* context;
NLuint i,j,count ;
int* colptr;
int* rowind;
double* a;
/* OpenNL Context */ /* OpenNL Context */
NLSparseMatrix* M = &(nlCurrentContext->M) ; M = &(nlCurrentContext->M) ;
NLuint n = nlCurrentContext->n ; n = nlCurrentContext->n ;
NLuint nnz = nlSparseMatrixNNZ(M) ; /* Number of Non-Zero coeffs */ nnz = nlSparseMatrixNNZ(M) ; /* Number of Non-Zero coeffs */
cholmod_context* context = (cholmod_context*)(nlCurrentContext->direct_solver_context) ; context = (cholmod_context*)(nlCurrentContext->direct_solver_context) ;
if(context == NULL) { if(context == NULL) {
nlCurrentContext->direct_solver_context = malloc(sizeof(cholmod_context)) ; nlCurrentContext->direct_solver_context = malloc(sizeof(cholmod_context)) ;
context = (cholmod_context*)(nlCurrentContext->direct_solver_context) ; context = (cholmod_context*)(nlCurrentContext->direct_solver_context) ;
} }
/* CHOLMOD variables */ /* CHOLMOD variables */
cholmod_sparse* cA = NULL ; cA = NULL ;
/* Temporary variables */ /* Temporary variables */
NLRowColumn* Ci = NULL ; Ci = NULL ;
NLuint i,j,count ;
/* Sanity checks */ /* Sanity checks */
nl_assert(M->storage & NL_MATRIX_STORE_COLUMNS) ; nl_assert(M->storage & NL_MATRIX_STORE_COLUMNS) ;
...@@ -95,9 +106,9 @@ NLboolean nlFactorize_CHOLMOD() { ...@@ -95,9 +106,9 @@ NLboolean nlFactorize_CHOLMOD() {
*/ */
cA = cholmod_allocate_sparse(n, n, nnz, NL_FALSE, NL_TRUE, -1, CHOLMOD_REAL, &(context->c)) ; cA = cholmod_allocate_sparse(n, n, nnz, NL_FALSE, NL_TRUE, -1, CHOLMOD_REAL, &(context->c)) ;
int* colptr = (int*)(cA->p) ; colptr = (int*)(cA->p) ;
int* rowind = (int*)(cA->i) ; rowind = (int*)(cA->i) ;
double* a = (double*)(cA->x) ; a = (double*)(cA->x) ;
count = 0 ; count = 0 ;
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
...@@ -134,26 +145,33 @@ NLboolean nlFactorize_CHOLMOD() { ...@@ -134,26 +145,33 @@ NLboolean nlFactorize_CHOLMOD() {
NLboolean nlSolve_CHOLMOD() { NLboolean nlSolve_CHOLMOD() {
cholmod_dense* cx;
NLuint i ;
NLdouble* b;
NLdouble* x;
NLuint n;
/* Temporary variables */
double* cbx;
double* cxx;
cholmod_context* context;
/* OpenNL Context */ /* OpenNL Context */
NLdouble* b = nlCurrentContext->b ; b = nlCurrentContext->b ;
NLdouble* x = nlCurrentContext->x ; x = nlCurrentContext->x ;
NLuint n = nlCurrentContext->n ; n = nlCurrentContext->n ;
cholmod_context* context = (cholmod_context*)(nlCurrentContext->direct_solver_context) ; context = (cholmod_context*)(nlCurrentContext->direct_solver_context) ;
nl_assert(context != NULL) ; nl_assert(context != NULL) ;
/* CHOLMOD variables */ /* CHOLMOD variables */
cholmod_dense* cx = NULL ; cx = NULL ;
/* Temporary variables */
NLuint i ;
/* /*
* Step 1: convert right-hand side into CHOLMOD representation * Step 1: convert right-hand side into CHOLMOD representation
* ----------------------------------------------------------- * -----------------------------------------------------------
*/ */
double* cbx = (double*)(context->cb->x) ; cbx = (double*)(context->cb->x) ;
for(i = 0; i < n; i++) for(i = 0; i < n; i++)
cbx[i] = b[i] ; cbx[i] = b[i] ;
...@@ -169,7 +187,7 @@ NLboolean nlSolve_CHOLMOD() { ...@@ -169,7 +187,7 @@ NLboolean nlSolve_CHOLMOD() {
* ------------------------ * ------------------------
*/ */
double* cxx = (double*)(cx->x) ; cxx = (double*)(cx->x) ;
for(i = 0; i < n; i++) for(i = 0; i < n; i++)
x[i] = cxx[i] ; x[i] = cxx[i] ;
......
...@@ -546,7 +546,7 @@ Image<DIM,TYPE>* Image<DIM,TYPE>::scaleNearestToNewImage(const COORD& newSize) ...@@ -546,7 +546,7 @@ Image<DIM,TYPE>* Image<DIM,TYPE>::scaleNearestToNewImage(const COORD& newSize)
double p0 = inc0/2.0 - 0.5; double p0 = inc0/2.0 - 0.5;
for (unsigned int i=0; i< newSize[0]; ++i) for (unsigned int i=0; i< newSize[0]; ++i)
{ {
newImg->texel(i) = this->texel( (unsigned int)(rint(p0)) ); newImg->texel(i) = this->texel( (unsigned int)(p0+0.5) );
p0 += inc0; p0 += inc0;
} }
} }
...@@ -561,7 +561,7 @@ Image<DIM,TYPE>* Image<DIM,TYPE>::scaleNearestToNewImage(const COORD& newSize) ...@@ -561,7 +561,7 @@ Image<DIM,TYPE>* Image<DIM,TYPE>::scaleNearestToNewImage(const COORD& newSize)
double p0 = inc0/2.0 - 0.5; double p0 = inc0/2.0 - 0.5;
for (unsigned int i=0; i< newSize[0]; ++i) for (unsigned int i=0; i< newSize[0]; ++i)
{ {
newImg->texel(i,j) = this->texel( (unsigned int)(rint(p0)), (unsigned int)(rint(p1)) ); newImg->texel(i,j) = this->texel( (unsigned int)(p0+0.5), (unsigned int)(p1+0.5) );
p0 += inc0; p0 += inc0;
} }
p1 += inc1; p1 += inc1;
...@@ -582,7 +582,7 @@ Image<DIM,TYPE>* Image<DIM,TYPE>::scaleNearestToNewImage(const COORD& newSize) ...@@ -582,7 +582,7 @@ Image<DIM,TYPE>* Image<DIM,TYPE>::scaleNearestToNewImage(const COORD& newSize)
double p0 = inc0/2.0 - 0.5; double p0 = inc0/2.0 - 0.5;
for (unsigned int i=0; i< newSize[0]; ++i) for (unsigned int i=0; i< newSize[0]; ++i)
{ {
newImg->texel(i,j,k) = this->texel( (unsigned int)(rint(p0)), (unsigned int)(rint(p1)), (unsigned int)(rint(p2)) ); newImg->texel(i,j,k) = this->texel( (unsigned int)(p0+0.5), (unsigned int)(p1+0.5), (unsigned int)(p2+0.5) );
p0 += inc0; p0 += inc0;
} }
p1 += inc1; p1 += inc1;
......
...@@ -707,7 +707,7 @@ void SVGOut::write() ...@@ -707,7 +707,7 @@ void SVGOut::write()
{ {
if (m_attFact > 0.0f) if (m_attFact > 0.0f)
{ {
float da = float( pow(double(itd-vds.begin()),m_attFact) / pow(double(vds.size()),m_attFact)); float da = float( pow(double(itd-vds.begin()),double(m_attFact)) / pow(double(vds.size()),double(m_attFact)));
(*it)->m_objs[itd->obj]->saveOneDepthAttenuation(*m_out,da,itd->id, m_bbX1-m_bbX0); (*it)->m_objs[itd->obj]->saveOneDepthAttenuation(*m_out,da,itd->id, m_bbX1-m_bbX0);
} }
else else
......
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