﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1170	vector causes assertion errors	Per Östlund	Per Östlund	"The models
{{{
package Modelica
  package Icons
    partial function Function ""Icon for a function""
      annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{ -100, -100},{100,100}}), graphics = {Text(extent = {{ -140,162},{136,102}}, textString = ""%name"", lineColor = {0,0,255}),Ellipse(extent = {{ -100,100},{100, -100}}, lineColor = {255,127,0}, fillColor = {255,255,255}, fillPattern = FillPattern.Solid),Text(extent = {{ -100,100},{100, -100}}, lineColor = {255,127,0}, textString = ""f"")}), Documentation(info = ""<html><p>This icon is designed for a <b>function</b></p></html>""));
    end Function;    
  end Icons;
  
  package SIunits
    type Length = Real(final quantity = ""Length"", final unit = ""m"");
    type Position = Length;
  end SIunits;
end Modelica;


 function PolyToRelCoord ""Transforms polygon to relative coordinate system""
    extends Modelica.Icons.Function;
    import SI=Modelica.SIunits;
    input Real T[4, 4] ""Transformation matrix"";
    input SI.Position s[3, :] ""Polygon to be transformed"";
    output SI.Position r[3, size(s, 2)] ""Transformed polygon"";
  protected
    Real p[4] ""auxillary vector variable"";
  algorithm
    for i in 1:size(s, 2) loop
      p := vector(T*[s[:, i]; 1]);
      r[:, i] := p[1:3];
      //r := cat(2,r,[p[1];p[2];p[3]]);
    end for;
  end PolyToRelCoord;

model TestPoly
  Real crap[3,:] = PolyToRelCoord(ones(4, 4), ones(3, 4));
end TestPoly;
}}}
and 
{{{
model VectorTest
function PolyToRelCoord ""Transforms polygon to relative coordinate system""
    input Real T[4, 4] ""Transformation matrix"";
    input Real s[3, :] ""Polygon to be transformed"";
    output Real r[3, size(s, 2)] ""Transformed polygon"";
  protected
    Real p[4] ""auxillary vector variable"";
  algorithm
    for i in 1:size(s, 2) loop
      p := vector(T*[s[:, i]; 1]);
      r[:, i] := p[1:3];
    end for;
  end PolyToRelCoord;

  constant Real H[4,4] = diagonal(ones(4));
  constant Real ply[3,4] = [1.0, 0.0, 0.0, 1.0; 1.0, 0.0, 1.0, 0.0; 0.0, 0.0, 1.0, 1.0];
  constant Real plyprime[3,4] = PolyToRelCoord(H,ply);

end VectorTest;
}}}
both cause an assertion to fail in the C runtime:
{{{
Assertion failed: j == dest->ndims, file real_array.c, line 358 
}}}"	defect	closed	high			1.5.0RC2	fixed		Per Östlund Per Östlund
