(* ::Package:: *)

(************************************************************************)
(* This file was generated automatically by the Mathematica front end.  *)
(* It contains Initialization cells from a Notebook file, which         *)
(* typically will have the same name as this file except ending in      *)
(* ".nb" instead of ".m".                                               *)
(*                                                                      *)
(* This file is intended to be loaded into the Mathematica kernel using *)
(* the package loading commands Get or Needs.  Doing so is equivalent   *)
(* to using the Evaluate Initialization Cells menu command in the front *)
(* end.                                                                 *)
(*                                                                      *)
(* DO NOT EDIT THIS FILE.  This entire file is regenerated              *)
(* automatically each time the parent Notebook file is saved in the     *)
(* Mathematica front end.  Any changes you make to this file will be    *)
(* overwritten.                                                         *)
(************************************************************************)



FixTriangle[i_,{j_,k_,m_}] := Module[
{TempPositions,n},
TempPositions=Flatten[Position[{j,k,m},i]];
If[ Length[TempPositions]==1,n=TempPositions[[1]],
Return[Print["FixTriangle: Innapropriate Triangle Input"]]];
RotateLeft[{j,k,m},n-1]
] 


TrianglePlot[{TriangleList_,NodeCoordinateList_}]:= Module[
{n1,n2,n3,p1,p2,p3,i},
Show[
Graphics[
{
Table[
{n1,n2,n3}=TriangleList[[i]];
p1=NodeCoordinateList[[n1]];
p2=NodeCoordinateList[[n2]];
p3=NodeCoordinateList[[n3]];
{
{
EdgeForm[{Thick,Black}],
Hue[i/Length[TriangleList]],
Polygon[ {p1,p2,p3}]
},
Text[Subscript["\[CapitalDelta]", i],(p1+p2+p3)/3]
},
{i, Length[TriangleList]}
],
Table[
p1=NodeCoordinateList[[i]];
Text[Subscript["p", i],p1,
Background->White],
{i, Length[NodeCoordinateList]}
]
}
],
Frame->True
]
]


AdjacentNodes[TriangleList_,i_]:=Module[
{FilteredTriangleList},
 FilteredTriangleList=Select[TriangleList, MemberQ[#,i]&];
Union[ Flatten[FilteredTriangleList]]
]


FixTriangle[i_,{j_,k_,m_}] := Module[
{TempPositions,n},
TempPositions=Flatten[Position[{j,k,m},i]];
If[ Length[TempPositions]==1,n=TempPositions[[1]],
Return[Print["FixTriangle: Innapropriate Triangle Input"]]];
RotateLeft[{j,k,m},n-1]
] 



