Skip to content

Commit

Permalink
Added dof_id_type to constant reporter and also added tests for accum…
Browse files Browse the repository at this point in the history
…ulate reporter using this constant reporter. dof_id_type was also added to accumulate reporter, it previously only worked for vector of dof_id_type closes idaholab#20467
  • Loading branch information
lynnmunday committed Mar 4, 2022
1 parent bc3020b commit d0f70f5
Show file tree
Hide file tree
Showing 8 changed files with 192 additions and 3 deletions.
1 change: 1 addition & 0 deletions framework/src/reporters/AccumulateReporter.C
Expand Up @@ -39,6 +39,7 @@ AccumulateReporter::initialSetup()
paramError("reporters", "Reporter ", rname, " does not exist.");

if (!declareAccumulateHelper<int>(rname) && !declareAccumulateHelper<Real>(rname) &&
!declareAccumulateHelper<dof_id_type>(rname) &&
!declareAccumulateHelper<std::string>(rname) &&
!declareAccumulateHelper<std::vector<int>>(rname) &&
!declareAccumulateHelper<std::vector<Real>>(rname) &&
Expand Down
3 changes: 3 additions & 0 deletions framework/src/reporters/ConstantReporter.C
Expand Up @@ -21,6 +21,7 @@ ConstantReporter::validParams()
params += addReporterTypeParams<int>("integer");
params += addReporterTypeParams<Real>("real");
params += addReporterTypeParams<std::string>("string");
params += addReporterTypeParams<dof_id_type>("dof_id_type");

return params;
}
Expand All @@ -30,7 +31,9 @@ ConstantReporter::ConstantReporter(const InputParameters & parameters) : General
declareConstantReporterValues<int>("integer");
declareConstantReporterValues<Real>("real");
declareConstantReporterValues<std::string>("string");
declareConstantReporterValues<dof_id_type>("dof_id_type");
declareConstantVectorReporterValues<int>("integer");
declareConstantVectorReporterValues<Real>("real");
declareConstantVectorReporterValues<std::string>("string");
declareConstantVectorReporterValues<dof_id_type>("dof_id_type");
}
Expand Up @@ -33,6 +33,8 @@
[Reporters]
[rep]
type = ConstantReporter
dof_id_type_names = 'dofid'
dof_id_type_values = '1'
integer_names = 'int'
integer_values = '1'
string_names = 'str'
Expand All @@ -41,11 +43,13 @@
integer_vector_values = '3 4'
string_vector_names = 'str_vec'
string_vector_values = 'five six seven eight'
dof_id_type_vector_names = 'dofid_vec'
dof_id_type_vector_values = '1 2 3'
outputs = none
[]
[accumulate]
type = AccumulateReporter
reporters = 'pp/value vpp/fun rep/int rep/str rep/int_vec rep/str_vec'
reporters = 'pp/value vpp/fun rep/int rep/str rep/int_vec rep/str_vec rep/dofid rep/dofid_vec'
[]
[]

Expand Down
Expand Up @@ -6,6 +6,12 @@
"pp:value": {
"type": "std::vector<double>"
},
"rep:dofid": {
"type": "std::vector<unsigned long long>"
},
"rep:dofid_vec": {
"type": "std::vector<std::vector<unsigned long long>>"
},
"rep:int": {
"type": "std::vector<int>"
},
Expand All @@ -30,6 +36,16 @@
"pp:value": [
0.0
],
"rep:dofid": [
1
],
"rep:dofid_vec": [
[
1,
2,
3
]
],
"rep:int": [
1
],
Expand Down Expand Up @@ -70,6 +86,22 @@
0.0,
1.0
],
"rep:dofid": [
1,
1
],
"rep:dofid_vec": [
[
1,
2,
3
],
[
1,
2,
3
]
],
"rep:int": [
1,
1
Expand Down Expand Up @@ -131,6 +163,28 @@
1.0,
2.0
],
"rep:dofid": [
1,
1,
1
],
"rep:dofid_vec": [
[
1,
2,
3
],
[
1,
2,
3
],
[
1,
2,
3
]
],
"rep:int": [
1,
1,
Expand Down Expand Up @@ -213,6 +267,34 @@
2.0,
3.0
],
"rep:dofid": [
1,
1,
1,
1
],
"rep:dofid_vec": [
[
1,
2,
3
],
[
1,
2,
3
],
[
1,
2,
3
],
[
1,
2,
3
]
],
"rep:int": [
1,
1,
Expand Down Expand Up @@ -316,6 +398,40 @@
3.0,
4.0
],
"rep:dofid": [
1,
1,
1,
1,
1
],
"rep:dofid_vec": [
[
1,
2,
3
],
[
1,
2,
3
],
[
1,
2,
3
],
[
1,
2,
3
],
[
1,
2,
3
]
],
"rep:int": [
1,
1,
Expand Down Expand Up @@ -440,6 +556,46 @@
4.0,
5.0
],
"rep:dofid": [
1,
1,
1,
1,
1,
1
],
"rep:dofid_vec": [
[
1,
2,
3
],
[
1,
2,
3
],
[
1,
2,
3
],
[
1,
2,
3
],
[
1,
2,
3
],
[
1,
2,
3
]
],
"rep:int": [
1,
1,
Expand Down
2 changes: 1 addition & 1 deletion test/tests/reporters/accumulated_reporter/tests
@@ -1,6 +1,6 @@
[Tests]
design = 'AccumulateReporter.md'
issues = '#18469'
issues = '#18469 #20467'

[accumulate_reporter]
type = 'JSONDiff'
Expand Down
6 changes: 6 additions & 0 deletions test/tests/reporters/constant_reporter/constant_reporter.i
Expand Up @@ -22,6 +22,9 @@
string_names = 'str'
string_values = 'six'

dof_id_type_names = 'dofid_1 dofid_2 dofid_3'
dof_id_type_values = '1 2 3'

integer_vector_names = 'int_vec'
integer_vector_values = '7 8'

Expand All @@ -30,6 +33,9 @@

string_vector_names = 'str_vec'
string_vector_values = 'ten eleven twelve thirteen'

dof_id_type_vector_names = 'dofid_vec'
dof_id_type_vector_values = '7 3'
[]
[error]
type = ConstantReporter
Expand Down
Expand Up @@ -3,6 +3,18 @@
"constant": {
"type": "ConstantReporter",
"values": {
"dofid_1": {
"type": "unsigned long long"
},
"dofid_2": {
"type": "unsigned long long"
},
"dofid_3": {
"type": "unsigned long long"
},
"dofid_vec": {
"type": "std::vector<unsigned long long>"
},
"int_1": {
"type": "int"
},
Expand Down Expand Up @@ -39,6 +51,13 @@
"time_steps": [
{
"constant": {
"dofid_1": 1,
"dofid_2": 2,
"dofid_3": 3,
"dofid_vec": [
7,
3
],
"int_1": 1,
"int_2": 2,
"int_3": -3,
Expand Down
2 changes: 1 addition & 1 deletion test/tests/reporters/constant_reporter/tests
@@ -1,6 +1,6 @@
[Tests]
design = 'ConstantReporter.md'
issues = '#16055'
issues = '#16055 #20467'

[constant_reporter]
type = 'JSONDiff'
Expand Down

0 comments on commit d0f70f5

Please sign in to comment.