-
Notifications
You must be signed in to change notification settings - Fork 4
Feature: MMG mesh initialization #57
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -40,6 +40,7 @@ void init_var(const Param& param, Variables& var) | |||||||||||||||
| var.func_time.output_time = 0; | ||||||||||||||||
| var.func_time.remesh_time = 0; | ||||||||||||||||
| var.func_time.start_time = get_nanoseconds(); | ||||||||||||||||
| var.init_elem_size_n = new double_vec(0); | ||||||||||||||||
|
|
||||||||||||||||
| for (int i=0;i<nbdrytypes;++i) | ||||||||||||||||
| var.bfacets[i] = new int_pair_vec; | ||||||||||||||||
|
|
@@ -185,7 +186,9 @@ void init(const Param& param, Variables& var) | |||||||||||||||
| var.dt = compute_dt(param, var); // Global-velocity scaling needs dt before compute_mass. | ||||||||||||||||
| compute_mass(param, var, var.max_vbc_val, *var.volume_n, *var.mass, *var.tmass, *var.hmass, *var.ymass, *var.tmp_result); | ||||||||||||||||
|
|
||||||||||||||||
| #ifdef USEMMG | ||||||||||||||||
| initialize_elem_size_n(var, *var.init_elem_size_n); | ||||||||||||||||
| #endif | ||||||||||||||||
|
|
||||||||||||||||
| compute_shape_fn(var, *var.shpdx, *var.shpdy, *var.shpdz); | ||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -302,6 +305,7 @@ void restart(const Param& param, Variables& var) | |||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| allocate_variables(param, var); | ||||||||||||||||
| var.init_elem_size_n->resize(var.nnode); | ||||||||||||||||
|
|
||||||||||||||||
| create_top_elems(var); | ||||||||||||||||
| create_surface_info(param,var,var.surfinfo); | ||||||||||||||||
|
|
@@ -327,8 +331,9 @@ void restart(const Param& param, Variables& var) | |||||||||||||||
| bin_save.read_array(*var.ppressure, "pore pressure"); | ||||||||||||||||
|
|
||||||||||||||||
| bin_chkpt.read_array(*var.surfinfo.edvacc_surf, "dv surface acc"); | ||||||||||||||||
| #ifdef USEMMG | ||||||||||||||||
| bin_chkpt.read_array(*var.init_elem_size_n, "init_elem_size_n"); | ||||||||||||||||
|
||||||||||||||||
| bin_chkpt.read_array(*var.init_elem_size_n, "init_elem_size_n"); | |
| if (bin_chkpt.has_array("init_elem_size_n")) | |
| bin_chkpt.read_array(*var.init_elem_size_n, "init_elem_size_n"); | |
| else { | |
| for (std::size_t i = 0; i < var.init_elem_size_n->size(); ++i) | |
| (*var.init_elem_size_n)[i] = 0; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In restart(), init_elem_size_n is resized unconditionally. In non-MMG builds this can allocate a large per-node array that is never used (and contradicts the goal of avoiding init_elem_size_n allocation when USEMMG is off). Guard this resize behind USEMMG (and only resize when you will actually read/populate the array).