[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38583] branches/soc-2011-avocado/blender/ intern/autoseam: Fixing linkage issues by compiling and linking the sample code as C code, not C++ code.
Andrea Weikert
elubie at gmx.net
Thu Jul 21 22:12:10 CEST 2011
Revision: 38583
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38583
Author: elubie
Date: 2011-07-21 20:12:09 +0000 (Thu, 21 Jul 2011)
Log Message:
-----------
Fixing linkage issues by compiling and linking the sample code as C code, not C++ code.
Only add sample code if WITH_ARPACK is configured.
Code should now use #ifdef WITH_ARPACK around code calling the ARPACK routines.
(Worked this out together with Shuvro on IRC)
Modified Paths:
--------------
branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp
branches/soc-2011-avocado/blender/intern/autoseam/CMakeLists.txt
Added Paths:
-----------
branches/soc-2011-avocado/blender/intern/autoseam/dssimp.c
branches/soc-2011-avocado/blender/intern/autoseam/dssimp.h
Removed Paths:
-------------
branches/soc-2011-avocado/blender/intern/autoseam/dssimp.cpp
Modified: branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp 2011-07-21 19:15:31 UTC (rev 38582)
+++ branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp 2011-07-21 20:12:09 UTC (rev 38583)
@@ -31,6 +31,10 @@
#include "BKE_report.h"
#include "AutoseamAdjacency.h"
+#ifdef WITH_ARPACK
+#include "dssimp.h"
+#endif
+
#define THRESHOLD_ZERO 0.0005
AutoseamAdjacency::AutoseamAdjacency(int dimension)
{
@@ -121,6 +125,10 @@
a(i,i) = -rowsum;
}
+#ifdef WITH_ARPACK
+ // small test to call ARPACK
+ dssimp_();
+#endif
if(a.rows() && a.cols()){
Eigen::SelfAdjointEigenSolver<MatrixXd> es(a);
Modified: branches/soc-2011-avocado/blender/intern/autoseam/CMakeLists.txt
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/CMakeLists.txt 2011-07-21 19:15:31 UTC (rev 38582)
+++ branches/soc-2011-avocado/blender/intern/autoseam/CMakeLists.txt 2011-07-21 20:12:09 UTC (rev 38583)
@@ -37,7 +37,7 @@
../guardedalloc
)
-set(SRC
+set(SRC_AUTOSEAM_CORE
AutoseamUtility.cpp
autoseam_C_API.cpp
AutoseamUtility.h
@@ -46,7 +46,23 @@
AutoseamEigenspace.cpp
AutoseamAdjacency.h
AutoseamAdjacency.cpp
- dssimp.cpp
)
+set (SRC_AUTOSEAM_ARPACK
+ dssimp.c
+ dssimp.h
+)
+
+if (WITH_ARPACK)
+ set(SRC
+ ${SRC_AUTOSEAM_CORE}
+ ${SRC_AUTOSEAM_ARPACK}
+ )
+ add_definitions(-DWITH_ARPACK)
+else()
+ set(SRC
+ ${SRC_AUTOSEAM_CORE}
+ )
+endif()
+
blender_add_lib(bf_intern_autoseam "${SRC}" "${INC}" "${INC_SYS}")
Copied: branches/soc-2011-avocado/blender/intern/autoseam/dssimp.c (from rev 38582, branches/soc-2011-avocado/blender/intern/autoseam/dssimp.cpp)
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/dssimp.c (rev 0)
+++ branches/soc-2011-avocado/blender/intern/autoseam/dssimp.c 2011-07-21 20:12:09 UTC (rev 38583)
@@ -0,0 +1,756 @@
+/* dssimp.f -- translated by f2c (version 20100827).
+ You must link the resulting object file with libf2c:
+ on Microsoft Windows system, link with libf2c.lib;
+ on Linux or Unix systems, link with .../path/to/libf2c.a -lm
+ or, if you install libf2c.a in a standard place, with -lf2c -lm
+ -- in that order, at the end of the command line, as in
+ cc *.o -lf2c -lm
+ Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
+
+ http://www.netlib.org/f2c/libf2c.zip
+*/
+
+#include "f2c.h"
+#include "carpack.h"
+
+/* Common Block Declarations */
+
+struct {
+ integer logfil, ndigit, mgetv0, msaupd, msaup2, msaitr, mseigt, msapps,
+ msgets, mseupd, mnaupd, mnaup2, mnaitr, mneigh, mnapps, mngets,
+ mneupd, mcaupd, mcaup2, mcaitr, mceigh, mcapps, mcgets, mceupd;
+} debug_;
+
+#define debug_1 debug_
+
+/* Table of constant values */
+
+static integer c__9 = 9;
+static integer c__1 = 1;
+static integer c__256 = 256;
+static integer c__3 = 3;
+static integer c__6 = 6;
+static integer c__2 = 2;
+static integer c__25 = 25;
+static integer c_n6 = -6;
+static integer c__5 = 5;
+static doublereal c_b138 = -1.;
+
+/* Main program */ int MAIN__(void)
+{
+ /* System generated locals */
+ integer i__1;
+ doublereal d__1;
+
+ /* Builtin functions */
+ /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
+ integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen),
+ e_wsle(void);
+
+ /* Local variables */
+ static doublereal d__[50] /* was [25][2] */;
+ static integer j, n;
+ static doublereal v[6400] /* was [256][25] */;
+ extern /* Subroutine */ int av_(integer *, doublereal *, doublereal *);
+ static doublereal ax[256];
+ static integer nx, ido, ncv, nev;
+ static doublereal tol;
+ static char bmat[1];
+ static integer info;
+ static logical rvec;
+ static integer ierr, mode1;
+ extern doublereal dnrm2_(integer *, doublereal *, integer *);
+ static doublereal sigma;
+ static char which[2];
+ static doublereal resid[256];
+ static integer nconv;
+ extern /* Subroutine */ int daxpy_(integer *, doublereal *, doublereal *,
+ integer *, doublereal *, integer *);
+ static doublereal workd[768];
+ extern /* Subroutine */ int dmout_(integer *, integer *, integer *,
+ doublereal *, integer *, integer *, char *, ftnlen);
+ static integer ipntr[11];
+ static doublereal workl[825];
+ static integer iparam[11];
+ static logical select[25];
+ extern /* Subroutine */ int dsaupd_(integer *, char *, integer *, char *,
+ integer *, doublereal *, doublereal *, integer *, doublereal *,
+ integer *, integer *, integer *, doublereal *, doublereal *,
+ integer *, integer *, ftnlen, ftnlen), dseupd_(logical *, char *,
+ logical *, doublereal *, doublereal *, integer *, doublereal *,
+ char *, integer *, char *, integer *, doublereal *, doublereal *,
+ integer *, doublereal *, integer *, integer *, integer *,
+ doublereal *, doublereal *, integer *, integer *, ftnlen, ftnlen,
+ ftnlen);
+ static integer ishfts, maxitr, lworkl;
+
+ /* Fortran I/O blocks */
+ static cilist io___7 = { 0, 6, 0, 0, 0 };
+ static cilist io___8 = { 0, 6, 0, 0, 0 };
+ static cilist io___9 = { 0, 6, 0, 0, 0 };
+ static cilist io___23 = { 0, 6, 0, 0, 0 };
+ static cilist io___24 = { 0, 6, 0, 0, 0 };
+ static cilist io___25 = { 0, 6, 0, 0, 0 };
+ static cilist io___26 = { 0, 6, 0, 0, 0 };
+ static cilist io___32 = { 0, 6, 0, 0, 0 };
+ static cilist io___33 = { 0, 6, 0, 0, 0 };
+ static cilist io___34 = { 0, 6, 0, 0, 0 };
+ static cilist io___35 = { 0, 6, 0, 0, 0 };
+ static cilist io___39 = { 0, 6, 0, 0, 0 };
+ static cilist io___40 = { 0, 6, 0, 0, 0 };
+ static cilist io___41 = { 0, 6, 0, 0, 0 };
+ static cilist io___42 = { 0, 6, 0, 0, 0 };
+ static cilist io___43 = { 0, 6, 0, 0, 0 };
+ static cilist io___44 = { 0, 6, 0, 0, 0 };
+ static cilist io___45 = { 0, 6, 0, 0, 0 };
+ static cilist io___46 = { 0, 6, 0, 0, 0 };
+ static cilist io___47 = { 0, 6, 0, 0, 0 };
+ static cilist io___48 = { 0, 6, 0, 0, 0 };
+ static cilist io___49 = { 0, 6, 0, 0, 0 };
+ static cilist io___50 = { 0, 6, 0, 0, 0 };
+ static cilist io___51 = { 0, 6, 0, 0, 0 };
+ static cilist io___52 = { 0, 6, 0, 0, 0 };
+ static cilist io___53 = { 0, 6, 0, 0, 0 };
+ static cilist io___54 = { 0, 6, 0, 0, 0 };
+ static cilist io___55 = { 0, 6, 0, 0, 0 };
+ static cilist io___56 = { 0, 6, 0, 0, 0 };
+ static cilist io___57 = { 0, 6, 0, 0, 0 };
+
+
+
+/* This example program is intended to illustrate the */
+/* simplest case of using ARPACK in considerable detail. */
+/* This code may be used to understand basic usage of ARPACK */
+/* and as a template for creating an interface to ARPACK. */
+
+/* This code shows how to use ARPACK to find a few eigenvalues */
+/* (lambda) and corresponding eigenvectors (x) for the standard */
+/* eigenvalue problem: */
+
+/* A*x = lambda*x */
+
+/* where A is an n by n real symmetric matrix. */
+
+/* The main points illustrated here are */
+
+/* 1) How to declare sufficient memory to find NEV */
+/* eigenvalues of largest magnitude. Other options */
+/* are available. */
+
+/* 2) Illustration of the reverse communication interface */
+/* needed to utilize the top level ARPACK routine DSAUPD */
+/* that computes the quantities needed to construct */
+/* the desired eigenvalues and eigenvectors(if requested). */
+
+/* 3) How to extract the desired eigenvalues and eigenvectors */
+/* using the ARPACK routine DSEUPD. */
+
+/* The only thing that must be supplied in order to use this */
+/* routine on your problem is to change the array dimensions */
+/* appropriately, to specify WHICH eigenvalues you want to compute */
+/* and to supply a matrix-vector product */
+
+/* w <- Av */
+
+/* in place of the call to AV( ) below. */
+
+/* Once usage of this routine is understood, you may wish to explore */
+/* the other available options to improve convergence, to solve generalized */
+/* problems, etc. Look at the file ex-sym.doc in DOCUMENTS directory. */
+/* This codes implements */
+
+/* \Example-1 */
+/* ... Suppose we want to solve A*x = lambda*x in regular mode, */
+/* where A is derived from the central difference discretization */
+/* of the 2-dimensional Laplacian on the unit square with */
+/* zero Dirichlet boundary condition. */
+/* ... OP = A and B = I. */
+/* ... Assume "call av (n,x,y)" computes y = A*x */
+/* ... Use mode 1 of DSAUPD. */
+
+/* \BeginLib */
+
+/* \Routines called: */
+/* dsaupd ARPACK reverse communication interface routine. */
+/* dseupd ARPACK routine that returns Ritz values and (optionally) */
+/* Ritz vectors. */
+/* dnrm2 Level 1 BLAS that computes the norm of a vector. */
+/* daxpy Level 1 BLAS that computes y <- alpha*x+y. */
+
+/* \Author */
+/* Richard Lehoucq */
+/* Danny Sorensen */
+/* Chao Yang */
+/* Dept. of Computational & */
+/* Applied Mathematics */
+/* Rice University */
+/* Houston, Texas */
+
+/* \SCCS Information: @(#) */
+/* FILE: ssimp.F SID: 2.6 DATE OF SID: 10/17/00 RELEASE: 2 */
+
+/* \Remarks */
+/* 1. None */
+
+/* \EndLib */
+
+/* ----------------------------------------------------------------------- */
+
+/* %------------------------------------------------------% */
+/* | Storage Declarations: | */
+/* | | */
+/* | The maximum dimensions for all arrays are | */
+/* | set here to accommodate a problem size of | */
+/* | N .le. MAXN | */
+/* | | */
+/* | NEV is the number of eigenvalues requested. | */
+/* | See specifications for ARPACK usage below. | */
+/* | | */
+/* | NCV is the largest number of basis vectors that will | */
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list