-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be134cc
commit 68b0715
Showing
19 changed files
with
545 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** | ||
* @file ChannelPosition.h | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "Channel.h" | ||
|
||
namespace arch { | ||
|
||
/** | ||
* @brief Class to specify the relative position of a point in a channel. | ||
*/ | ||
template<typename T> | ||
class ChannelPosition { | ||
private: | ||
RectangularChannel<T>* channel; ///< Channel in which the point is. | ||
T position; ///< Exact relative position (between 0.0 and 1.0) within the channel. | ||
|
||
public: | ||
/** | ||
* @brief Constructor to create the position of the point. | ||
* @param[in] channel Channel in which this point currently is. | ||
* @param[in] position Relative position (between 0.0 and 1.0) of the point in this channel. | ||
*/ | ||
ChannelPosition(RectangularChannel<T>* channel, T position); | ||
|
||
/** | ||
* @brief Change the channel of the channel position (at which the point currently is). | ||
* @param[in] channel New channel to which the position should be set. | ||
*/ | ||
void setChannel(RectangularChannel<T>* const channel); | ||
|
||
/** | ||
* @brief Reset relative position. | ||
* @param[in] position Relative position (between 0.0 and 1.0) within a channel. | ||
*/ | ||
void setPosition(T position); | ||
|
||
/** | ||
* @brief Add the volume shift to the current position. | ||
* @param[in] volumeShift Shift of the volume in flow direction in m^3. | ||
*/ | ||
void addToPosition(T volumeShift); | ||
|
||
/** | ||
* @brief Returns pointer to channel in which this end of the droplet currently is. | ||
* @return Pointer to channel at which this end of the droplet currently is. | ||
*/ | ||
RectangularChannel<T>* getChannel() const; | ||
|
||
/** | ||
* @brief Returns relative position within the channel. | ||
* @return Relative position (between 0.0 and 1.0) at which this end of the droplet currently is. | ||
*/ | ||
T getPosition() const; | ||
|
||
/** | ||
* @brief Returns absolute position within channel in m. | ||
* @return Absolute position in m. | ||
*/ | ||
T getAbsolutePosition() const; | ||
|
||
/** | ||
* @brief Calculates and returns volume towards node 0. | ||
* @return Volume towards node 0 in m^3. | ||
*/ | ||
T getVolume0() const; | ||
|
||
/** | ||
* @brief Calculates and returns volume towards node 1. | ||
* @return Volume towards node 1 in m^3. | ||
*/ | ||
T getVolume1() const; | ||
}; | ||
|
||
} // namespace arch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include "ChannelPosition.h" | ||
|
||
#include "Channel.h" | ||
|
||
namespace arch { | ||
|
||
template<typename T> | ||
ChannelPosition<T>::ChannelPosition(RectangularChannel<T>* channel, T position) : channel(channel), position(position) {} | ||
|
||
template<typename T> | ||
void ChannelPosition<T>::setChannel(RectangularChannel<T>* const channel) { | ||
this->channel = channel; | ||
} | ||
|
||
template<typename T> | ||
void ChannelPosition<T>::setPosition(T position) { | ||
// ensure that position stays in range (e.g., due to rounding errors) | ||
if (position < 0.0) { | ||
this->position = 0.0; | ||
} else if (position > 1.0) { | ||
this->position = 1.0; | ||
} else { | ||
this->position = position; | ||
} | ||
} | ||
|
||
template<typename T> | ||
void ChannelPosition<T>::addToPosition(T volumeShift) { | ||
T newPosition = position + volumeShift / channel->getVolume(); | ||
setPosition(newPosition); | ||
} | ||
|
||
template<typename T> | ||
RectangularChannel<T>* ChannelPosition<T>::getChannel() const { | ||
return channel; | ||
} | ||
|
||
template<typename T> | ||
T ChannelPosition<T>::getPosition() const { | ||
return position; | ||
} | ||
|
||
template<typename T> | ||
T ChannelPosition<T>::getAbsolutePosition() const { | ||
return position * channel->getLength(); | ||
} | ||
|
||
template<typename T> | ||
T ChannelPosition<T>::getVolume0() const { | ||
return position * channel->getVolume(); | ||
} | ||
|
||
template<typename T> | ||
T ChannelPosition<T>::getVolume1() const { | ||
return (1.0 - position) * channel->getVolume(); | ||
} | ||
|
||
} // namespace arch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* @file Pump.h | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "Edge.h" | ||
#include "Fluid.h" | ||
|
||
namespace arch { | ||
|
||
/** | ||
* @brief Abstract class to specify a pump, which is a component of a chip. | ||
* | ||
*/ | ||
template<typename T> | ||
class Pump : public virtual Edge<T> { | ||
private: | ||
int mixtureId; // Id of the mixture that is pumped through the chip by the pump. | ||
|
||
public: | ||
/** | ||
* @brief Construct a new Pump object | ||
*/ | ||
Pump(); | ||
|
||
/** | ||
* @brief Set the mixture that should be pumped through the chip by this pump | ||
* | ||
* @param mixtureId Id of the mixture. | ||
*/ | ||
void setMixture(int mixtureId); | ||
|
||
/** | ||
* @brief Get the mixture that is pumped through the chip by this pump | ||
* | ||
* @return Id of the mixture. | ||
*/ | ||
int getMixtureId(); | ||
}; | ||
|
||
} // namespace arch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "Pump.h" | ||
|
||
namespace arch { | ||
|
||
template<typename T> | ||
Pump<T>::Pump() { } | ||
|
||
template<typename T> | ||
void Pump<T>::setMixture(int mixtureId) { | ||
this->mixtureId = mixtureId; | ||
} | ||
|
||
template<typename T> | ||
int Pump<T>::getMixtureId() { | ||
return mixtureId; | ||
} | ||
|
||
} // namespace arch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.