Commit graph

79 commits

Author SHA1 Message Date
Paul Romano
8f71ed2a1d Store sites from source file in SourceDistribution 2020-10-22 15:07:23 -05:00
Paul Romano
726adfb46c
Merge pull request #1623 from DanShort12/serialised_custom_source
Add support for serialized custom sources
2020-08-31 07:35:49 -05:00
Dan Short
21e8d91e90 Requested updates to source
Rename sample_source -> sample.
Use std::string as type of argument to openmc_create_source.
Use reinterpret_cast when accessing dlsym.
Also moves check for dlerror to be before the attempt to create the
source (avoids null reference if fails) and capture error message
before dlclose, so that the error message is still available.
Formatting updates and some refactoring for examples and tests.
2020-08-28 09:49:36 +01:00
Dan Short
821e7d9825 Remove old source_sampling custom source method
Custom sources are now created only through the new class-based method,
which supports parameterization.
New method also slightly adjusted to create the source as managed by a
unique_ptr.
Examples and tests updated to align with this approach.
Documentation updated.
2020-08-21 12:05:43 +01:00
Paul Romano
1e61efe40e
Merge pull request #1627 from drewejohnson/fmt-msg-output
Delay formatting of some messages unless they're going to be printed
2020-08-06 14:22:06 -05:00
Andrew Johnson
bd76dbd9a2
Apply templated write_message to source.cpp 2020-08-06 07:05:02 -04:00
Sterling Harper
a5ef3dc405 Sample source sites in parallel 2020-08-05 18:34:12 -04:00
Dan Short
0bb5030ee0 Rename create -> openmc_create_source 2020-08-05 16:02:52 +01:00
Dan Short
fae474869c Remove external destroy method
OpenMC will call delete directly on the CustomSource.
2020-08-05 16:00:49 +01:00
Dan Short
9c1b318e78 Only instantiate custom source once
In the existing custom_source implementation, the source will only be
created once. This is much more efficient than the custom serialized
source, where each sampling will create a new instance of the class.
As there could be many samples, this introduces an overhead,
particularly if the operations to instantiate the class are not trivial.
This implementation defines an abstract class, which is then used by the
custom classes to allow the custom serialized class to be created based
on the plugin, sampled from, and then destroyed.
Update documentation and test to reflect this.
2020-08-03 17:38:12 +01:00
Dan Short
8bb10563c1 Pass serialization as parameter attribute
Changes the implementation of the serialization to be on an attribute of
the source XML element within settings.xml. This removes the need for a
new file containing the serialization.
Parameters are provided as a key-value string, separated by a comma and
a space, although the implementation can change this is required.
Change example values to align with existing custom_source to make
comparisons easier.
Update documentation to be consistent.
2020-08-03 14:24:17 +01:00
Dan Short
175d57c126 Load the serialized representation from file once
The previous implementation had each sampling run reading from the
serialized file. This introduced a large I/O overhead and the
performance was much slower than the equivalent run with the
unserialized source.
2020-07-31 13:25:46 +01:00
Dan Short
67e846c4d5 Load new serializable form of source function
Updates the SourceDistribution to optionally look for a function
template accepting char* as the second argument.
If serialization is defined as an attribute on the source element
provided in the settings.xml then the new form with serialization will
be used. Otherwise the existing form to load the custom source as-is
from the library will be used.
2020-07-31 11:48:00 +01:00
Yue JIN
10889172ce Fix to allow build in VS2019 2020-07-15 16:23:07 +08:00
davidjohnlong
ce135cc4a9 Refactor fixed source sampling so call to custom library is made from call to sample_external_source() 2020-03-12 17:02:22 +00:00
davidjohnlong
eac442f31c Move function description to header file 2020-03-12 09:34:38 +00:00
davidjohnlong
cc2017786b Rename custom source library and function and move to anonymous namespace 2020-03-12 09:29:28 +00:00
davidjohnlong
3f7afb7b4f
Adjust naming of custom source function and library for clarity
Co-Authored-By: Paul Romano <paul.k.romano@gmail.com>
2020-03-12 08:14:31 +00:00
davidjohnlong
d355347e8e
Remove unnecessary variable in src/source.cpp
Co-Authored-By: Paul Romano <paul.k.romano@gmail.com>
2020-03-12 08:10:49 +00:00
davidjohnlong
907459d02f Implement new fixed source bank model for custom library source. Additional non-member functions in source.cpp with function pointer saved in model namespace allow custom library to be opened, sampled as needed in initialize_history and closed. 2020-03-06 16:03:15 +00:00
davidjohnlong
0ae1077a39 Implement the new fixed source bank model. For a fixed source calcultion the primary source bank is not allocated memory and source particles can not be read/written to files. The source particles for each history are now sampled at the start of initialize_history() through call to sample_external_source() with the appropriate seed. The timing stats for sampling has been removed from the output since this processing is now part of the transport timer 2020-03-05 19:23:51 +00:00
Paul Romano
c5dbff356a Fixes to custom source feature 2020-02-17 15:45:50 -06:00
Andrew Davis
441c284c52 Refactor into function as suggested by review 2020-02-12 13:06:30 +00:00
Andrew Davis
acce6941c3 line removal from review 2020-02-12 12:48:54 +00:00
Andrew Davis
c6949e5e53 Updated spelling mistakes 2020-02-12 12:44:46 +00:00
Andrew Davis
d4835f49ec Updated the source routines according to passing seed to prn 2020-02-12 12:37:21 +00:00
Andrew Davis
55f85b1924 updated signatures according to new changes in how seed is set 2020-02-12 12:37:21 +00:00
Andrew Davis
8f515b504a Wrapped the first instance trying to use dlopen in a posix safety ifdef 2020-02-12 12:37:21 +00:00
Andrew Davis
7adc619c88 Stylistic changes 2020-02-12 12:37:21 +00:00
Andrew Davis
21bf7243eb Added missing fixed source subroutine 2020-02-12 12:37:21 +00:00
Andrew Davis
8036903b05 Added internal infrastructure for dlopen based shared object sources 2020-02-12 12:37:21 +00:00
Andrew Davis
eb028827f8 Added missing fixed source subroutine 2020-02-12 12:37:21 +00:00
Andrew Davis
4fc83ce670 Added internal infrastructure for dlopen based shared object sources 2020-02-12 12:37:21 +00:00
Andrew Davis
325a24bdbc Added missing fixed source subroutine 2020-02-12 12:37:21 +00:00
Andrew Davis
58d751bfae Added internal infrastructure for dlopen based shared object sources 2020-02-12 12:37:21 +00:00
Paul Romano
cc919d25c5 Use fmt/core.h header to reduce compile time 2020-02-10 10:33:57 -06:00
Paul Romano
2a230cd739 More use of fmt::print and fmt::format 2020-02-10 10:33:57 -06:00
Paul Romano
a7d08364d3 Parallelize source site generation for fixed source calcs 2020-01-14 15:10:33 -06:00
Ethan Peterson
96c7427eaf Adding CylindricalIndependent source type
ammended docstrings to mention local reference frame
2020-01-06 19:47:10 -05:00
John Tramm
0602ddd8a3 refactor seed and seed aray variable names 2019-12-05 19:50:31 +00:00
John Tramm
428bab4fd2 incorporated code review changes 2019-12-05 19:32:12 +00:00
John Tramm
638172e68d refactor of prn() interface and python interface changes 2019-12-04 16:35:01 +00:00
John Tramm
2ec02d6472
Apply formatting fixes from code review
Co-Authored-By: Paul Romano <paul.k.romano@gmail.com>
2019-12-03 10:36:01 -06:00
Paul Romano
eca3ce33d2 Fix pointer placement on uint64_t 2019-11-27 07:04:11 -06:00
John Tramm
642c3a8ac7 first sweep of refactoring is complete. now for debugging 2019-11-21 23:03:52 +00:00
Paul Romano
09fbc034d8
Merge pull request #1406 from nelsonag/mgxs_f_to_c
Mgxs code cleanup
2019-11-18 07:42:20 -06:00
Adam G Nelson
05fac29164 Revised MG code so that the energy group indices are 0-based instead of 1-based. Next commit will perform some code cleanup enabled by this change. 2019-11-11 19:50:52 -06:00
Paul Romano
21a8557360
Merge pull request #1398 from eepeterson/spherical_source
Spherical source
2019-11-11 12:52:47 -06:00
Ethan Peterson
15c7148331 Adding SphericalIndependent source type
Applied suggestions from code review

Co-Authored-By: Paul Romano <paul.k.romano@gmail.com>
2019-11-11 10:50:38 -05:00
Gavin Ridley
b8d9ae0f8e PR style changes 2019-11-08 13:25:49 -05:00