Exemple #1
0
//////////////////////// deal array //////////////////////////

    void ForAllVec2(Vector2[] arr, DealVec2 func, int threadID = -1)
    {
        int begI = (threadID < 0)? 0 : threadID * width / ThreadNumber;
        int endI = (threadID < 0)? width : (threadID + 1) * width / ThreadNumber;

        for (int i = begI; i < endI; ++i)
        {
            for (int j = 0; j < height; ++j)
            {
                int pos = ij2index(i, j);
                arr[pos] = func(arr[pos], i, j);
            }
        }
    }
Exemple #2
0
//////////////////////// deal array //////////////////////////

	void ForAllVec2(Vector2[] arr , DealVec2 func , int threadID = -1 )
	{
		int begI = (threadID < 0 )? 0 : threadID * width / ThreadNumber;
		int endI = (threadID < 0 )? width : ( threadID + 1 ) * width / ThreadNumber;

		for( int i = begI ; i < endI ; ++ i )
		for( int j = 0 ; j < height ; ++ j )
		{
			int pos = ij2index( i , j );
			arr[pos] = func(arr[pos] , i , j );
		}
	}