/*
 $Id: elements2mc.cc,v 1.2 1996/10/11 15:15:20 bzferdma Exp $
 (C)opyright 1996 by Konrad-Zuse-Center, Berlin
 All rights reserved.
 Part of the Kaskade distribution
*/

#include "elements2mc.h"

#include "numerics.h"
#include "triang.h"
#include "materials.h"
#include "integ.h"


//-------------------------------------------------------------------------

	
MCTriangle:: MCTriangle(Material* material0, int nComp0)  
			 
	    : Triangle(), nComp(nComp0), 
	      noOfNodes(nComp0*NoOfBaseNodes()), Node(NoOfBaseNodes(),nComp0)

{ 
    // --    fill array Node which defines local node numbers:

    int n, comp, node=0;
    const int nbnodes = NoOfBaseNodes();

    for (n=1; n<=nbnodes; ++n)
      for (comp=1; comp<=nComp; ++comp)  Node(n,comp) = ++node;


    // --    	     the usual initialization:

    material = material0;	

    basicInit();
    setShapeFunctionsAtIPs(nComp);
    compConstantMatrices();
    setPatterns();
}
//-------------------------------------------------------------------------


HQuadMCTriangle:: HQuadMCTriangle (Material* material0, int nComp0) 

	: HQuadTriangle(), nComp(nComp0), 
	  noOfNodes(nComp0*NoOfBaseNodes()), Node(NoOfBaseNodes(),nComp0)
{ 

    // --    fill array Node which defines local node numbers:

    int n, comp, node=0;
    const int nbnodes = NoOfBaseNodes();

    for (n=1; n<=nbnodes; ++n)
      for (comp=1; comp<=nComp; ++comp)  Node(n,comp) = ++node;


    // --    	     the usual initialization:

    material = material0;	

    basicInit();
    setShapeFunctionsAtIPs(nComp);
    compConstantMatrices();
    setPatterns();
}
//-------------------------------------------------------------------------


void HQuadMCTriangle:: setPatterns()
{
    int i, j, comp1, comp2, node1, node2;
    const int nbnodes = NoOfBaseNodes();

    StdElement::setPatterns();


    // -- 	set the assembly pattern for DLY:

    DLYPattern = new Matrix<int>(NoOfNodes(),NoOfNodes());
    
    FORALL_ROWS(*DLYPattern,i)
    FORALL_COLUMNS(*DLYPattern,j)  (*DLYPattern)(i,j) = False;
    
    for (comp1=1; comp1<=nComp; ++comp1)
    for (comp2=1; comp2<=nComp; ++comp2)
    {
	for (i=4; i<=nbnodes; ++i)
	{
	    node1 = Node(i,comp1);
	    (*DLYPattern)(node1,node1) = True;
	    
	    for (j=1; j<=3; ++j)
	    {
		node2 = Node(j,comp2);
		(*DLYPattern)(node1,node2) = True;
	    }
	}
    }
}


syntax highlighted by Code2HTML, v. 0.9.1