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

#4957 - Some copy constructors aren't declared in SWIG #4960

Merged
merged 5 commits into from Sep 6, 2023

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Sep 5, 2023

Pull request overview

Note: The missing swig copy ctors were never in any official release, this was only on 3.7.0-alpha, so I'm labeling as "Developer Issue"

Pull Request Author

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

@jmarrec jmarrec added Developer Issue component - Utilities Geometry Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. labels Sep 5, 2023
@jmarrec jmarrec self-assigned this Sep 5, 2023
Comment on lines +30 to +34
// Copy and move operators are implicitly declared, but we want the copy ctor for SWIG so we have to define all of them
Point3d(const Point3d& other) = default;
Point3d(Point3d&& other) noexcept = default;
Point3d& operator=(const Point3d&) = default;
Point3d& operator=(Point3d&&) noexcept = default;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Put back the copy ctor for swig. Have to declare all of them or the move operations are implicitly deleted

@@ -118,10 +118,23 @@ Surface3d::Surface3d(std::vector<Point3d> t_vertices, std::string t_name, size_t
itnext = std::begin(vertices);
}

edges.emplace_back(*it, *itnext, t_name, t_surfNum);
edges.emplace_back(*it, *itnext, name, surfNum);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fix an unrelated issue, t_name (the parameter) was moved from, so it's generally an empty string.

@@ -164,6 +166,7 @@ using PolyhedronVector = std::vector<Polyhedron>;

/// ostream operator
UTILITIES_API std::ostream& operator<<(std::ostream& os, const Surface3dEdge& edge);
UTILITIES_API std::ostream& operator<<(std::ostream& os, const Surface3d& surface3d);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Add an ostream operator<< for convenience

@@ -138,6 +138,8 @@ class UTILITIES_API Polyhedron
* proportion of conflicted edges / total number of edges */
std::vector<Surface3d> findSurfacesWithIncorrectOrientation() const;

std::vector<Surface3d> surface3ds() const;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Convenience getter for inspection / debugging in Polyhedron

Comment on lines +172 to +178
%extend openstudio::Surface3d {
std::string __str__() const {
std::ostringstream os;
os << *self;
return os.str();
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Use the new Surface3d::operator<< in the swig interface file

Copy link
Contributor

@shorowit shorowit left a comment

Choose a reason for hiding this comment

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

Confirmed that this fixes the error we were hitting.

@jmarrec jmarrec merged commit b68aa0a into develop Sep 6, 2023
4 of 6 checks passed
@jmarrec jmarrec deleted the 4957_Swig_CopyCtors branch September 6, 2023 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component - Utilities Geometry Developer Issue Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some copy constructors aren't declared in SWIG
3 participants