Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Implement *_get_5D(...) array accessors#2846

Closed
atrosinenko wants to merge 1 commit intoOpenModelica:masterfrom
atrosinenko:type_get_5D
Closed

Implement *_get_5D(...) array accessors#2846
atrosinenko wants to merge 1 commit intoOpenModelica:masterfrom
atrosinenko:type_get_5D

Conversation

@atrosinenko
Copy link
Copy Markdown
Contributor

This PR should technically fix the possibility to at least build models like Buildings.HeatTransfer.Windows.BaseClasses.Examples.AbsorbedRadiation and looks similar to what already exists.

I have rephrased the getIndex_nD function implementation, so they should be easier to read and, possibly, faster to compute (but this highly depends on what the optimizer already does). This may interfere with some corner cases like integer overflow, but these are probably UB-like cases anyway. In case the old implementation was written in such a way for a purpose, then maybe it would be worth to write some comment like

// Index = i0 * dim[1] * dim[2] * ... * dim[n] + i1 * dim[2] * ... * dim[n] + ... + i{n-1} * dim[n] + i{n}

@atrosinenko
Copy link
Copy Markdown
Contributor Author

Hmm... There are references to string_get_2D in KeyWordIO.Examples.ReadStringCSV as well...

@atrosinenko
Copy link
Copy Markdown
Contributor Author

Adapted real_get_nD for strings, hope this copy-paste is not agains CLA. :)

@hkiel
Copy link
Copy Markdown
Member

hkiel commented Jan 3, 2019

Your patch looks good. I wonder if 6D or 7D is also needed in some other model...
I started hudson job to run the testsuite on this and merge if successful.

@OpenModelica-Hudson
Copy link
Copy Markdown
Member

The tests run correctly according to OpenModelica_TEST_PULL_REQUEST 2019-01-03_17-52-50.

OpenModelica-Hudson pushed a commit that referenced this pull request Jan 3, 2019
@atrosinenko
Copy link
Copy Markdown
Contributor Author

Thanks! Meanwhile, on other low-hanging fruits: there are some timeouts like this where according to Callgrind, 60% of instructions are under fmi2GetReal -> oms3::fmi2logger. This can probably be optimized, but I don't know how right now.

@atrosinenko atrosinenko deleted the type_get_5D branch January 3, 2019 18:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants