Last active
January 31, 2017 22:19
-
-
Save lindsayad/ee0aa5fe27e754a39d33421b31db1013 to your computer and use it in GitHub Desktop.
Test MOOSE hash map storage of material properties
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
#include "MoltresApp.h" | |
#include "MooseInit.h" | |
#include "Moose.h" | |
#include "MooseApp.h" | |
#include "AppFactory.h" | |
#include "HashMap.h" | |
#include <thread> | |
#include "MaterialProperty.h" | |
// Create a performance log | |
PerfLog Moose::perf_log("Moltres"); | |
// Begin the main program. | |
int main(int argc, char *argv[]) | |
{ | |
unsigned int num_mat_props = 6; | |
MaterialProperties props; | |
MaterialProperties props_old; | |
for (unsigned int i = 0; i < num_mat_props; i++) | |
{ | |
auto n = i + 1; | |
if (props.size() < n) | |
props.resize(n, NULL); | |
if (props_old.size() < n) | |
props_old.resize(n, NULL); | |
if (props[i] == NULL) | |
props[i] = new MaterialProperty<Real>; | |
if (props_old[i] == NULL) | |
props_old[i] = new MaterialProperty<Real>; | |
} | |
props.resizeItems(8); | |
props_old.resizeItems(8); | |
HashMap<unsigned long long, HashMap<unsigned int, MaterialProperties> > props_elem; | |
HashMap<unsigned long long, HashMap<unsigned int, MaterialProperties> > props_elem_old; | |
unsigned long long num_elements = 37376; | |
for (unsigned long long i = 0; i < num_elements; i++) | |
{ | |
HashMap<unsigned int, MaterialProperties> intermed; | |
HashMap<unsigned int, MaterialProperties> intermed_old; | |
intermed[0] = props; | |
props_elem[i] = intermed; | |
intermed_old[0] = props_old; | |
props_elem_old[i] = intermed_old; | |
std::this_thread::sleep_for(std::chrono::milliseconds(1)); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment