AbstractBoundaryOperatorPseudoinverse<BasisFunctionType, ResultType>::
AbstractBoundaryOperatorPseudoinverse(
        // TODO: add a solver argument specifying how to calculate the pseudoinv.
        const BoundaryOperator<BasisFunctionType, ResultType>& operatorToInvert) :
    Base(operatorToInvert.range(), operatorToInvert.domain(),
         operatorToInvert.domain() == operatorToInvert.range() ?
             operatorToInvert.dualToRange() :
             // assume that domain == dualToRange, we'll verify it
             // in the body of the constructor
             operatorToInvert.range(),
         "pinv(" + operatorToInvert.label() + ")",
         throwIfUninitialized(operatorToInvert,
                              "AbstractBoundaryOperatorPseudoinverse::"
                              "AbstractBoundaryOperatorPseudoinverse(): "
                              "the boundary operator to be inverted must be "
                              "initialized"
                              ).abstractOperator()->symmetry()),
    m_operator(operatorToInvert),
    m_id(boost::make_shared<AbstractBoundaryOperatorPseudoinverseId<
         BasisFunctionType, ResultType> >(
             operatorToInvert))
{
    if (operatorToInvert.domain() != operatorToInvert.range() &&
            operatorToInvert.domain() != operatorToInvert.dualToRange())
        throw std::runtime_error(
                "AbstractBoundaryOperatorPseudoinverse::"
                "AbstractBoundaryOperatorPseudoinverse(): "
                "Dual to the domain of the operator to invert cannot be determined "
                "since the domain is different from both "
                "the range and the space dual to its range");
}
Esempio n. 2
0
unsigned EthernetFrame::setBack(ACE_UINT8* buffer, const unsigned bufLen) {
	ACE_TRACE("EthernetFrame::setBack");
	throwIfUninitialized(); // setHeader() has to be called first

	if ( getExpectedLength() != bufLen + minBytesToDetermineLength() ) {
		ND_ERROR("Expected length %d != %d + buffer size %d (type is %04X)!\n",
			getExpectedLength(), minBytesToDetermineLength(), bufLen, getEtherType());
		throw std::runtime_error("Expected Ethernet header/payload length is different than buffer.");
	}
	
	setBufferSize(getExpectedLength());
	copyUnit(ptrUnit() + minBytesToDetermineLength(), buffer, bufLen);

	return getUnitLength();
}
AbstractBoundaryOperatorPseudoinverse<BasisFunctionType, ResultType>::
AbstractBoundaryOperatorPseudoinverse(
        // TODO: add a solver argument specifying how to calculate the pseudoinv.
        const BoundaryOperator<BasisFunctionType, ResultType>& operatorToInvert,
        const shared_ptr<const Space<BasisFunctionType> >& dualToRange) :
    Base(operatorToInvert.range(), operatorToInvert.domain(),dualToRange,
         "pinv(" + operatorToInvert.label() + ")",
         throwIfUninitialized(operatorToInvert,
                              "AbstractBoundaryOperatorPseudoinverse::"
                              "AbstractBoundaryOperatorPseudoinverse(): "
                              "the boundary operator to be inverted must be "
                              "initialized"
                              ).abstractOperator()->symmetry()),
    m_operator(operatorToInvert),
    m_id(boost::make_shared<AbstractBoundaryOperatorPseudoinverseId<
         BasisFunctionType, ResultType> >(
             operatorToInvert))
{
}