예제 #1
0
Waveguide::Waveguide(Magnitude::Magnitude* magnitude,
        const Geometry::Element::Group<const Geometry::Surf>& elem,
        const ExcitationMode excMode,
        const std::pair<Math::UInt,Math::UInt> mode)
:   Port(magnitude, elem) {

    excitationMode_ = excMode;
    mode_ = mode;
    // Performs checks
    if (!this->getBound().isSurface()) {
        throw std::logic_error("Waveport elements must be contained "
                               "in a coplanar Geometry::Surface");
    }

    Math::CVecR3 diagonal = this->getBound().getMax() - 
                            this->getBound().getMin();
    if (!diagonal.isContainedInPlane(Math::Constants::xy)) {
        throw std::logic_error("Waveport must be contained in plane xy.");
    }

    if (this->size() == 0) {
        throw std::logic_error("Waveport must contain some elements.");
    }


    check();
}
예제 #2
0
void TEMCoaxial::set(
        const Geometry::Element::Group<const Geometry::Elem>& elemGroup) {
    // Reescales internal dimensions.
    Geometry::BoxR3 box = elemGroup.getBound();
    const Math::CVecR3 diagonal = box.getMax()-box.getMin();
    if (!diagonal.isContainedInPlane(Math::Constants::CartesianPlane::xy)) {
        throw std::logic_error("Port is not contained in a XY plane");
    }
    const Math::Real width  = box.getMax()(Math::Constants::x) -
                              box.getMin()(Math::Constants::x);
    const Math::Real height = box.getMax()(Math::Constants::y) -
                              box.getMin()(Math::Constants::y);
    const Math::Real averageNewRadius = (width + height)/4;
    innerRadius_ *= averageNewRadius;
    outerRadius_ *= averageNewRadius;
    const Math::CVecR3 averageNewOrigin = (box.getMax() + box.getMin()) / 2;
    origin_ = averageNewOrigin;
    //
    Source<Geometry::Surf>::set(elemGroup);
}