Skip to content

Add new script command: pmesh <np> <mesh prefix> - #383

Open
v-dobrev wants to merge 2 commits into
masterfrom
add-pmesh-script-command
Open

v-dobrev wants to merge 2 commits into
masterfrom
add-pmesh-script-command

Conversation

@v-dobrev

Copy link
Copy Markdown
Member

Similar to the mesh command, it captures reference nodes on the first load and visualizes displacement on subsequent pmesh loads.

@tzanio

tzanio commented Oct 29, 2026

Copy link
Copy Markdown
Member

🤖 Suggestions from an AI review. Feel free to ignore if not relevant.

  • This introduces an issue where pmesh loses -a on updates after initialization because ExecuteScriptCommand() creates a default new_state with keep_attr=false. This predates the PR, but the new parallel loader uses it to replace material attributes with processor ranks; serial mesh preserves them.

  • To fix, preserve the session setting immediately before calling ScriptReadDisplMesh():

    new_state.keep_attr = win.data_state.keep_attr;

@v-dobrev

Copy link
Copy Markdown
Member Author

Regarding the AI suggestion: it may be best to construct the new_state here:

DataState new_state;

using win.data_state.Clone():

            DataState new_state = win.data_state.CloneEmpty();

instead of the default constructor. This, in particular, will copy the keep_attr field.

@najlkin, does this sound good to you?

@najlkin

najlkin commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Yeah, that sounds good 👍 . I introduced the method just recently for exactly such cases, so the solution itself is not copied, but the settings are. Probably we will not need #378 then, but I need to check more closely 🤔 .

@v-dobrev

Copy link
Copy Markdown
Member Author

Yeah, that sounds good 👍 .

Okay, done.

Comment thread lib/script_controller.cpp
int ScriptController::ScriptReadDisplMesh(istream &scr, DataState &state,
bool parallel)
{
DataState meshstate;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This one should be also cloned to preserve all settings (current or future). I opened a new PR fixing all occurrences #384 😉 .

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Since you fixed it in the other PR, do you still want me to fix it here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants