numagic / lumos

scalable accelerated optimal control
MIT License
16 stars 0 forks source link

provide an API for user to set custom mesh #77

Closed yunlongxu-numagic closed 1 year ago

yunlongxu-numagic commented 2 years ago

Currently a uniform mesh is created by default, if the user wants to use some fancy mesh, they probably need to get their hand dirty and overwrite this method

TODO:

Unify the following attributes:

        self._matrix_normalized_mesh = np.vstack(all_interval_mesh)
        self._flat_normalized_mesh = _flat_normalized_mesh
        self._normalized_interval_length = (
            self._matrix_normalized_mesh[:, -1] - self._matrix_normalized_mesh[:, 0]
        )

and methods:

    def _get_mesh_scale(self, x):
        return self.dec_var_operator.get_var(x, "global", "mesh_scale")

    def get_mesh_from_scale(self, mesh_scale):
        """Get the unnormalized mesh as a flat array

        TODO: is this method a bit redundant?
        """
        return self._flat_normalized_mesh * mesh_scale