<commit_before><html xmlns="http://www.w3.org/1999/xhtml">
  <!--
    Copyright 2010-2011 Fabric Technologies Inc. All rights reserved.
    -->
  <head> 
    <title>FABRIC - Flocking</title> 
    
    <meta charset="iso-8859-1"/>
    <link href="../../../themes/default/style.css" rel="stylesheet" type="text/css" />
    <link href="../../../themes/default/viewer.css" rel="stylesheet" type="text/css" />
    
    <script type="text/javascript" src="../../../ThirdParty/jQuery/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="../../../ThirdParty/jQuery/jquery-ui-1.8.5.custom.min.js"></script>

    <link type="text/css" href="../../../ThirdParty/jQuery/css/vader/jquery-ui-1.8.5.custom.css" rel="stylesheet" />

    <script type="text/javascript" src="../../../Core/FABRIC.Wrappers.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../Core/FABRIC.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Math.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/RGBA.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Vec2.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Vec3.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Vec4.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Mat33.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Mat44.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Quat.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Xfo.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Color.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Ray.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/CollectedPoints.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/RGBA.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Euler.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/HashTable.js" charset="utf-8"></script>
    

    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.Geometry.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.Primitives.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.Lights.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.Materials.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.Manipulation.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.Particles.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.Kinematics.js" charset="utf-8"></script>
    
    <script type="text/javascript" src="../../../SceneGraph/Resources/parsers/parsePLY.js" charset="utf-8"></script>
    
    <script type="text/javascript" src="../../../Core/Debugger/FABRIC.Debugger.Events.js" charset="utf-8"></script>
    
    <script type="text/javascript">
