10000 Move dof table functionality by TomFischer · Pull Request #1442 · ufz/ogs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ ogs Public

Move dof table functionality #1442

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

Merged
merged 2 commits into from
Sep 27, 2016

Conversation

TomFischer
Copy link
Member

As titled.

@chleh
Copy link
Collaborator
chleh commented Sep 26, 2016

Please have a look at DOFTableUtil. There is already similar code.

@TomFischer
Copy link
Member Author

Please have a look at DOFTableUtil. There is already similar code.

Thanks for the hint, I'll check this tomorrow.

@@ -44,6 +44,42 @@ std::vector<GlobalIndexType> getIndices(
return indices;
}

NumLib::LocalToGlobalIndexMap::RowColumnIndices getRowColumnIndices(
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks for me the function is similar to getIndices(). Can't you reuse it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed these functions are very similar. The important difference is that the getRowColumnIndices does not create the result vector indices again and again for every call of the function. Anyway, in this PR I only want to move existing code such that I can use it a second time at another place.

Copy link
Collaborator

Choose a reason for hiding this comment

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

i see. thanks for the explanation

return NumLib::LocalToGlobalIndexMap::RowColumnIndices(indices, indices);
}

void getVectorValues(
Copy link
Collaborator

Choose a reason for hiding this comment

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

GlobalVector such as EigenVector has get(std::vector<IndexType> const& indices). maybe you can use it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you are right. The function get() is already used internally in getVectorValues(), see line 78. The function is a wrapper for the GlobalVector::get that ensures that the vector local_x has the appropriate size.

Copy link
Collaborator

Choose a reason for hiding this comment

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

is get() at line 78 get(int) or get(std::vector<int>&)?

Copy link
Member Author

Choose a reason for hiding this comment

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

If I am not wrong it is IDX_TYPE which is probably int.

Copy link
Collaborator

Choose a reason for hiding this comment

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

what I actually wanted to say is that you can write it as below. maybe you already know it and intentionally you are not using it.

local_x = x.get(r_c_indices.rows);

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the hint, I did not know this. I needed only the functionality in my own balance implementation. So I moved the code to a general accessible location.

@TomFischer TomFischer mentioned this pull request Sep 27, 2016
2 tasks
Copy link
Collaborator
@norihiro-w norihiro-w left a comment

Choose a reason for hiding this comment

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

looks good

@TomFischer
Copy link
Member Author

@chleh Are the changes in TES okay?

@chleh
Copy link
Collaborator
chleh commented Sep 27, 2016

Changes in TES are OK. Code looks good. So you might merge this PR.

I only want to make a short remark:
The functionality added is, as you said, that getRowColumnIndices() doesn't create the indices vector. However x.get(r_c_indices.rows) will always create a vector.
So if this optimization is really important, then it might be important in both places (note: IMHO it's currently not so important). Furthermore, if it's important, it might be important for getIndices(), too. And when changing getIndices(), one would have to check what that means for the usability of this function, i.e., whether the user has to write more code.
So this PR duplicates some functionality; I am not really happy with it. But in order to not block you: Merge and forget 😄

@TomFischer
Copy link
Member Author

I am unsure. Should I let getVectorValues() in the TES process?

@TomFischer TomFischer force-pushed the move-dof-table-functionality branch from fb8e22a to d9a1a36 Compare September 27, 2016 07:58
@chleh
Copy link
Collaborator
chleh commented Sep 27, 2016

For TES you can keep it as you have it in this PR.

@TomFischer TomFischer force-pushed the move-dof-table-functionality branch from d9a1a36 to 08ad953 Compare September 27, 2016 10:47
@TomFischer TomFischer merged commit eff4434 into ufz:master Sep 27, 2016
@TomFischer TomFischer deleted the move-dof-table-functionality branch September 27, 2016 11:53
@ogsbot
Copy link
Member
ogsbot commented Jun 19, 2020

OpenGeoSys development has been moved to GitLab.

See this pull request on GitLab.

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

Successfully merging this pull request may close these issues.

4 participants
0