Skip to content

Commit

Permalink
added xdress integration
Browse files Browse the repository at this point in the history
  • Loading branch information
scopatz committed Mar 24, 2013
1 parent 41e2e21 commit 0fea348
Show file tree
Hide file tree
Showing 9 changed files with 1,488 additions and 903 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ pyne/*/*.cpp
# Ignore specific files
examples/BASE_TAPE9.INP
pyne/tests/test.file
pyne/tests/test.txt
10 changes: 7 additions & 3 deletions pyne/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ include_directories(${PYNE_INCLUDE_DIRS})
get_property(inc_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
message("-- C_INCLUDE_PATH for ${CMAKE_CURRENT_SOURCE_DIR}: ${inc_dirs}")

# extra_types
set_source_files_properties(${PROJECT_SOURCE_DIR}/pyne/extra_types.pyx
PROPERTIES CYTHON_IS_CXX TRUE)
cython_add_module(extra_types extra_types.pyx)

# STL converters
# STL containers
# If the pyx file is a C++ file, we should specify that here.
# then, add the module
set_source_files_properties(${PROJECT_SOURCE_DIR}/pyne/stlconverters.pyx
set_source_files_properties(${PROJECT_SOURCE_DIR}/pyne/stlcontainers.pyx
PROPERTIES CYTHON_IS_CXX TRUE)
cython_add_module(stlconverters stlconverters.pyx)
cython_add_module(stlcontainers stlcontainers.pyx)

# jsoncpp
set_source_files_properties(${PROJECT_SOURCE_DIR}/pyne/jsoncpp.pyx
Expand Down
2 changes: 2 additions & 0 deletions pyne/extra_types.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ cdef extern from "extra_types.h" namespace "extra_types":
ctypedef struct complex_t:
double re
double im

cdef complex_t py2c_complex(object pyv)
9 changes: 9 additions & 0 deletions pyne/extra_types.pyx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cimport extra_types

cdef extra_types.complex_t py2c_complex(object pyv):
cdef extra_types.complex_t cv = extra_types.complex_t()
pyv = complex(pyv)
cv.re = pyv.real
cv.im = pyv.imag
return cv

185 changes: 66 additions & 119 deletions pyne/stlconverters.pxd → pyne/stlcontainers.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -8,77 +8,37 @@ from libcpp.set cimport set as cpp_set
from libcpp.vector cimport vector as cpp_vector
from cython.operator cimport dereference as deref
from cython.operator cimport preincrement as inc
from libcpp.string cimport string as std_string
from libcpp.utility cimport pair
from libcpp.map cimport map as cpp_map
from libcpp.vector cimport vector as cpp_vector

# Python Imports
cimport numpy as np

# Local imports
include "include/cython_version.pxi"
IF CYTHON_VERSION_MAJOR == 0 and CYTHON_VERSION_MINOR >= 17:
from libcpp.string cimport string as std_string
from libcpp.utility cimport pair
from libcpp.map cimport map as cpp_map
from libcpp.vector cimport vector as cpp_vector
ELSE:
from pyne._includes.libcpp.string cimport string as std_string
from pyne._includes.libcpp.utility cimport pair
from pyne._includes.libcpp.map cimport map as cpp_map
from pyne._includes.libcpp.vector cimport vector as cpp_vector
cimport extra_types

cimport numpy as np

cdef extra_types.complex_t py2c_complex(object)

cdef np.ndarray c2py_vector_dbl(cpp_vector[double] *)

cdef cpp_vector[double] py2c_vector_dbl(object)

# integer sets
cdef cpp_set[int] py_to_cpp_set_int(set)
cdef set cpp_to_py_set_int(cpp_set[int])


# string sets
cdef cpp_set[std_string] py_to_cpp_set_str(set)
cdef set cpp_to_py_set_str(cpp_set[std_string])


# <integer, integer> conversions
cdef cpp_map[int, int] dict_to_map_int_int(dict)
cdef dict map_to_dict_int_int(cpp_map[int, int])



# <integer, double> conversions
cdef cpp_map[int, double] dict_to_map_int_dbl(dict)
cdef dict map_to_dict_int_dbl(cpp_map[int, double])



# <string, integer> conversions
cdef cpp_map[std_string, int] dict_to_map_str_int(dict)
cdef dict map_to_dict_str_int(cpp_map[std_string, int])



# <integer, string> conversions
cdef cpp_map[int, std_string] dict_to_map_int_str(dict)
cdef dict map_to_dict_int_str(cpp_map[int, std_string])

# SetStr
cdef class _SetIterStr(object):
cdef cpp_set[std_string].iterator * iter_now
cdef cpp_set[std_string].iterator * iter_end
cdef void init(_SetIterStr, cpp_set[std_string] *)

cdef class _SetStr:
cdef cpp_set[std_string] * set_ptr
cdef public bint _free_set

# <string, double> conversions
cdef cpp_map[std_string, double] dict_to_map_str_dbl(dict)
cdef dict map_to_dict_str_dbl(cpp_map[std_string, double])



# SetInt
cdef class SetIterInt(object):
cdef class _SetIterInt(object):
cdef cpp_set[int].iterator * iter_now
cdef cpp_set[int].iterator * iter_end
cdef void init(SetIterInt, cpp_set[int] *)
cdef void init(_SetIterInt, cpp_set[int] *)

cdef class _SetInt:
cdef cpp_set[int] * set_ptr
Expand All @@ -87,24 +47,11 @@ cdef class _SetInt:



# SetStr
cdef class SetIterStr(object):
cdef cpp_set[std_string].iterator * iter_now
cdef cpp_set[std_string].iterator * iter_end
cdef void init(SetIterStr, cpp_set[std_string] *)

cdef class _SetStr:
cdef cpp_set[std_string] * set_ptr
cdef public bint _free_set




# MapStrStr
cdef class MapIterStrStr(object):
cdef class _MapIterStrStr(object):
cdef cpp_map[std_string, std_string].iterator * iter_now
cdef cpp_map[std_string, std_string].iterator * iter_end
cdef void init(MapIterStrStr, cpp_map[std_string, std_string] *)
cdef void init(_MapIterStrStr, cpp_map[std_string, std_string] *)

cdef class _MapStrStr:
cdef cpp_map[std_string, std_string] * map_ptr
Expand All @@ -114,10 +61,10 @@ cdef class _MapStrStr:


# MapStrInt
cdef class MapIterStrInt(object):
cdef class _MapIterStrInt(object):
cdef cpp_map[std_string, int].iterator * iter_now
cdef cpp_map[std_string, int].iterator * iter_end
cdef void init(MapIterStrInt, cpp_map[std_string, int] *)
cdef void init(_MapIterStrInt, cpp_map[std_string, int] *)

cdef class _MapStrInt:
cdef cpp_map[std_string, int] * map_ptr
Expand All @@ -127,10 +74,10 @@ cdef class _MapStrInt:


# MapIntStr
cdef class MapIterIntStr(object):
cdef class _MapIterIntStr(object):
cdef cpp_map[int, std_string].iterator * iter_now
cdef cpp_map[int, std_string].iterator * iter_end
cdef void init(MapIterIntStr, cpp_map[int, std_string] *)
cdef void init(_MapIterIntStr, cpp_map[int, std_string] *)

cdef class _MapIntStr:
cdef cpp_map[int, std_string] * map_ptr
Expand All @@ -140,10 +87,10 @@ cdef class _MapIntStr:


# MapStrUInt
cdef class MapIterStrUInt(object):
cdef class _MapIterStrUInt(object):
cdef cpp_map[std_string, extra_types.uint].iterator * iter_now
cdef cpp_map[std_string, extra_types.uint].iterator * iter_end
cdef void init(MapIterStrUInt, cpp_map[std_string, extra_types.uint] *)
cdef void init(_MapIterStrUInt, cpp_map[std_string, extra_types.uint] *)

cdef class _MapStrUInt:
cdef cpp_map[std_string, extra_types.uint] * map_ptr
Expand All @@ -153,10 +100,10 @@ cdef class _MapStrUInt:


# MapUIntStr
cdef class MapIterUIntStr(object):
cdef class _MapIterUIntStr(object):
cdef cpp_map[extra_types.uint, std_string].iterator * iter_now
cdef cpp_map[extra_types.uint, std_string].iterator * iter_end
cdef void init(MapIterUIntStr, cpp_map[extra_types.uint, std_string] *)
cdef void init(_MapIterUIntStr, cpp_map[extra_types.uint, std_string] *)

cdef class _MapUIntStr:
cdef cpp_map[extra_types.uint, std_string] * map_ptr
Expand All @@ -165,37 +112,37 @@ cdef class _MapUIntStr:



# MapUIntUInt
cdef class MapIterUIntUInt(object):
cdef cpp_map[extra_types.uint, extra_types.uint].iterator * iter_now
cdef cpp_map[extra_types.uint, extra_types.uint].iterator * iter_end
cdef void init(MapIterUIntUInt, cpp_map[extra_types.uint, extra_types.uint] *)
# MapStrDouble
cdef class _MapIterStrDouble(object):
cdef cpp_map[std_string, double].iterator * iter_now
cdef cpp_map[std_string, double].iterator * iter_end
cdef void init(_MapIterStrDouble, cpp_map[std_string, double] *)

cdef class _MapUIntUInt:
cdef cpp_map[extra_types.uint, extra_types.uint] * map_ptr
cdef class _MapStrDouble:
cdef cpp_map[std_string, double] * map_ptr
cdef public bint _free_map




# MapStrDouble
cdef class MapIterStrDouble(object):
cdef cpp_map[std_string, double].iterator * iter_now
cdef cpp_map[std_string, double].iterator * iter_end
cdef void init(MapIterStrDouble, cpp_map[std_string, double] *)
# MapUIntUInt
cdef class _MapIterUIntUInt(object):
cdef cpp_map[extra_types.uint, extra_types.uint].iterator * iter_now
cdef cpp_map[extra_types.uint, extra_types.uint].iterator * iter_end
cdef void init(_MapIterUIntUInt, cpp_map[extra_types.uint, extra_types.uint] *)

cdef class _MapStrDouble:
cdef cpp_map[std_string, double] * map_ptr
cdef class _MapUIntUInt:
cdef cpp_map[extra_types.uint, extra_types.uint] * map_ptr
cdef public bint _free_map




# MapIntInt
cdef class MapIterIntInt(object):
cdef class _MapIterIntInt(object):
cdef cpp_map[int, int].iterator * iter_now
cdef cpp_map[int, int].iterator * iter_end
cdef void init(MapIterIntInt, cpp_map[int, int] *)
cdef void init(_MapIterIntInt, cpp_map[int, int] *)

cdef class _MapIntInt:
cdef cpp_map[int, int] * map_ptr
Expand All @@ -205,10 +152,10 @@ cdef class _MapIntInt:


# MapIntDouble
cdef class MapIterIntDouble(object):
cdef class _MapIterIntDouble(object):
cdef cpp_map[int, double].iterator * iter_now
cdef cpp_map[int, double].iterator * iter_end
cdef void init(MapIterIntDouble, cpp_map[int, double] *)
cdef void init(_MapIterIntDouble, cpp_map[int, double] *)

cdef class _MapIntDouble:
cdef cpp_map[int, double] * map_ptr
Expand All @@ -217,24 +164,11 @@ cdef class _MapIntDouble:



# MapUIntDouble
cdef class MapIterUIntDouble(object):
cdef cpp_map[extra_types.uint, double].iterator * iter_now
cdef cpp_map[extra_types.uint, double].iterator * iter_end
cdef void init(MapIterUIntDouble, cpp_map[extra_types.uint, double] *)

cdef class _MapUIntDouble:
cdef cpp_map[extra_types.uint, double] * map_ptr
cdef public bint _free_map




# MapIntComplex
cdef class MapIterIntComplex(object):
cdef class _MapIterIntComplex(object):
cdef cpp_map[int, extra_types.complex_t].iterator * iter_now
cdef cpp_map[int, extra_types.complex_t].iterator * iter_end
cdef void init(MapIterIntComplex, cpp_map[int, extra_types.complex_t] *)
cdef void init(_MapIterIntComplex, cpp_map[int, extra_types.complex_t] *)

cdef class _MapIntComplex:
cdef cpp_map[int, extra_types.complex_t] * map_ptr
Expand All @@ -243,24 +177,24 @@ cdef class _MapIntComplex:



# MapIntVectorDouble
cdef class MapIterIntVectorDouble(object):
cdef cpp_map[int, cpp_vector[double]].iterator * iter_now
cdef cpp_map[int, cpp_vector[double]].iterator * iter_end
cdef void init(MapIterIntVectorDouble, cpp_map[int, cpp_vector[double]] *)
# MapUIntDouble
cdef class _MapIterUIntDouble(object):
cdef cpp_map[extra_types.uint, double].iterator * iter_now
cdef cpp_map[extra_types.uint, double].iterator * iter_end
cdef void init(_MapIterUIntDouble, cpp_map[extra_types.uint, double] *)

cdef class _MapIntVectorDouble:
cdef cpp_map[int, cpp_vector[double]] * map_ptr
cdef class _MapUIntDouble:
cdef cpp_map[extra_types.uint, double] * map_ptr
cdef public bint _free_map




# MapStrVectorDouble
cdef class MapIterStrVectorDouble(object):
cdef class _MapIterStrVectorDouble(object):
cdef cpp_map[std_string, cpp_vector[double]].iterator * iter_now
cdef cpp_map[std_string, cpp_vector[double]].iterator * iter_end
cdef void init(MapIterStrVectorDouble, cpp_map[std_string, cpp_vector[double]] *)
cdef void init(_MapIterStrVectorDouble, cpp_map[std_string, cpp_vector[double]] *)

cdef class _MapStrVectorDouble:
cdef cpp_map[std_string, cpp_vector[double]] * map_ptr
Expand All @@ -269,3 +203,16 @@ cdef class _MapStrVectorDouble:



# MapIntVectorDouble
cdef class _MapIterIntVectorDouble(object):
cdef cpp_map[int, cpp_vector[double]].iterator * iter_now
cdef cpp_map[int, cpp_vector[double]].iterator * iter_end
cdef void init(_MapIterIntVectorDouble, cpp_map[int, cpp_vector[double]] *)

cdef class _MapIntVectorDouble:
cdef cpp_map[int, cpp_vector[double]] * map_ptr
cdef public bint _free_map




Loading

0 comments on commit 0fea348

Please sign in to comment.