$(document).ready(function() {
    $('#play').button({
      text: true,
      icons: {
        primary: 'ui-icon-play'
      }
    });

    $('#step').button({
      text: true,
      icons: {
        primary: 'ui-icon-step'
      }
    });

  var numAgents, gridSize, cameraPos;
  var sceneSize = 'medium';
  if (sceneSize === 'tiny') {
    cameraPos = FABRIC.RT.vec3(20, 30, -40).scale(0.05);
    numAgents = 10;
    gridSize = 6;
  }
  else if (sceneSize === 'small') {
    cameraPos = FABRIC.RT.vec3(20, 30, -40).scale(0.5);
    numAgents = 100;
    gridSize = 30;
  }
  else if (sceneSize === 'medium') {
    cameraPos = FABRIC.RT.vec3(20, 30, -40).scale(0.5);
    numAgents = 7000;
    gridSize = 80;
  }
  else if (sceneSize === 'huge') {
    cameraPos = FABRIC.RT.vec3(20, 30, -40).scale(5.0);
    numAgents = 10000;
    gridSize = 250;
  }
  else if (sceneSize === 'massive') {
    cameraPos = FABRIC.RT.vec3(20, 30, -40).scale(50);
    numAgents = 160000;
    gridSize = 800;
  }

  // Create the scene.
  scene = FABRIC.SceneGraph.createScene();
  var viewport = scene.constructNode('Viewport', {
      windowElement: document.getElementById('FabricContainer'),
      backgroundColor: FABRIC.RT.rgb(0.5, 0.7, 0.9),
      enableRaycasting: true
    });

  var light = scene.constructNode('PointLight', { position: FABRIC.RT.vec3(420.0, 1000.0, 600.0) });
  // Create a camera to draw the scene from
  var camera = scene.constructNode('TargetCamera', {
      target: FABRIC.RT.vec3(0, 0, 0),
      position: cameraPos,
      nearDistance: 1,
      farDistance: 1000
    });
  viewport.setCameraNode(camera);

  scene.constructNode('CameraManipulator', { targetNode: camera });



  /////////////////////////////////////////////////
  // Create the Flock
  var flockMaterial = scene.constructNode('FlatMaterial', {
      prototypeMaterialType: 'PointMaterial',
      pointSize: 3.0 ,
      color: FABRIC.RT.rgb(1.0, 0.0, 0.0)
    });

  var particlesNode = scene.constructNode('Flock', {
      cellsize: 1,
      x_count: gridSize,
      y_count: 1,
      z_count: gridSize,
      displayGrid: true
    });

  scene.constructNode('Instance', {
      geometryNode: particlesNode,
      materialNode: flockMaterial
    });

  var particlePositions = [];
  var particleGoals = [];
  var particleVelocities = [];
  for (i = 0; i < numAgents; i++) {
    particlePositions.push(FABRIC.RT.vec3(
      (Math.random() - 0.5) * gridSize * 0.95,
      0.0,
      (Math.random() - 0.5) * gridSize * 0.95
    ));
    particleGoals.push(FABRIC.RT.vec3(
      (Math.random() - 0.5) * gridSize * 0.95,
      0.0,
      (Math.random() - 0.5) * gridSize * 0.95
    ));
  //  particleGoals.push( FABRIC.RT.vec3( 0.0, 0.0, 0.0 ) );
    particleVelocities.push(FABRIC.RT.vec3(
      Math.random() - 0.5,
      0.0,
      Math.random() - 0.5
    ).scale(0.02));
  }
  particlesNode.loadGeometryData({
    positions: particlePositions,
    goals: particleGoals,
    velocities: particleVelocities
  });

  /////////////////////////////////////////////////
  // Set up the painting of the ground plane.
/*  var groundMaterial = scene.constructNode("VertexColorMaterial", {
    diffuseColor:FABRIC.RT.rgb(0.2,0.7,0.4),
    lightNode:light
  });
  var groundPlane = scene.constructNode("Plane", {
    length:gridSize,
    width:gridSize,
    lengthSections:gridSize/3,
    widthSections:gridSize/3
  });
  groundPlane.addVertexAttributeValue( "vertexColors", "Color", FABRIC.RT.rgb( 0.0, 0.6, 0.0 ) );
  var groundPlaneInstance = scene.constructNode("Instance", {
      transformNode:scene.constructNode("Transform", {
        hierarchical:false,
        globalXfo:FABRIC.RT.xfo({ tr:FABRIC.RT.vec3(0, -0.3, 0) })
      }),
      geometryNode:groundPlane,
      materialNode:groundMaterial,
      enableRaycasting:false
    });

  var paintManipulator = scene.constructNode("PaintManipulator" );
  paintManipulator.addGeometryInstance( groundPlaneInstance );

  var onPaintFn = function( evt ){
    groundPlane.reloadVBO( "vertexColors" );
    viewport.redraw();
  }

  paintManipulator.addEventListener( "onpaint", onPaintFn );
*/
  var errors = scene.getErrors();
  if (errors.length > 0) {
    throw (errors.toString());
  }
  else {

    document.getElementById('numAgents').childNodes[0].data = 'Num Agents:' + numAgents;

    setInterval(function() {
        document.getElementById('frameRate').childNodes[0].data = 'Frame Rate:' + viewport.getFPS().toFixed(2);
      }, 600);

    console.log(scene.getTimerProfiles());
    console.log('Done');

    $('#play').button()
      .click(function() {
        var options;
        if ($(this).text() == 'Play') {
          $(this).button('option', {
            label: 'Pause',
            icons: {
              primary: 'ui-icon-pause'
            }
          });
          scene.animation.play();
        } else {
          $(this).button('option', {
            label: 'Play',
            icons: {
              primary: 'ui-icon-play'
            }
          });
          scene.animation.pause();
        }
      });
    $('#step').button()
      .click(function() {
        scene.animation.step();
      });

  }
});

</script>

  </head> 
  <body>
    <div id="wrapper">
      <ul id="nav">
        <li><a href="#" id="fabric-logo"><img src="../../../themes/default/_img/projects/fabric-logo.png" /></a></li>
      </ul>
      <div id="editor">
        <div id="viewer">
          <div id="FabricContainer"></div> 
        </div><!--viewer-->
        <div id="sidebar">
        
          <div class="box">
            <h2>INFO</h2>
              <div class="content">
              Particle Flocking.<br>
              Each particle is processed in a different slice, making use of FABRIC's multithreading architecture. 
            </div><!--content-->
          </div><!--box-->

                <div class="box">
                  <h2>CONTROLS</h2>
                  <div class="content">
                    <button id="play" style="margin-top:10px;">Play</button>
                    <button id="step" style="margin-top:10px;">Step</button>
                  </div><!--content-->
                </div><!--box-->
        
          <div class="box">
            <h2 id="agents">CPU FLOCKING</h2>
            <div class="content" id="numAgents">Num Agents:</div><p></p>
          </div><!--box-->
          
          <div class="box">
            <h2 id="agents">PERFORMANCE</h2>
            <div class="content" id="frameRate">Frame Rate:</div><p></p>
          </div><!--box-->
      
        </div><!--sidebar-->
      </div> <!--editor-->
    </div><!--wrapper-->
  </body> 
  </html>
