Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Pries, Jason
Oersted
Commits
5fbe4a1a
Commit
5fbe4a1a
authored
Dec 04, 2017
by
Pries, Jason
Browse files
Add AddBoundingBox option for ModelTemplates
parent
5f478851
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/Model Templates/src/ModelTemplate.h
View file @
5fbe4a1a
...
...
@@ -11,6 +11,7 @@ public:
virtual
void
add_to_sketch
(
Sketch
&
s
,
std
::
shared_ptr
<
Vertex
>
origin
)
=
0
;
bool
Convexify
{
false
};
bool
AddBoundingBox
{
false
};
std
::
vector
<
std
::
shared_ptr
<
Vertex
>>
V
;
std
::
vector
<
std
::
shared_ptr
<
LineSegment
>>
L
;
...
...
src/Model Templates/src/SynchronousReluctanceRotor.cpp
View file @
5fbe4a1a
#include "SynchronousReluctanceRotor.h"
void
SynchronousReluctanceRotor
::
add_to_sketch
(
Sketch
&
s
,
std
::
shared_ptr
<
Vertex
>
origin
)
{
std
::
cout
<<
"TODO: Clean up circular gutter center point calculation"
<<
std
::
endl
;
// Put in a geometric utility library
// Dimensions are approximate, sketch.solve() + constraints will impose real values
double_t
ri
=
InnerRadius
;
double_t
ro
=
OuterRadius
;
...
...
@@ -173,4 +175,22 @@ void SynchronousReluctanceRotor::add_to_sketch(Sketch &s, std::shared_ptr<Vertex
s
.
new_element
<
LineSegment
>
(
origin
,
V
[
0
]);
s
.
new_element
<
LineSegment
>
(
origin
,
V0p
);
}
if
(
AddBoundingBox
)
{
double_t
rb
=
ro
*
std
::
min
(
2.0
,
std
::
abs
(
sqrt
(
8.0
/
(
1.0
+
std
::
cos
(
M_PI
*
2.0
/
Poles
)))
-
1.0
));
auto
v1p
=
s
.
select_periodic_vertex
(
V
[
1
],
origin
,
360.0
/
Poles
);
auto
v11
=
s
.
new_element
<
Vertex
>
(
rb
,
0.0
);
auto
v11p
=
s
.
new_element
<
Vertex
>
(
rb
*
std
::
cos
(
M_PI
*
2.0
/
Poles
),
rb
*
std
::
sin
(
M_PI
*
2.0
/
Poles
));
auto
l0
=
s
.
new_element
<
LineSegment
>
(
V
[
1
],
v11
);
auto
l1
=
s
.
new_element
<
LineSegment
>
(
v1p
,
v11p
);
auto
co
=
s
.
new_element
<
CircularArc
>
(
v11
,
v11p
,
origin
,
rb
);
s
.
new_element
<
Radius
>
(
co
,
rb
);
s
.
new_element
<
Horizontal
>
(
l0
);
s
.
new_element
<
Angle
>
(
l0
,
l1
,
360.0
/
Poles
);
s
.
new_element
<
Coincident
<
LineSegment
>>
(
origin
,
l1
);
}
}
\ No newline at end of file
test/Model Templates/test_ModelTemplates.hpp
View file @
5fbe4a1a
#ifndef OERSTED_TEST_MODELTEMPLATES_HPP
#define OERSTED_TEST_MODELTEMPLATES_HPP
#include "gtest.h"
#include "Sketch.hpp"
#include "Mesh.hpp"
#include "ModelTemplates.hpp"
#
define SAVE_DIR "./test/output/Model\\ Templates/
"
#
include "gtest.h
"
#define SAVE_DIR "./test/output/Model Templates/"
#endif //OERSTED_TEST_MODELTEMPLATES_HPP
\ No newline at end of file
test/Model Templates/test_SynchronousReluctanceRotor.cpp
View file @
5fbe4a1a
...
...
@@ -19,6 +19,7 @@ TEST_F(Synchronous_Reluctance_Rotor, basic_test) {
srr
.
AngularThickness
=
{
3.2
,
3.2
,
3.2
,
3.2
,
3.2
,
3.2
};
srr
.
Convexify
=
true
;
std
::
cout
<<
"// TODO: Mesh creation fails with non-convex domains"
<<
std
::
endl
;
srr
.
AddBoundingBox
=
true
;
std
::
cout
<<
"TODO: Mesh creation fails with small gaps for rotor bridges without an outer boundary"
<<
std
::
endl
;
Sketch
sketch
;
...
...
@@ -35,8 +36,10 @@ TEST_F(Synchronous_Reluctance_Rotor, basic_test) {
Mesh
mesh
{
sketch
};
mesh
.
create
();
std
::
cout
<<
"TODO: Mesh creation fails with small gaps for rotor bridges"
;
mesh
.
create
();
mesh
.
MinimumElementQuality
=
0.5
;
EXPECT_TRUE
(
mesh
.
refine
());
mesh
.
save_as
(
SAVE_DIR
,
"Synchronous_Reluctance_Rotor"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment