1 """ ContClass stores continuation curves for a specified model.
2
3 Drew LaMar, March 2006
4 """
5
6 from Continuation import EquilibriumCurve, FoldCurve, HopfCurveOne, HopfCurveTwo, \
7 FixedPointCurve, LimitCycleCurve, UserDefinedCurve
8 from misc import *
9 from Plotting import pargs, initializeDisplay
10
11 from PyDSTool.Model import Model, findTrajInitiator
12 from PyDSTool.Generator import Generator
13 from PyDSTool.ModelConstructor import embed
14 from PyDSTool import Point, Pointset
15 from PyDSTool.common import pickle, Utility, args, filteredDict
16 from PyDSTool.utils import remain
17 import PyDSTool.Redirector as redirc
18 from PyDSTool.errors import *
19 from PyDSTool.matplotlib_import import *
20
21 from numpy import dot as matrixmultiply
22 from numpy import array, float, complex, int, float64, complex64, int32, \
23 zeros, divide, subtract, Inf, NaN, isfinite, r_, c_, sign, mod, mat, \
24 subtract, divide, transpose, eye, real, imag, all, ndarray
25 from numpy import get_numarray_include, get_include
26
27 from PyDSTool.parseUtils import addArgToCalls, wrapArgInCall
28 from PyDSTool.utils import distutil_destination
29 from numpy.distutils.core import setup, Extension
30 from distutils.sysconfig import get_python_inc
31 import scipy
32 import scipy.io as io
33 import os, platform, shutil, sys
34 from PyDSTool import __path__ as _pydstool_path
35
36
37 _pydstool_path = _pydstool_path[0]
38
39 _classes = ['ContClass']
40
41 _constants = ['curve_list', 'curve_args_list', 'auto_list']
42
43 __all__ = _classes + _constants
44
45
46 rout = redirc.Redirector(redirc.STDOUT)
47 rerr = redirc.Redirector(redirc.STDERR)
48
49 curve_list = {'EP-C': EquilibriumCurve, 'LP-C': FoldCurve,
50 'H-C1': HopfCurveOne, 'H-C2': HopfCurveTwo,
51 'FP-C': FixedPointCurve, 'LC-C': LimitCycleCurve,
52 'UD-C': UserDefinedCurve}
53
54 curve_args_list = ['verbosity']
55
56 auto_list = ['LC-C']
57
58
59
61 """Stores continuation curves for a specified model."""
62
63 curve_list = curve_list
64 curve_args_list = curve_args_list
65 auto_list = auto_list
66
68 if isinstance(model, Generator):
69 self.model = embed(model, make_copy=False)
70 self.gensys = self.model.registry.values()[0]
71 else:
72 self.model = model
73 mi, swRules, globalConRules, nextModelName, reused, \
74 epochStateMaps, notDone = model._findTrajInitiator(None,
75 0, 0, self.model.icdict, None, None)
76 self.gensys = mi.model
77 self._autoMod = None
78 self.curves = {}
79 self.plot = pargs()
80
82 try:
83 return self.curves[name]
84 except:
85 raise KeyError('No curve named ' + str(name))
86
88 return name in self.curves
89
91 pickledself = pickle.dumps(self)
92 return pickle.loads(pickledself)
93
95 pickledself = pickle.dumps(self)
96 return pickle.loads(pickledself)
97
99 try:
100 del self.curves[curvename]
101 except KeyError:
102 raise KeyError("Curve %s does not exist" % curvename)
103
105 """Create new curve with arguments specified in the dictionary initargs."""
106 curvetype = initargs['type'].upper()
107
108 if curvetype not in self.curve_list:
109 raise PyDSTool_TypeError(str(curvetype) + ' not an allowable curve type')
110
111
112 cname = initargs['name']
113 if 'force' in initargs:
114 if initargs['force'] and cname in self.curves:
115 del self.curves[cname]
116
117 if cname in self.curves:
118 raise ValueError('Ambiguous name field: ' + cname \
119 + ' already exists (use force=True to override)')
120
121
122 if (curvetype != 'UD-C' and self.model.pars == {}) or \
123 (curvetype == 'UD-C' and not initargs.has_key('userpars')):
124 raise ValueError('No parameters defined for this system!')
125
126
127 initargs = initargs.copy()
128 if 'initpoint' not in initargs or initargs['initpoint'] is None:
129
130 if self.model.icdict == {}:
131 raise ValueError('No initial point defined for this system!')
132 elif initargs.has_key('uservars'):
133 if remain(initargs['uservars'], self.model.icdict.keys()) == []:
134
135 initargs['initpoint'] = filteredDict(self.model.icdict,
136 initargs['uservars'])
137 else:
138 raise ValueError('No initial point defined for this system!')
139 else:
140 initargs['initpoint'] = self.model.icdict.copy()
141
142
143 else:
144 if isinstance(initargs['initpoint'], dict):
145 initargs['initpoint'] = initargs['initpoint'].copy()
146
147
148
149 elif isinstance(initargs['initpoint'], str):
150 curvename, pointname = initargs['initpoint'].split(':')
151 pointtype = pointname.strip('0123456789')
152 if not self.curves.has_key(curvename):
153 raise KeyError('No curve of name ' + curvename + ' exists.')
154 else:
155 point = self.curves[curvename].getSpecialPoint(pointtype, pointname)
156 if point is None:
157 raise KeyError('No point of name ' + pointname + ' exists.')
158 else:
159 initargs['initpoint'] = point
160
161
162 if isinstance(initargs['initpoint'], Point):
163
164
165 for v in initargs['initpoint'].labels.itervalues():
166 if v.has_key('cycle'):
167 initargs['initcycle'] = v
168
169
170 initargs['initpoint'] = initargs['initpoint'].copy().todict()
171
172
173
174
175
176 if 'initcycle' in initargs:
177 if isinstance(initargs['initcycle'], ndarray):
178 c0 = {}
179 c0['data'] = args(V = {'udotps': None, 'rldot': None})
180 c0['cycle'] = Pointset({'coordnames': self.gensys.funcspec.vars,
181 'coordarray': initargs['initcycle'][1:,:].copy(),
182 'indepvarname': 't',
183 'indepvararray': initargs['initcycle'][0,:].copy()
184 })
185 initargs['initcycle'] = c0
186 elif isinstance(initargs['initcycle'], Pointset):
187 c0 = {}
188 c0['data'] = args(V = {'udotps': None, 'rldot': None})
189 c0['cycle'] = initargs['initcycle']
190 initargs['initcycle'] = c0
191
192
193 automod = None
194 if curvetype in auto_list:
195 if self._autoMod is None:
196 self.loadAutoMod()
197 automod = self._autoMod
198
199 self.curves[cname] = self.curve_list[curvetype](self.model, self.gensys, automod, self.plot, initargs)
200
201
203
204 if not filename:
205 filename = self.model.name + '.mat'
206
207 savedict = {}
208
209 print self.__dict__['curves'].keys()
210
211 for name in self.__dict__['curves'].keys():
212 if self[name].curvetype not in ['EP-C', 'LC-C']:
213 print "Can't save curve type", self[name].curvetype, "yet. (", name, ")"
214 continue
215
216 else:
217 curve = self[name].sol
218 N = len(curve)
219
220 if self[name].curvetype == 'EP-C':
221 label = 'EP'
222 elif self[name].curvetype == 'LC-C':
223 label = 'LC'
224
225
226
227 for key in curve.coordnames:
228 savedict[name+'_'+key] = array(curve[key])
229
230
231 if 'stab' in curve[0].labels[label].keys():
232 savedict[name+'_stab'] = [curve[x].labels[label]['stab'] for x in range(N)]
233 temp = zeros(N)
234 for x in range(N):
235 if savedict[name+'_stab'][x] == 'S':
236 temp[x] = -1
237 elif savedict[name+'_stab'][x] == 'U':
238 temp[x] = 1
239 savedict[name+'_stab'] = array(temp)
240
241
242 if 'domain' in curve[0].labels[label].keys():
243 savedict[name+'_domain'] = [curve[x].labels[label]['domain'] for x in range(N)]
244 temp = zeros(N)
245 for x in range(N):
246 if savedict[name+'_domain'][x] == 'inside':
247 temp[x] = -1
248 elif savedict[name+'_domain'][x] == 'outside':
249 temp[x] = 1
250 savedict[name+'_domain'] = array(temp)
251
252
253 if 'data' in curve[0].labels[label].keys():
254
255 if 'evals' in curve[0].labels[label]['data'].keys():
256 dim = len(curve[0].labels[label]['data']['evals'])
257 evltmp = [[] for x in range(dim)]
258 for x in range(dim):
259 evltmp[x] = array([curve[y].labels[label]['data']['evals'][x] for y in range(N)])
260 savedict[name+'_evals'] = array(evltmp)
261
262
263 if 'ds' in curve[0].labels[label]['data'].keys():
264 savedict[name+'_ds'] = array([curve[y].labels[label]['data']['ds'] for y in range(N)])
265
266
267 if 'evecs' in curve[0].labels[label]['data'].keys():
268
269 dim = len(curve[0].labels[label]['data']['evecs'][0])
270 evectmp = []
271 for x in range(dim):
272 for y in range(dim):
273 evectmp.append(array([curve[z].labels[label]['data']['evecs'][x][y] for z in range(N)]))
274 savedict[name+'_evecs'] = array(evectmp)
275
276
277 if 'V' in curve[0].labels[label]['data'].keys():
278 for key in curve[0].labels[label]['data']['V'].keys():
279 savedict[name+'_V_'+key] = array([curve[x].labels[label]['data']['V'][key] for x in range(N)])
280
281
282 io.savemat(filename, savedict)
283
284
286 if coords is not None and len(coords) == 3:
287 GeomviewOutput = "(progn (geometry " + self.model.name + " { LIST {: axes_" + self.model.name + "}"
288 for cname, curve in self.curves.iteritems():
289 GeomviewOutput += " {: " + cname + "}"
290 GeomviewOutput += "}))\n\n"
291
292
293 alim = [[Inf,-Inf],[Inf,-Inf],[Inf,-Inf]]
294 for cname, curve in self.curves.iteritems():
295 for n in range(len(coords)):
296 alim[n][0] = min(alim[n][0], min(curve.sol[coords[n]].toarray()))
297 alim[n][1] = max(alim[n][1], max(curve.sol[coords[n]].toarray()))
298
299 GeomviewOutput += "(progn (hdefine geometry axes_" + self.model.name + " { appearance { linewidth 2 } SKEL 4 3 " + \
300 "0 0 0 1 0 0 0 1 0 0 0 1 " + \
301 "2 0 1 1 0 0 1 2 0 2 0 1 0 1 2 0 3 0 0 1 1})\n\n"
302
303 for cname, curve in self.curves.iteritems():
304 GeomviewOutput += "(hdefine geometry " + cname + " { LIST {: curve_" + cname + "} {: specpts_" + cname + "}})\n\n"
305
306 GeomviewOutput += "(hdefine geometry curve_" + cname + " { appearance { linewidth 2 } SKEL " + \
307 repr(len(curve.sol)) + " " + repr(len(curve.sol)-1)
308 for n in range(len(curve.sol)):
309 GeomviewOutput += " " + repr((curve.sol[n][coords[0]]-alim[0][0])/(alim[0][1]-alim[0][0])) + \
310 " " + repr((curve.sol[n][coords[1]]-alim[1][0])/(alim[1][1]-alim[1][0])) + \
311 " " + repr((curve.sol[n][coords[2]]-alim[2][0])/(alim[2][1]-alim[2][0]))
312 for n in range(len(curve.sol)-1):
313 GeomviewOutput += " 2 " + repr(n) + " " + repr(n+1) + " 0 0 0 1"
314
315 GeomviewOutput += "})\n\n"
316
317 GeomviewOutput += ")\n"
318
319 f = open(filename, "w")
320 f.write(GeomviewOutput)
321 f.close()
322 else:
323 raise Warning("Coordinates not specified or not of correct dimension.")
324
325 - def display(self, coords=None, curves=None, figure=None, axes=None, stability=False, domain=False, **plot_args):
326 """Plot all curves in coordinates specified by coords.
327
328 Inputs:
329
330 coords -- pair of coordinates (None defaults to the first free
331 parameter and the first state variable).
332 Use a 3-tuple to export to geomview.
333 """
334 if coords is not None and len(coords) == 3:
335 self.exportGeomview(coords)
336 return
337
338 if curves is None:
339 curves = self.curves.keys()
340
341 plot_curves = []
342 for curve in curves:
343 if self.curves.has_key(curve):
344 plot_curves.append(curve)
345 else:
346 print "Warning: Curve " + curve + " does not exist."
347
348 if len(plot_curves) > 0:
349 initializeDisplay(self.plot, figure=figure, axes=axes)
350
351 for curve in plot_curves:
352 self.curves[curve].display(coords, figure=figure, axes=axes, stability=stability, domain=domain, init_display=False, **plot_args)
353
357
359 print self.__repr__()
360
361
362 print "Containing curves: "
363 for c in self.curves:
364 print " " + c + " (type " + self.curves[c].curvetype + ")"
365
374
376 thisplatform = platform.system()
377 if thisplatform == 'Windows':
378 self._dllext = ".pyd"
379 elif thisplatform in ['Linux', 'IRIX', 'Solaris', 'SunOS', 'Darwin']:
380 self._dllext = '.so'
381 else:
382 print "Shared library extension not tested on this platform."
383 print "If this process fails please report the errors to the"
384 print "developers."
385 self._dllext = '.so'
386
387 self._compilation_tempdir = os.path.join(os.getcwd(),
388 "auto_temp")
389 if not os.path.isdir(self._compilation_tempdir):
390 try:
391 assert not os.path.isfile(self._compilation_tempdir), \
392 "A file already exists with the same name"
393 os.mkdir(self._compilation_tempdir)
394 except:
395 print "Could not create compilation temp directory " + \
396 self._compilation_tempdir
397 raise
398 self._compilation_sourcedir = os.path.join(_pydstool_path,"PyCont/auto/module")
399 self._vf_file = self.gensys.name+"_vf.c"
400 self._vf_filename_ext = "_"+self._vf_file[:-2]
401 if not (os.path.isfile(os.path.join(os.getcwd(),
402 "auto"+self._vf_filename_ext+".py")) and \
403 os.path.isfile(os.path.join(os.getcwd(),
404 "_auto"+self._vf_filename_ext+self._dllext))):
405 if True:
406 self.funcspec = self.gensys.funcspec.recreate('c')
407 self.makeAutoLibSource()
408 self.compileAutoLib()
409 else:
410 print "Build the library using the makeLib method, or in "
411 print "stages using the makeLibSource and compileLib methods."
412
413 try:
414 self._autoMod = __import__("auto"+self._vf_filename_ext, globals())
415 except:
416 print "Error loading auto module."
417 raise
418
420 """forceAutoLibRefresh should be called after event contents are changed,
421 or alterations are made to the right-hand side of the ODEs.
422
423 Currently this function does NOT work!"""
424
425
426 delfiles = True
427 try:
428 del(sys.modules["_auto"+self._vf_filename_ext])
429 del(sys.modules["auto"+self._vf_filename_ext])
430 except NameError:
431
432 delfiles = False
433 if delfiles:
434 gc.collect()
435
436 print "Cannot rebuild library without restarting session. Sorry."
437 print "Try asking the Python developers to make a working module"
438 print "unimport function!"
439
440 - def makeAutoLib(self, libsources=[], libdirs=[], include=[]):
441 """makeAutoLib calls makeAutoLibSource and then the compileAutoLib method.
442 To postpone compilation of the source to a DLL, call makeAutoLibSource()
443 separately."""
444 self.makeAutoLibSource(include)
445 self.compileAutoLib(libsources, libdirs)
446
448 """makeAutoLibSource generates the C source for the vector field specification.
449 It should be called only once per vector field."""
450
451
452 assert isinstance(include, list), "includes must be in form of a list"
453
454 STDLIB = 0
455 USERLIB = 1
456 libinclude = dict([('math.h', STDLIB), ('stdio.h', STDLIB), ('stdlib.h', STDLIB),
457 ('string.h', STDLIB), ('autovfield.h', USERLIB),
458 ('auto_c.h', USERLIB)])
459 include_str = '#include "auto_f2c.h"\n'
460 for libstr, libtype in libinclude.iteritems():
461 if libtype == STDLIB:
462 quoteleft = '<'
463 quoteright = '>'
464 else:
465 quoteleft = '"'
466 quoteright = '"'
467 include_str += "#include " + quoteleft + libstr + quoteright + "\n"
468 if include != []:
469 assert isUniqueSeq(include), "list of library includes must not contain repeats"
470 for libstr in include:
471 if libstr in libinclude:
472
473 print "Warning: library '" + libstr + "' already appears in list"\
474 + " of imported libraries"
475 else:
476 include_str += "#include " + '"' + libstr + '"\n'
477
478
479
480 define_str = ""
481
482 allfilestr = "/* Vector field and other functions for Auto continuer.\n " \
483 + " This code was automatically generated by PyDSTool, but may be modified " \
484 + "by hand. */\n\n" + include_str + define_str + """
485 double *gICs;
486 double **gBds;
487 double globalt0;
488
489 static double pi = 3.1415926535897931;
490
491 """
492 pardefines = ""
493
494 vardefines = ""
495
496 inpdefines = ""
497
498
499 vnames = self.gensys._var_ixmap
500 pnames = self.funcspec.pars
501 inames = self.funcspec.inputs
502 pnames.sort()
503 inames.sort()
504 for i in xrange(self.gensys.numpars):
505 p = pnames[i]
506
507 if (i < 10):
508 pardefines += self.funcspec._defstr+" "+p+"\tp_["+str(i)+"]\n"
509 elif (i >= 10):
510 pardefines += self.funcspec._defstr+" "+p+"\tp_["+str(i+40)+"]\n"
511
512 pardefines += self.funcspec._defstr+" _T\tp_[10]\n"
513 for i in xrange(self.gensys.dimension):
514 v = vnames[i]
515
516 vardefines += self.funcspec._defstr+" "+v+"\tY_["+str(i)+"]\n"
517
518
519 for i in xrange(len(self.funcspec.inputs)):
520 inp = inames[i]
521
522 inpdefines += self.funcspec._defstr+" "+inp+"\txv_["+str(i)+"]\n"
523
524
525 allfilestr += "\n/* Variable, parameter, and input definitions: */ \n" \
526 + pardefines + vardefines + inpdefines + "\n"
527
528 if self.funcspec.auxfns:
529 allfilestr += "\n"
530 for finfo in self.funcspec.auxfns.values():
531 allfilestr += finfo[1] + ";\n"
532 allfilestr += "\nvoid auxvars(unsigned, unsigned, double, double*, double*, " \
533 + "double*, unsigned, double*, unsigned, double*);\n" \
534 + """void jacobian(unsigned, unsigned, double, double*, double*, double**, unsigned, double*, unsigned, double*);
535 void jacobianParam(unsigned, unsigned, double, double*, double*, double**, unsigned, double*, unsigned, double*);
536 """
537 if self.funcspec.auxvars == []:
538 allfilestr += "int N_AUXVARS = 0;\n\n\n"
539 else:
540 allfilestr += "int N_AUXVARS = " + str(len(self.funcspec.auxvars)) \
541 + ";\n\n\n"
542 allfilestr += self.funcspec.spec[0] + "\n\n"
543
544 if self.funcspec.auxfns:
545 for fname, finfo in self.funcspec.auxfns.iteritems():
546 fbody = finfo[0]
547
548 fbody_parsed = addArgToCalls(fbody,
549 self.funcspec.auxfns.keys(),
550 "p_, wk_, xv_", notFirst=fname)
551 if 'initcond' in self.funcspec.auxfns:
552
553
554
555 fbody_parsed = wrapArgInCall(fbody_parsed,
556 'initcond', '"', notFirst=True)
557 allfilestr += "\n" + fbody_parsed + "\n\n"
558
559
560 allfilestr += self.funcspec.auxspec[0]
561
562 if not self.gensys.haveJacobian():
563 allfilestr += """
564 void jacobian(unsigned n_, unsigned np_, double t, double *Y_, double *p_, double **f_, unsigned wkn_, double *wk_, unsigned xvn_, double *xv_) {
565 }
566 """
567 if not self.gensys.haveJacobian_pars():
568 allfilestr += """
569 void jacobianParam(unsigned n_, unsigned np_, double t, double *Y_, double *p_, double **f_, unsigned wkn_, double *wk_, unsigned xvn_, double *xv_) {
570 }
571 """
572
573 vffile = os.path.join(self._compilation_tempdir, self._vf_file)
574 try:
575 file = open(vffile, 'w')
576
577
578
579 file.write(allfilestr)
580 file.close()
581 except IOError, e:
582 print "Error opening file "+self._vf_file+" for writing"
583 raise IOError, e
584
586 """compileAutoLib generates a python extension DLL with continuer and vector
587 field compiled and linked.
588
589 libsources list allows additional library sources to be linked.
590 libdirs list allows additional directories to be searched for
591 precompiled libraries."""
592
593 if os.path.isfile(os.path.join(os.getcwd(),
594 "_auto"+self._vf_filename_ext+self._dllext)):
595
596
597 proceed = False
598 print "\n"
599 print "-----------------------------------------------------------"
600 print "Present limitation of Python: Cannot rebuild library"
601 print "without exiting Python and deleting the shared library"
602 print " " + str(os.path.join(os.getcwd(),
603 "_auto"+self._vf_filename_ext+self._dllext))
604 print "by hand! If you made any changes to the system you should"
605 print "not proceed with running the integrator until you quit"
606 print "and rebuild."
607 print "-----------------------------------------------------------"
608 print "\n"
609 else:
610 proceed = True
611 if not proceed:
612 print "Did not compile shared library."
613 return
614 if self._autoMod is not None:
615 self.forceAutoLibRefresh()
616 vffile = os.path.join(self._compilation_tempdir, self._vf_file)
617 try:
618 ifacefile_orig = open(os.path.join(self._compilation_sourcedir,
619 "automod.i"), 'r')
620 ifacefile_copy = open(os.path.join(self._compilation_tempdir,
621 "auto_"+self._vf_file[:-2]+".i"), 'w')
622 firstline = ifacefile_orig.readline()
623 ifacefile_copy.write('%module auto_'+self._vf_file[:-2]+'\n')
624 iffilestr = ifacefile_orig.read()
625 ifacefile_copy.write(iffilestr)
626 ifacefile_orig.close()
627 ifacefile_copy.close()
628 except IOError:
629 print "automod.i copying error in auto compilation directory"
630 raise
631
632 swigfile = os.path.join(self._compilation_tempdir,
633 "auto"+self._vf_filename_ext+".i")
634 automodfile = os.path.join(self._compilation_sourcedir, "automod.c")
635 interfacefile = os.path.join(self._compilation_sourcedir, "interface.c")
636
637
638 if not (all([os.path.isfile(os.path.join(self._compilation_tempdir,
639 sf)) for sf in ['auto'+self._vf_filename_ext+'_wrap.o',
640 'auto'+self._vf_filename_ext+'.py',
641 '_auto'+self._vf_filename_ext+'.def']])):
642 modfilelist = [swigfile]
643 else:
644 modfilelist = []
645
646 modfilelist.extend([os.path.join(self._compilation_sourcedir, "../src/"+x) \
647 for x in ['auto.c','autlib1.c','autlib2.c','autlib3.c','autlib4.c','autlib5.c', \
648 'eispack.c', 'conpar.c','setubv.c','reduce.c','dmatrix.c','fcon.c','libf2c/cabs.c','libf2c/d_lg10.c', \
649 'libf2c/i_nint.c','libf2c/pow_di.c','libf2c/r_lg10.c','libf2c/z_exp.c','libf2c/d_imag.c', \
650 'libf2c/d_sign.c','libf2c/i_dnnt.c','libf2c/pow_dd.c','libf2c/pow_ii.c','libf2c/z_abs.c', \
651 'libf2c/z_log.c']])
652
653 modfilelist.extend([automodfile, interfacefile, vffile])
654
655
656
657
658 script_args = ['-q', 'build', '--build-lib=.',
659 '-tauto_temp',
660 '--build-base=auto_temp']
661 if self.gensys._compiler != '':
662 script_args.append('-c'+str(self.gensys._compiler))
663
664
665 narraydir = get_numarray_include()
666 npydir = get_include()
667
668 incdirs = [narraydir, npydir, os.getcwd(), os.path.join(self._compilation_sourcedir,"include"),
669 self._compilation_tempdir, os.path.join(_pydstool_path,"PyCont/auto/src/include")]
670 incdirs.extend(libdirs)
671
672
673
674
675
676
677
678 rout.start()
679 try:
680 distobject = setup(name = "Auto 2000 continuer",
681 author = "PyDSTool (automatically generated)",
682 script_args = script_args,
683 ext_modules = [Extension("_auto"+self._vf_filename_ext,
684 sources=modfilelist,
685 include_dirs=incdirs,
686 extra_compile_args=['-w', '-D__PYTHON__', '-std=c99', '-m32'],
687 extra_link_args=['-w', '-m32'],
688 library_dirs=libdirs+['./'],
689 libraries=libsources)])
690 except:
691 print "\nError occurred in generating Auto system..."
692 print sys.exc_info()[0], sys.exc_info()[1]
693 raise RuntimeError
694 rout.stop()
695 try:
696
697 distdestdir = distutil_destination()
698 if swigfile in modfilelist or not \
699 os.path.isfile(os.path.join(self._compilation_tempdir,
700 "auto"+self._vf_filename_ext+".py")):
701 shutil.move(os.path.join(os.getcwd(),
702 self._compilation_tempdir, distdestdir,
703 "auto_temp",
704 "auto"+self._vf_filename_ext+".py"),
705 os.path.join(os.getcwd(),
706 "auto"+self._vf_filename_ext+".py"))
707 except:
708 print "\nError occurred in generating Auto system"
709 print "(while moving library extension modules to CWD)"
710 print sys.exc_info()[0], sys.exc_info()[1]
711 raise RuntimeError
712
714 return 'ContClass of model %s'%self.model.name
715
716 __str__ = __repr__
717