<commit_msg>Add unit test for global Size constants<commit_after><html xmlns="http://www.w3.org/1999/xhtml">
  <!--
    Copyright 2010-2011 Fabric Technologies Inc. All rights reserved.
    -->
  <head> 
    <title>FABRIC - Flocking</title> 
    
    <meta charset="iso-8859-1"/>
    <link href="../../../themes/default/style.css" rel="stylesheet" type="text/css" />
    <link href="../../../themes/default/viewer.css" rel="stylesheet" type="text/css" />
    
    <script type="text/javascript" src="../../../ThirdParty/jQuery/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="../../../ThirdParty/jQuery/jquery-ui-1.8.5.custom.min.js"></script>

    <link type="text/css" href="../../../ThirdParty/jQuery/css/vader/jquery-ui-1.8.5.custom.css" rel="stylesheet" />

    <script type="text/javascript" src="../../../Core/FABRIC.Wrappers.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../Core/FABRIC.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Math.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/RGBA.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Vec2.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Vec3.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Vec4.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Mat33.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Mat44.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Quat.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Xfo.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Color.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Ray.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/CollectedPoints.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/RGBA.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/Euler.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/RT/HashTable.js" charset="utf-8"></script>
    

    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.Geometry.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.Primitives.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.Lights.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.Materials.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.Manipulation.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.Particles.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../SceneGraph/Resources/FABRIC.SceneGraph.Kinematics.js" charset="utf-8"></script>
    
    <script type="text/javascript" src="../../../SceneGraph/Resources/parsers/parsePLY.js" charset="utf-8"></script>
    
    <script type="text/javascript" src="../../../Core/Debugger/FABRIC.Debugger.Events.js" charset="utf-8"></script>
    
    <script type="text/javascript">
$(document).ready(function() {
    $('#play').button({
      text: true,
      icons: {
        primary: 'ui-icon-play'
      }
    });

    $('#step').button({
      text: true,
      icons: {
        primary: 'ui-icon-step'
      }
    });

  var numAgents, gridSize, cameraPos;
  var sceneSize = 'massive';
  if (sceneSize === 'tiny') {
    cameraPos = FABRIC.RT.vec3(20, 30, -40).scale(0.05);
    numAgents = 10;
    gridSize = 6;
  }
  else if (sceneSize === 'small') {
    cameraPos = FABRIC.RT.vec3(20, 30, -40).scale(0.5);
    numAgents = 100;
    gridSize = 30;
  }
  else if (sceneSize === 'medium') {
    cameraPos = FABRIC.RT.vec3(20, 30, -40).scale(0.5);
    numAgents = 7000;
    gridSize = 80;
  }
  else if (sceneSize === 'huge') {
    cameraPos = FABRIC.RT.vec3(20, 30, -40).scale(5.0);
    numAgents = 10000;
    gridSize = 250;
  }
  else if (sceneSize === 'massive') {
    cameraPos = FABRIC.RT.vec3(20, 30, -40).scale(50);
    numAgents = 160000;
    gridSize = 800;
  }

  // Create the scene.
  scene = FABRIC.SceneGraph.createScene();
  var viewport = scene.constructNode('Viewport', {
      windowElement: document.getElementById('FabricContainer'),
      backgroundColor: FABRIC.RT.rgb(0.5, 0.7, 0.9),
      enableRaycasting: true
    });

  var light = scene.constructNode('PointLight', { position: FABRIC.RT.vec3(420.0, 1000.0, 600.0) });
  // Create a camera to draw the scene from
  var camera = scene.constructNode('TargetCamera', {
      target: FABRIC.RT.vec3(0, 0, 0),
      position: cameraPos,
      nearDistance: 1,
      farDistance: 1000
    });
  viewport.setCameraNode(camera);

  scene.constructNode('CameraManipulator', { targetNode: camera });



  /////////////////////////////////////////////////
  // Create the Flock
  var flockMaterial = scene.constructNode('FlatMaterial', {
      prototypeMaterialType: 'PointMaterial',
      pointSize: 3.0 ,
      color: FABRIC.RT.rgb(1.0, 0.0, 0.0)
    });

  var particlesNode = scene.constructNode('Flock', {
      cellsize: 1,
      x_count: gridSize,
      y_count: 1,
      z_count: gridSize,
      displayGrid: true
    });

  scene.constructNode('Instance', {
      geometryNode: particlesNode,
      materialNode: flockMaterial
    });

  var particlePositions = [];
  var particleGoals = [];
  var particleVelocities = [];
  for (i = 0; i < numAgents; i++) {
    particlePositions.push(FABRIC.RT.vec3(
      (Math.random() - 0.5) * gridSize * 0.95,
      0.0,
      (Math.random() - 0.5) * gridSize * 0.95
    ));
    particleGoals.push(FABRIC.RT.vec3(
      (Math.random() - 0.5) * gridSize * 0.95,
      0.0,
      (Math.random() - 0.5) * gridSize * 0.95
    ));
  //  particleGoals.push( FABRIC.RT.vec3( 0.0, 0.0, 0.0 ) );
    particleVelocities.push(FABRIC.RT.vec3(
      Math.random() - 0.5,
      0.0,
      Math.random() - 0.5
    ).scale(0.02));
  }
  particlesNode.loadGeometryData({
    positions: particlePositions,
    goals: particleGoals,
    velocities: particleVelocities
  });

  /////////////////////////////////////////////////
  // Set up the painting of the ground plane.
/*  var groundMaterial = scene.constructNode("VertexColorMaterial", {
    diffuseColor:FABRIC.RT.rgb(0.2,0.7,0.4),
    lightNode:light
  });
  var groundPlane = scene.constructNode("Plane", {
    length:gridSize,
    width:gridSize,
    lengthSections:gridSize/3,
    widthSections:gridSize/3
  });
  groundPlane.addVertexAttributeValue( "vertexColors", "Color", FABRIC.RT.rgb( 0.0, 0.6, 0.0 ) );
  var groundPlaneInstance = scene.constructNode("Instance", {
      transformNode:scene.constructNode("Transform", {
        hierarchical:false,
        globalXfo:FABRIC.RT.xfo({ tr:FABRIC.RT.vec3(0, -0.3, 0) })
      }),
      geometryNode:groundPlane,
      materialNode:groundMaterial,
      enableRaycasting:false
    });

  var paintManipulator = scene.constructNode("PaintManipulator" );
  paintManipulator.addGeometryInstance( groundPlaneInstance );

  var onPaintFn = function( evt ){
    groundPlane.reloadVBO( "vertexColors" );
    viewport.redraw();
  }

  paintManipulator.addEventListener( "onpaint", onPaintFn );
*/
  var errors = scene.getErrors();
  if (errors.length > 0) {
    throw (errors.toString());
  }
  else {

    document.getElementById('numAgents').childNodes[0].data = 'Num Agents:' + numAgents;

    setInterval(function() {
        document.getElementById('frameRate').childNodes[0].data = 'Frame Rate:' + viewport.getFPS().toFixed(2);
      }, 600);

    console.log(scene.getTimerProfiles());
    console.log('Done');

    $('#play').button()
      .click(function() {
        var options;
        if ($(this).text() == 'Play') {
          $(this).button('option', {
            label: 'Pause',
            icons: {
              primary: 'ui-icon-pause'
            }
          });
          scene.animation.play();
        } else {
          $(this).button('option', {
            label: 'Play',
            icons: {
              primary: 'ui-icon-play'
            }
          });
          scene.animation.pause();
        }
      });
    $('#step').button()
      .click(function() {
        scene.animation.step();
      });

  }
});

