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

【The use of HypreParVector】 #4304

Closed
cglwdm opened this issue May 14, 2024 · 1 comment
Closed

【The use of HypreParVector】 #4304

cglwdm opened this issue May 14, 2024 · 1 comment
Assignees

Comments

@cglwdm
Copy link

cglwdm commented May 14, 2024

I have a code as below to glue the local Vector FF to the HypreParVector X00, the FF will access the not-self part of X00 on every process: so the code is all right when mpirun -np 1, but get corrupted size vs. prev_size if I run it more than one processes.
So how to fix it? Or how to prevent FF from accessing the not-self part of X00 on a given process?
`
Array dofs;

HypreParVector X00 = X0;

for (int id = 0; id < pmesh->GetNE(); id++) {

            Q_space->GetElementDofs(id, dofs);

            for (int edge = 0; edge < 3; edge++) {

                if (dofs[edge] >= 0) {

                    index = dofs[edge];

                } else {

                    index = -dofs[edge] - 1;

                }

                X00(index) = FF(edge);

}
}
`

@cglwdm
Copy link
Author

cglwdm commented May 21, 2024

I have work out the problem, just use ParGridFunction as:
ParGridFunction pi_p(Q_space); for (int id = 0; id < Q_space->GetNE(); id++) { Array<int> dofs; Q_space->GetElementVDofs(id, dofs); pi_p.SetSubVector(dofs, FF); }
Everything is OK now!

@tzanio tzanio self-assigned this May 22, 2024
@tzanio tzanio closed this as completed May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants