-
Notifications
You must be signed in to change notification settings - Fork 9
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
Define 2d model class and Simmetrix GeomSim model loader #96
base: master
Are you sure you want to change the base?
Conversation
simmetrix does not store loops, only loop uses, remove them for now
compiles and executes
no leaks or errors under valgrind
/runtests |
Test Result: failure (details) |
/runtests |
Test Result: failure (details) |
/runtests |
Test Result: failure (details) |
/runtests |
Test Result: failure (details) |
OMEGA_H_CHECK is a no-op when NDEBUG is defined
/runtests |
Test Result: success (details) |
@@ -165,6 +166,7 @@ if(Omega_h_USE_SimModSuite) | |||
set(CMAKE_MODULE_PATH ${OLD_CMAKE_MODULE_PATH}) | |||
set(Omega_h_SOURCES ${Omega_h_SOURCES} Omega_h_meshsim.cpp) | |||
set(Omega_h_SOURCES ${Omega_h_SOURCES} Omega_h_matchMeshsim.cpp) | |||
set(Omega_h_SOURCES ${Omega_h_SOURCES} Omega_h_simModel2d.cpp) |
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.
We should probably consider using list(APPEND Omega_h_sources ...)
(https://cmake.org/cmake/help/latest/command/list.html#append) before we end up with a bunch of calls to set
. There are other places that can benefit from this too
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.
I agree. Thank you. Draft PR #97 addresses this.
src/Omega_h_mesh2d.cpp
Outdated
Model2D Mesh2D::updateModel() { | ||
model = Model2D::MeshModel2D_load(*this); | ||
return *model; |
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.
How does the dereferencing operator work here? It is my understanding that Model2D::MeshModel2D_load
returns a Model2D
not a pointer to it.
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.
Good catch. Thank you. Fixed with 86e2b4a.
@cwsmith is this ready to look at? I can take a look over the weekend. |
@jacobmerson Yes. This is all set. Thank you. |
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.
I mostly commented on high level design choices so far.
std::fill(array.data(), array.data()+array.size(), init); | ||
return array; | ||
} | ||
|
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.
these constructors can also be used, cant they ?
Line 164 in ef317f8
HostWrite(LO size_in, T offset, T stride, std::string const& name = ""); |
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.
Lines 162 to 166 in ef317f8
HostWrite() = default; | |
HostWrite(LO size_in, std::string const& name = ""); | |
HostWrite(LO size_in, T offset, T stride, std::string const& name = ""); | |
HostWrite(Write<T> write_in); | |
HostWrite(std::initializer_list<T> l, std::string const& name = ""); |
For
HostWrite(...)
, the closest ctor I see is the one that takes an initializer list, but I don't think that will support setting all the values in the array when its length is set at runtime. I also thought there would have been one that initialized all the values but I didn't find it.Interestingly, there are
Write()
and Read()
ctors that support it:Line 64 in ef317f8
Write(LO size_in, T value, std::string const& name = ""); |
Line 95 in ef317f8
Read(LO size, T value, std::string const& name = ""); |
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.
@cwsmith how about if you use stride=0 and set initial value as the offset ?
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.
for this one
HostWrite(LO size_in, T offset, T stride, std::string const& name = "");
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.
Yeah, good call. I misunderstood what that ctor did. Thanks.
For the record, it creates a HostWrite from a call to the Write(...) ctor with the same signature.
Lines 223 to 226 in ef317f8
template <typename T> | |
HostWrite<T>::HostWrite( | |
LO size_in, T offset, T stride, std::string const& name_in) | |
: HostWrite<T>(Write<T>(size_in, offset, stride, name_in)) {} |
That in turn calls
fill_linear(...)
.Lines 67 to 73 in ef317f8
template <typename T> | |
void fill_linear(Write<T> a, T offset, T stride) { | |
auto f = OMEGA_H_LAMBDA(LO i) { | |
a[i] = offset + (stride * static_cast<T>(i)); | |
}; | |
parallel_for(a.size(), f, "Write(size,offset,stride)"); | |
} |
I'll create a PR that adds a docstring for that API.
OMEGA_H_CHECK(model.faceToLoopUse == expected_f2lu); | ||
} | ||
|
||
int main(int argc, char** argv) { |
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.
so iiuc, at the moment this functionality added by this PR loads the smd file and queries and stores connectivity and coordinate information in Omega_h::Model2D.
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.
That's pretty close. It reads the model topology and some of the geometry from the smd file into the Omega_h::Model2D struct. The arrays in the Model2D struct are currently only accessed for a correctness check for a specific test model.
The goal is to query the Model2D data during adaptation to improve the geometric model approximation. That development is going to take some time and I didn't want to have this code stuck in a branch too long.
looks good to me overall, some comments attached |
notes from discussion with @jacobmerson
|
Adds a Model2D class and support for filling the Model2D data structures from a Simmetrix GeomSim model (.smd).
will_fail_test_func(...)
CMake macro)