</script>

  </head> 
  <body>
    <div id="wrapper">
      <ul id="nav">
        <li><a href="#" id="fabric-logo"><img src="../../../themes/default/_img/projects/fabric-logo.png" /></a></li>
      </ul>
      <div id="editor">
        <div id="viewer">
          <div id="FabricContainer"></div> 
        </div><!--viewer-->
        <div id="sidebar">
        
          <div class="box">
            <h2>INFO</h2>
              <div class="content">
              Particle Flocking.<br>
              Each particle is processed in a different slice, making use of FABRIC's multithreading architecture. 
            </div><!--content-->
          </div><!--box-->

                <div class="box">
                  <h2>CONTROLS</h2>
                  <div class="content">
                    <button id="play" style="margin-top:10px;">Play</button>
                    <button id="step" style="margin-top:10px;">Step</button>
                  </div><!--content-->
                </div><!--box-->
        
          <div class="box">
            <h2 id="agents">CPU FLOCKING</h2>
            <div class="content" id="numAgents">Num Agents:</div><p></p>
          </div><!--box-->
          
          <div class="box">
            <h2 id="agents">PERFORMANCE</h2>
            <div class="content" id="frameRate">Frame Rate:</div><p></p>
          </div><!--box-->
      
        </div><!--sidebar-->
      </div> <!--editor-->
    </div><!--wrapper-->
  </body> 
  </html>

{'fraction_non_alphanumeric': 0.20906717303584144, 'fraction_numerical': 0.024590553050083078, 'mean_word_length': 2.475664081834681, 'pattern_counts': {'":': 0, '<': 271, '<?xml version=': 0, '>': 271, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1063632', 'n_tokens_mistral': 7176, 'n_tokens_neox': 6709, 'n_words': 1078}