Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol buffer implementation #105

Merged
merged 41 commits into from
Oct 8, 2018

Conversation

JessicaRehak
Copy link
Collaborator

This replaces the Materials class with MaterialProperties that ingests a material file in the form of a protocol buffer (proto file provided) or a plain text file in the correct formatting.

Detailed list of changes:

  • Implements MaterialProperties that ingests a provided material file and provides checks for data consistency, and access to the data.
  • Updates CMakeLists to include protocol buffers, and copy required testing files for MaterialProperties testing.
  • Updates readme to include links to all current branches.
  • Adds -r flag to coverage.sh that will generate an html coverage report.
  • Adds material.proto, the protocol buffer file used for materials.
  • Removes BuildMaterial functions from BartBuilder because all material information is now through the interface of a FundamentalData object
  • Updated XSections struct to use new MaterialProperties object, implemented testing for the struct.
  • Added a MaterialPropertiesI interface abstract class.
  • Added various testing tools: a mock class MockMaterialProperties for testing without instantiating a MaterialProperties class; various helpful test functions for making random vectors, FullMatrix objects, and maps that map those objects to integers; various testing material protocol buffer files.
  • Added a utility function for conducting a precise sum, PreciseSum that uses the Neumaier variation of the Kahan summation.

JessicaRehak and others added 30 commits September 20, 2018 11:14
@JessicaRehak JessicaRehak added enhancement Addition of features to BART. major Involves multiple classes across multiple top level namespaces. testing Related to testing helpers and support classes. build system Related to CMake. labels Oct 2, 2018
@wzheng21
Copy link
Collaborator

wzheng21 commented Oct 2, 2018 via email

@codecov-io
Copy link

codecov-io commented Oct 2, 2018

Codecov Report

Merging #105 into restart will increase coverage by 12.47%.
The diff coverage is 98.96%.

Impacted file tree graph

@@             Coverage Diff              @@
##           restart     #105       +/-   ##
============================================
+ Coverage    24.78%   37.26%   +12.47%     
============================================
  Files           27       31        +4     
  Lines         2017     2128      +111     
============================================
+ Hits           500      793      +293     
+ Misses        1517     1335      -182
Impacted Files Coverage Δ
src/common/computing_data.h 50% <ø> (+50%) ⬆️
src/common/bart_builder.cc 41.02% <ø> (+2.47%) ⬆️
src/utility/utility_functions.h 100% <100%> (ø)
src/material/material_protobuf.h 100% <100%> (ø)
src/test_helpers/test_helper_functions.cc 100% <100%> (ø)
src/material/material_base.h 100% <100%> (ø)
src/common/computing_data.cc 20.63% <71.42%> (+18.71%) ⬆️
src/material/material_protobuf.cc 99.54% <99.54%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d95e93...6bdd161. Read the comment docs.

#include <vector>

#include <deal.II/lac/full_matrix.h>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain a bit:

  • why we need this base class for MaterialProperties
  • What "I" means for the naming. The naming should somehow self-explain what it does.
  • Please add the brief doxygen documentation for this class

src/test_helpers/test_helper_functions.h Show resolved Hide resolved
};

TEST_F(TestHelperFunctionTest, RandomDoubleTest) {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this empty line

TEST_F(TestHelperFunctionTest, RandomIntMatrixMapTest) {
// Generate 20 random int to matrix maps and verify properties
for (int i = 0; i < 20; ++i) {
size_t n = rand()%10 + 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size_t and rand are objects in std namespace, so please specify the namespace accordingly.


double val1 = -200 + static_cast<double>(rand()) / RAND_MAX*(400);
double val2 = -200 + static_cast<double>(rand()) / RAND_MAX*(400);
double min = (val1 > val2) ? val2 : val1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename min and max to something else such as min_val and max_val. We should avoid using names that means something in std namespace.

test_chi_[10] = {0.5925247816749882, 0.4071432856463152, 0.00033193267869671705, 0, 0, 0, 0};
test_chi_[11] = {0.5925247816749882, 0.4071432856463152, 0.00033193267869671705, 0, 0, 0, 0};
test_sigma_s_[1] = {
0.12334, 0.055604999999999995, 0.00023375, 0, 0, 0, 0,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two more spaces for breaking-line indent. Adjust all applicable spots.

}

TEST_F(MaterialPropertiesTest, WrongNumberOfMaterials) {
EXPECT_THROW({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The format is actually messy for all the EXPECT_THROW macros have try and catch in it. Remember, breaking a line in parentheses should follow one of the following two rules:

  • all new lines should at least look up the open parenthesis (left)
  • all new lines should based on indenting with 4 spaces.

Please change accordingly. Also pls read Google Style guide for this painful rule or discuss with me.

std::unordered_set<int> material_ids = {1, 2, 10, 11};
std::unordered_map<int, bool> correct_fissile_id_map = {{1, false}, {2, false}, {10, false}, {11, false}};
std::unordered_map<int, std::vector<double>> zero_vals_map =
{{1, {0, 0, 0, 0, 0, 0, 0}}, {2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation.

std::unordered_set<int> material_ids = {1, 2, 10, 11};
std::unordered_map<int, bool> correct_fissile_id_map = {{1, false}, {2, false}, {10, false}, {11, false}};
std::unordered_map<int, std::vector<double>> zero_vals_map =
{{1, {0, 0, 0, 0, 0, 0, 0}}, {2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent adjustment

argument data types,
and output sequence for print_info()
*/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment: if dealii:: namespace is applicable to the macros, we should apply it (we don't if not)

One thing to change: add two more spaces for indent. Read Google Style Guide

@JessicaRehak
Copy link
Collaborator Author

JessicaRehak commented Oct 8, 2018

The MaterialPropertiesI interface class is now MaterialBase, MaterialProperties has been changed to MaterialProtobuf

No changes to fix formatting in the MaterialProtobuf class, this is now tracked in #106.

@wzheng21 wzheng21 merged commit f21fe93 into SlaybaughLab:restart Oct 8, 2018
@JessicaRehak JessicaRehak deleted the protocol_buffer branch October 9, 2018 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system Related to CMake. enhancement Addition of features to BART. major Involves multiple classes across multiple top level namespaces. testing Related to testing helpers and support classes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants