//-----------------------------------------------------------------------------
// NastBoundaryPoint2d.cpp
//-----------------------------------------------------------------------------

#include "NastBoundaryPoint2d.h"
#include "NastDebug.h"

//-----------------------------------------------------------------------------
//                    Konstruktor + Destruktor
//-----------------------------------------------------------------------------


//  pntPos   Position des Punktes 
//  vecNorm  Normalenvektor auf den Rand
//  vecVel   Geschwindigkeitsvektor an der Stelle
//  cond     die Randbedingung
CNastBoundaryPoint2d::CNastBoundaryPoint2d(const CNastPoint2d  &pntPos, 
        				   const CNastVector2d &vecNorm,
        				   const CNastVector2d &vecVel,
        				   const Condition cond  )
    :CNastPoint2d( pntPos ),
     m_vecNorm   ( vecNorm ),
     m_vecVel    ( vecVel ),
     m_cond      ( cond )
{}


//  Destruktor
CNastBoundaryPoint2d::~CNastBoundaryPoint2d()
{
    NAST_ASSERT_VALID( this );	
    // zur Zeit nichts zut tun
}


//  Copyconstr.
CNastBoundaryPoint2d::CNastBoundaryPoint2d( const CNastBoundaryPoint2d &other )
    :CNastPoint2d( other ),
     m_vecNorm( other.m_vecNorm ),
     m_vecVel( other.m_vecVel ),
     m_cond( other.m_cond )
{
    NAST_ASSERT_VALID( &other );
}


//  Zuweisungsoperator
const CNastBoundaryPoint2d&
CNastBoundaryPoint2d::operator=( const CNastBoundaryPoint2d &other )
{
    NAST_ASSERT_VALID( &other );

    if( this != &other )		//  keine Zuweisung auf sich selbst ?
    {
        //  dann kann erst mal der operator= der Basisklasse aufgerufen werden
        CNastPoint2d::operator=(other);
        
        // und dann der Rest kopiert werden
        m_vecNorm = other.m_vecNorm;
        m_vecVel  = other.m_vecVel;
        m_cond    = other.m_cond;
    }
    
    return *this;
}


// ----------------------------------------------------------------------------
//                                    Debug
// ----------------------------------------------------------------------------

void 
CNastBoundaryPoint2d::debugDump( CNastDumpContext &dumpContext ) const
{
    dumpContext << "CNastBoundaryPoint2d" << "\n";
    CNastPoint2d::debugDump( dumpContext );

    dumpContext << "\tNormalenvektor :" << m_vecNorm;
    dumpContext << "\tGeschwindigkeit:" << m_vecVel;
    
    switch( m_cond )
    {
    case CNastBoundaryPoint2d::INFLOW:
        dumpContext << "\tRandbedingung  :INFLOW \n";
        break;

    case CNastBoundaryPoint2d::OUTFLOW:
        dumpContext << "\tRandbedingung  :OUTFLOW \n";
        break;

    case CNastBoundaryPoint2d::SLIP:
        dumpContext << "\tRandbedingung  :SLIP \n";
        break;
        
    case CNastBoundaryPoint2d::NOSLIP:
        dumpContext << "\tRandbedingung  :NOSLIP \n";
        break;
        
    default:
        NAST_ASSERT(false);	// unbekannte Randbedingung
    }
    dumpContext << "\t";
    
}

void 
CNastBoundaryPoint2d::assertValid() const
{
    // zuerst einmal AssertValid der Basisklasse aufrufen
    CNastPoint2d::assertValid(); 
}


