Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'add_tally' into staging
- Loading branch information
Showing
9 changed files
with
552 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Tally.cpp | ||
// Central Tally Class | ||
// -- Andrew Davis | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
#ifndef PYNE_IS_AMALGAMATED | ||
#include "tally.h" | ||
#endif | ||
|
||
|
||
/***************************/ | ||
/*** Protected Functions ***/ | ||
/***************************/ | ||
|
||
/// there are no protected functions currently | ||
/// fool. | ||
|
||
/************************/ | ||
/*** Public Functions ***/ | ||
/************************/ | ||
|
||
/*--- Constructors ---*/ | ||
pyne::Tally::Tally() | ||
{ | ||
// Empty Tally Constructor | ||
tally_type = ""; | ||
particle_name = ""; | ||
entity_id = -1; | ||
entity_type = ""; | ||
entity_name = ""; | ||
} | ||
|
||
pyne::Tally::Tally(std::string type, std::string part_name, | ||
int ent, std::string ent_type, | ||
std::string ent_name) | ||
{ | ||
// Empty Tally Constructor | ||
tally_type = type; | ||
particle_name = part_name; | ||
entity_id = ent; | ||
entity_type = ent_type; | ||
entity_name = ent_name; | ||
} | ||
|
||
// Destructor | ||
pyne::Tally::~Tally() | ||
{ | ||
}; | ||
|
||
/*--- Method definitions ---*/ | ||
|
||
std::ostream& operator<<(std::ostream& os, pyne::Tally tal) | ||
{ | ||
//print the Tally to ostream | ||
os << "\t---------\n"; | ||
os << "\t Tallying " << tal.particle_name << " " << tal.tally_type << "\n"; | ||
os << "\t in/on " << tal.entity_type << " " << tal.entity_id << "\n"; | ||
return os; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#ifndef PYNE_IQ4M73STINHJDPRV6KWUZZXOYE | ||
#define PYNE_IQ4M73STINHJDPRV6KWUZZXOYE | ||
/// \file tally.h | ||
/// \author Andrew Davis (davisa\@engr.wisc.edu) | ||
/// | ||
/// \brief The tally class and helper functions | ||
/// | ||
/// The tally class is in essesence a structure containing attributes | ||
/// related to tallies | ||
|
||
#include <iostream> | ||
#include <fstream> | ||
#include <string> | ||
#include <map> | ||
#include <set> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
namespace pyne | ||
{ | ||
class Tally | ||
{ | ||
public: | ||
// Tally Constructors | ||
Tally (); ///< empty constructor | ||
|
||
/// Constructor from passed in vars | ||
/// \param type the type of tally (flux or current) | ||
/// \param particle_name the name of the particle type | ||
/// \param entity the entity id of the tally (eg. surface index, | ||
/// volume number) | ||
/// \param entity_type (volume or surface) | ||
/// \param entity_name string identifying the entity | ||
Tally(std::string type, std::string particle_name, int entity, | ||
std::string entity_type, std::string entity_name); | ||
|
||
~Tally (); ///< default destructor | ||
|
||
// fundamental tally variables | ||
std::string entity_type; // the type of entity (volume,surface) | ||
std::string entity_name; // the name of the entity (optional) | ||
std::string particle_name; // particle name string | ||
std::string tally_type; // type of tally flux or current | ||
int entity_id; // id number of the entity being tallied upon | ||
}; | ||
|
||
/// Converts a Tally to a string stream representation. | ||
std::ostream& operator<< (std::ostream& os, Tally tally); | ||
|
||
|
||
/// A stuct for reprensenting fundemental data in a tally | ||
/// Maybe Useful for HDF5 representations. | ||
/// following scoptaz's lead here | ||
typedef struct tally_struct { | ||
std::string tally_type; | ||
std::string particle_name; | ||
int entity_id; | ||
std::string entity_type; | ||
std::string entity_name; | ||
} tally_struct; | ||
|
||
// End pyne namespace | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
################################################ | ||
# WARNING! # | ||
# This file has been auto-generated by xdress. # | ||
# Do not modify!!! # | ||
# # | ||
# # | ||
# Come on, guys. I mean it! # | ||
################################################ | ||
|
||
|
||
from libcpp.string cimport string as std_string | ||
|
||
cdef extern from "tally.h" namespace "pyne": | ||
|
||
cdef cppclass Tally: | ||
# constructors | ||
Tally() except + | ||
Tally(std_string) except + | ||
Tally(std_string, std_string) except + | ||
Tally(std_string, std_string, int) except + | ||
Tally(std_string, std_string, int, std_string) except + | ||
Tally(std_string, std_string, int, std_string, std_string) except + | ||
|
||
# attributes | ||
int entity_id | ||
std_string entity_name | ||
std_string entity_type | ||
std_string particle_name | ||
std_string tally_type | ||
|
||
# methods | ||
|
||
pass | ||
|
||
|
||
|
||
|
||
{'cpppxd_footer': '', 'pyx_header': '', 'pxd_header': '', 'pxd_footer': '', 'cpppxd_header': '', 'pyx_footer': ''} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
################################################ | ||
# WARNING! # | ||
# This file has been auto-generated by xdress. # | ||
# Do not modify!!! # | ||
# # | ||
# # | ||
# Come on, guys. I mean it! # | ||
################################################ | ||
|
||
|
||
from pyne cimport cpp_tally | ||
|
||
|
||
|
||
cdef class Tally: | ||
cdef void * _inst | ||
cdef public bint _free_inst | ||
pass | ||
|
||
|
||
|
||
|
||
{'cpppxd_footer': '', 'pyx_header': '', 'pxd_header': '', 'pxd_footer': '', 'cpppxd_header': '', 'pyx_footer': ''} |
Oops, something went wrong.