IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
corsika
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pranav Sampathkumar
corsika
Commits
c7f46af8
Commit
c7f46af8
authored
6 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
addition & subtraction for Vector & Point
parent
4657b4de
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Framework/Geometry/Point.h
+12
-1
12 additions, 1 deletion
Framework/Geometry/Point.h
Framework/Geometry/QuantityVector.h
+17
-0
17 additions, 0 deletions
Framework/Geometry/QuantityVector.h
Framework/Geometry/Vector.h
+4
-5
4 additions, 5 deletions
Framework/Geometry/Vector.h
with
33 additions
and
6 deletions
Framework/Geometry/Point.h
+
12
−
1
View file @
c7f46af8
...
...
@@ -3,13 +3,13 @@
#include
"BaseVector.h"
#include
"QuantityVector.h"
#include
"Vector.h"
#include
<phys/units/quantity.hpp>
class
Point
:
public
BaseVector
<
phys
::
units
::
length_d
>
{
using
Length
=
phys
::
units
::
quantity
<
phys
::
units
::
length_d
,
double
>
;
public:
Point
(
CoordinateSystem
const
&
pCS
,
QuantityVector
<
phys
::
units
::
length_d
>
pQVector
)
:
BaseVector
<
phys
::
units
::
length_d
>
(
pCS
,
pQVector
)
...
...
@@ -43,6 +43,17 @@ public:
BaseVector
<
phys
::
units
::
length_d
>::
qVector
=
getCoordinates
(
pCS
);
BaseVector
<
phys
::
units
::
length_d
>::
cs
=
&
pCS
;
}
Point
operator
+
(
Vector
<
phys
::
units
::
length_d
>
const
&
pVec
)
const
{
return
Point
(
*
BaseVector
<
phys
::
units
::
length_d
>::
cs
,
getCoordinates
()
+
pVec
.
getComponents
(
*
BaseVector
<
phys
::
units
::
length_d
>::
cs
));
}
Vector
<
phys
::
units
::
length_d
>
operator
-
(
Point
const
&
pB
)
const
{
auto
&
cs
=
*
BaseVector
<
phys
::
units
::
length_d
>::
cs
;
return
Vector
<
phys
::
units
::
length_d
>
(
cs
,
getCoordinates
()
-
pB
.
getCoordinates
(
cs
));
}
};
#endif
This diff is collapsed.
Click to expand it.
Framework/Geometry/QuantityVector.h
+
17
−
0
View file @
c7f46af8
...
...
@@ -29,6 +29,23 @@ public:
{
return
Quantity
(
phys
::
units
::
detail
::
magnitude_tag
,
eVector
[
index
]);
}
Quantity
norm
()
const
{
return
Quantity
(
phys
::
units
::
detail
::
magnitude_tag
,
eVector
.
norm
());
}
auto
operator
+
(
QuantityVector
<
dim
>
const
&
pQVec
)
const
{
return
QuantityVector
<
dim
>
(
eVector
+
pQVec
.
eVector
);
}
auto
operator
-
(
QuantityVector
<
dim
>
const
&
pQVec
)
const
{
return
QuantityVector
<
dim
>
(
eVector
-
pQVec
.
eVector
);
}
//auto operator*(
};
template
<
typename
dim
>
...
...
This diff is collapsed.
Click to expand it.
Framework/Geometry/Vector.h
+
4
−
5
View file @
c7f46af8
...
...
@@ -10,13 +10,12 @@ class Vector : public BaseVector<dim>
{
using
Quantity
=
phys
::
units
::
quantity
<
dim
,
double
>
;
public:
Vector
(
CoordinateSystem
const
&
pCS
,
QuantityVector
<
dim
>
pQVector
)
:
BaseVector
<
Quantity
>
(
pCS
,
pQVector
)
BaseVector
<
dim
>
(
pCS
,
pQVector
)
{
}
public
:
Vector
(
CoordinateSystem
const
&
cs
,
Quantity
x
,
Quantity
y
,
Quantity
z
)
:
BaseVector
<
dim
>
(
cs
,
QuantityVector
<
dim
>
(
x
,
y
,
z
))
{
...
...
@@ -47,7 +46,7 @@ public:
auto
norm
()
const
{
return
Quantity
(
BaseVector
<
dim
>::
qVector
.
eVector
.
norm
()
)
;
return
BaseVector
<
dim
>::
qVector
.
norm
();
}
//~ template <typename dim2>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment